@xube/kit-aws-data-schema 0.0.93 → 0.0.95
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/dist/decode/aggregate.d.ts +6 -0
- package/dist/decode/aggregate.js +7 -2
- package/dist/decode/reading.d.ts +10 -0
- package/dist/decode/reading.js +11 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/message/message.d.ts +2 -0
- package/dist/message/message.js +3 -1
- package/package.json +7 -7
- package/src/decode/aggregate.ts +9 -0
- package/src/decode/reading.ts +18 -0
- package/src/index.ts +0 -1
- package/src/message/message.ts +3 -0
- package/dist/generated/index.d.ts +0 -16
- package/dist/generated/index.js +0 -41
- package/dist/generated/types/aggregateMetadata.d.ts +0 -11
- package/dist/generated/types/aggregateMetadata.js +0 -23
- package/dist/generated/types/aggregateMetadataTypes.d.ts +0 -19
- package/dist/generated/types/aggregateMetadataTypes.js +0 -23
- package/dist/generated/types/aggregateMetadataV1.d.ts +0 -19
- package/dist/generated/types/aggregateMetadataV1.js +0 -23
- package/dist/generated/types/dataMessage.d.ts +0 -15
- package/dist/generated/types/dataMessage.js +0 -23
- package/dist/generated/types/deviceReadingMetadataV1.d.ts +0 -12
- package/dist/generated/types/deviceReadingMetadataV1.js +0 -23
- package/dist/generated/types/deviceReadingV1.d.ts +0 -15
- package/dist/generated/types/deviceReadingV1.js +0 -23
- package/dist/generated/types/readingMetadataV1.d.ts +0 -12
- package/dist/generated/types/readingMetadataV1.js +0 -23
- package/dist/generated/types/readingV1.d.ts +0 -16
- package/dist/generated/types/readingV1.js +0 -23
- package/dist/generated/validators/aggregateMetadata.js +0 -47
- package/dist/generated/validators/aggregateMetadataTypes.js +0 -215
- package/dist/generated/validators/aggregateMetadataV1.js +0 -215
- package/dist/generated/validators/dataMessage.js +0 -135
- package/dist/generated/validators/deviceReadingMetadataV1.js +0 -70
- package/dist/generated/validators/deviceReadingV1.js +0 -113
- package/dist/generated/validators/readingMetadataV1.js +0 -70
- package/dist/generated/validators/readingV1.js +0 -215
- package/dist/generator.d.ts +0 -1
- package/dist/generator.js +0 -17
- package/src/generated/index.ts +0 -16
- package/src/generated/types/aggregateMetadata.ts +0 -26
- package/src/generated/types/aggregateMetadataTypes.ts +0 -34
- package/src/generated/types/aggregateMetadataV1.ts +0 -34
- package/src/generated/types/dataMessage.ts +0 -30
- package/src/generated/types/deviceReadingMetadataV1.ts +0 -27
- package/src/generated/types/deviceReadingV1.ts +0 -30
- package/src/generated/types/readingMetadataV1.ts +0 -27
- package/src/generated/types/readingV1.ts +0 -31
- package/src/generated/validators/aggregateMetadata.js +0 -1
- package/src/generated/validators/aggregateMetadataTypes.js +0 -1
- package/src/generated/validators/aggregateMetadataV1.js +0 -1
- package/src/generated/validators/dataMessage.js +0 -1
- package/src/generated/validators/deviceReadingMetadataV1.js +0 -1
- package/src/generated/validators/deviceReadingV1.js +0 -1
- package/src/generated/validators/readingMetadataV1.js +0 -1
- package/src/generated/validators/readingV1.js +0 -1
- package/src/generator.ts +0 -50
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validate = void 0;
|
|
4
|
-
exports.validate = validate10;
|
|
5
|
-
exports.default = validate10;
|
|
6
|
-
const schema27 = { "$ref": "#/definitions/devicereadingmetadatav1JsonSchema", "definitions": { "devicereadingmetadatav1JsonSchema": { "type": "object", "properties": { "s": { "type": "number" }, "us": { "type": "number" } }, "required": ["s", "us"], "additionalProperties": false } }, "$schema": "http://json-schema.org/draft-07/schema#" };
|
|
7
|
-
const schema28 = { "type": "object", "properties": { "s": { "type": "number" }, "us": { "type": "number" } }, "required": ["s", "us"], "additionalProperties": false };
|
|
8
|
-
function validate10(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
9
|
-
if (data.s === undefined) {
|
|
10
|
-
const err0 = { instancePath, schemaPath: "#/definitions/devicereadingmetadatav1JsonSchema/required", keyword: "required", params: { missingProperty: "s" }, message: "must have required property '" + "s" + "'" };
|
|
11
|
-
if (vErrors === null) {
|
|
12
|
-
vErrors = [err0];
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
vErrors.push(err0);
|
|
16
|
-
}
|
|
17
|
-
errors++;
|
|
18
|
-
}
|
|
19
|
-
if (data.us === undefined) {
|
|
20
|
-
const err1 = { instancePath, schemaPath: "#/definitions/devicereadingmetadatav1JsonSchema/required", keyword: "required", params: { missingProperty: "us" }, message: "must have required property '" + "us" + "'" };
|
|
21
|
-
if (vErrors === null) {
|
|
22
|
-
vErrors = [err1];
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
vErrors.push(err1);
|
|
26
|
-
}
|
|
27
|
-
errors++;
|
|
28
|
-
}
|
|
29
|
-
for (const key0 in data) {
|
|
30
|
-
if (!((key0 === "s") || (key0 === "us"))) {
|
|
31
|
-
delete data[key0];
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (data.s !== undefined) {
|
|
35
|
-
let data0 = data.s;
|
|
36
|
-
if (!((typeof data0 == "number") && (isFinite(data0)))) {
|
|
37
|
-
const err2 = { instancePath: instancePath + "/s", schemaPath: "#/definitions/devicereadingmetadatav1JsonSchema/properties/s/type", keyword: "type", params: { type: "number" }, message: "must be number" };
|
|
38
|
-
if (vErrors === null) {
|
|
39
|
-
vErrors = [err2];
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
vErrors.push(err2);
|
|
43
|
-
}
|
|
44
|
-
errors++;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (data.us !== undefined) {
|
|
48
|
-
let data1 = data.us;
|
|
49
|
-
if (!((typeof data1 == "number") && (isFinite(data1)))) {
|
|
50
|
-
const err3 = { instancePath: instancePath + "/us", schemaPath: "#/definitions/devicereadingmetadatav1JsonSchema/properties/us/type", keyword: "type", params: { type: "number" }, message: "must be number" };
|
|
51
|
-
if (vErrors === null) {
|
|
52
|
-
vErrors = [err3];
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
vErrors.push(err3);
|
|
56
|
-
}
|
|
57
|
-
errors++;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
const err4 = { instancePath, schemaPath: "#/definitions/devicereadingmetadatav1JsonSchema/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
63
|
-
if (vErrors === null) {
|
|
64
|
-
vErrors = [err4];
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
vErrors.push(err4);
|
|
68
|
-
}
|
|
69
|
-
errors++;
|
|
70
|
-
} validate10.errors = vErrors; return errors === 0; }
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validate = void 0;
|
|
4
|
-
exports.validate = validate10;
|
|
5
|
-
exports.default = validate10;
|
|
6
|
-
const schema27 = { "$ref": "#/definitions/devicereadingv1JsonSchema", "definitions": { "devicereadingv1JsonSchema": { "type": "object", "properties": { "m": { "type": "object", "properties": { "s": { "type": "number" }, "us": { "type": "number" } }, "required": ["s", "us"], "additionalProperties": false }, "s": { "type": "number" } }, "required": ["m"], "additionalProperties": false } }, "$schema": "http://json-schema.org/draft-07/schema#" };
|
|
7
|
-
const schema28 = { "type": "object", "properties": { "m": { "type": "object", "properties": { "s": { "type": "number" }, "us": { "type": "number" } }, "required": ["s", "us"], "additionalProperties": false }, "s": { "type": "number" } }, "required": ["m"], "additionalProperties": false };
|
|
8
|
-
function validate10(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
9
|
-
if (data.m === undefined) {
|
|
10
|
-
const err0 = { instancePath, schemaPath: "#/definitions/devicereadingv1JsonSchema/required", keyword: "required", params: { missingProperty: "m" }, message: "must have required property '" + "m" + "'" };
|
|
11
|
-
if (vErrors === null) {
|
|
12
|
-
vErrors = [err0];
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
vErrors.push(err0);
|
|
16
|
-
}
|
|
17
|
-
errors++;
|
|
18
|
-
}
|
|
19
|
-
for (const key0 in data) {
|
|
20
|
-
if (!((key0 === "m") || (key0 === "s"))) {
|
|
21
|
-
delete data[key0];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
if (data.m !== undefined) {
|
|
25
|
-
let data0 = data.m;
|
|
26
|
-
if (data0 && typeof data0 == "object" && !Array.isArray(data0)) {
|
|
27
|
-
if (data0.s === undefined) {
|
|
28
|
-
const err1 = { instancePath: instancePath + "/m", schemaPath: "#/definitions/devicereadingv1JsonSchema/properties/m/required", keyword: "required", params: { missingProperty: "s" }, message: "must have required property '" + "s" + "'" };
|
|
29
|
-
if (vErrors === null) {
|
|
30
|
-
vErrors = [err1];
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
vErrors.push(err1);
|
|
34
|
-
}
|
|
35
|
-
errors++;
|
|
36
|
-
}
|
|
37
|
-
if (data0.us === undefined) {
|
|
38
|
-
const err2 = { instancePath: instancePath + "/m", schemaPath: "#/definitions/devicereadingv1JsonSchema/properties/m/required", keyword: "required", params: { missingProperty: "us" }, message: "must have required property '" + "us" + "'" };
|
|
39
|
-
if (vErrors === null) {
|
|
40
|
-
vErrors = [err2];
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
vErrors.push(err2);
|
|
44
|
-
}
|
|
45
|
-
errors++;
|
|
46
|
-
}
|
|
47
|
-
for (const key1 in data0) {
|
|
48
|
-
if (!((key1 === "s") || (key1 === "us"))) {
|
|
49
|
-
delete data0[key1];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (data0.s !== undefined) {
|
|
53
|
-
let data1 = data0.s;
|
|
54
|
-
if (!((typeof data1 == "number") && (isFinite(data1)))) {
|
|
55
|
-
const err3 = { instancePath: instancePath + "/m/s", schemaPath: "#/definitions/devicereadingv1JsonSchema/properties/m/properties/s/type", keyword: "type", params: { type: "number" }, message: "must be number" };
|
|
56
|
-
if (vErrors === null) {
|
|
57
|
-
vErrors = [err3];
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
vErrors.push(err3);
|
|
61
|
-
}
|
|
62
|
-
errors++;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
if (data0.us !== undefined) {
|
|
66
|
-
let data2 = data0.us;
|
|
67
|
-
if (!((typeof data2 == "number") && (isFinite(data2)))) {
|
|
68
|
-
const err4 = { instancePath: instancePath + "/m/us", schemaPath: "#/definitions/devicereadingv1JsonSchema/properties/m/properties/us/type", keyword: "type", params: { type: "number" }, message: "must be number" };
|
|
69
|
-
if (vErrors === null) {
|
|
70
|
-
vErrors = [err4];
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
vErrors.push(err4);
|
|
74
|
-
}
|
|
75
|
-
errors++;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
const err5 = { instancePath: instancePath + "/m", schemaPath: "#/definitions/devicereadingv1JsonSchema/properties/m/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
81
|
-
if (vErrors === null) {
|
|
82
|
-
vErrors = [err5];
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
vErrors.push(err5);
|
|
86
|
-
}
|
|
87
|
-
errors++;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (data.s !== undefined) {
|
|
91
|
-
let data3 = data.s;
|
|
92
|
-
if (!((typeof data3 == "number") && (isFinite(data3)))) {
|
|
93
|
-
const err6 = { instancePath: instancePath + "/s", schemaPath: "#/definitions/devicereadingv1JsonSchema/properties/s/type", keyword: "type", params: { type: "number" }, message: "must be number" };
|
|
94
|
-
if (vErrors === null) {
|
|
95
|
-
vErrors = [err6];
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
vErrors.push(err6);
|
|
99
|
-
}
|
|
100
|
-
errors++;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
const err7 = { instancePath, schemaPath: "#/definitions/devicereadingv1JsonSchema/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
106
|
-
if (vErrors === null) {
|
|
107
|
-
vErrors = [err7];
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
vErrors.push(err7);
|
|
111
|
-
}
|
|
112
|
-
errors++;
|
|
113
|
-
} validate10.errors = vErrors; return errors === 0; }
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validate = void 0;
|
|
4
|
-
exports.validate = validate10;
|
|
5
|
-
exports.default = validate10;
|
|
6
|
-
const schema27 = { "$ref": "#/definitions/readingmetadatav1JsonSchema", "definitions": { "readingmetadatav1JsonSchema": { "type": "object", "properties": { "s": { "type": "number" }, "us": { "type": "number" } }, "required": ["s", "us"], "additionalProperties": false } }, "$schema": "http://json-schema.org/draft-07/schema#" };
|
|
7
|
-
const schema28 = { "type": "object", "properties": { "s": { "type": "number" }, "us": { "type": "number" } }, "required": ["s", "us"], "additionalProperties": false };
|
|
8
|
-
function validate10(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
9
|
-
if (data.s === undefined) {
|
|
10
|
-
const err0 = { instancePath, schemaPath: "#/definitions/readingmetadatav1JsonSchema/required", keyword: "required", params: { missingProperty: "s" }, message: "must have required property '" + "s" + "'" };
|
|
11
|
-
if (vErrors === null) {
|
|
12
|
-
vErrors = [err0];
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
vErrors.push(err0);
|
|
16
|
-
}
|
|
17
|
-
errors++;
|
|
18
|
-
}
|
|
19
|
-
if (data.us === undefined) {
|
|
20
|
-
const err1 = { instancePath, schemaPath: "#/definitions/readingmetadatav1JsonSchema/required", keyword: "required", params: { missingProperty: "us" }, message: "must have required property '" + "us" + "'" };
|
|
21
|
-
if (vErrors === null) {
|
|
22
|
-
vErrors = [err1];
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
vErrors.push(err1);
|
|
26
|
-
}
|
|
27
|
-
errors++;
|
|
28
|
-
}
|
|
29
|
-
for (const key0 in data) {
|
|
30
|
-
if (!((key0 === "s") || (key0 === "us"))) {
|
|
31
|
-
delete data[key0];
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (data.s !== undefined) {
|
|
35
|
-
let data0 = data.s;
|
|
36
|
-
if (!((typeof data0 == "number") && (isFinite(data0)))) {
|
|
37
|
-
const err2 = { instancePath: instancePath + "/s", schemaPath: "#/definitions/readingmetadatav1JsonSchema/properties/s/type", keyword: "type", params: { type: "number" }, message: "must be number" };
|
|
38
|
-
if (vErrors === null) {
|
|
39
|
-
vErrors = [err2];
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
vErrors.push(err2);
|
|
43
|
-
}
|
|
44
|
-
errors++;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (data.us !== undefined) {
|
|
48
|
-
let data1 = data.us;
|
|
49
|
-
if (!((typeof data1 == "number") && (isFinite(data1)))) {
|
|
50
|
-
const err3 = { instancePath: instancePath + "/us", schemaPath: "#/definitions/readingmetadatav1JsonSchema/properties/us/type", keyword: "type", params: { type: "number" }, message: "must be number" };
|
|
51
|
-
if (vErrors === null) {
|
|
52
|
-
vErrors = [err3];
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
vErrors.push(err3);
|
|
56
|
-
}
|
|
57
|
-
errors++;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
const err4 = { instancePath, schemaPath: "#/definitions/readingmetadatav1JsonSchema/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
63
|
-
if (vErrors === null) {
|
|
64
|
-
vErrors = [err4];
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
vErrors.push(err4);
|
|
68
|
-
}
|
|
69
|
-
errors++;
|
|
70
|
-
} validate10.errors = vErrors; return errors === 0; }
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validate = void 0;
|
|
4
|
-
exports.validate = validate10;
|
|
5
|
-
exports.default = validate10;
|
|
6
|
-
const schema27 = { "$ref": "#/definitions/readingv1JsonSchema", "definitions": { "readingv1JsonSchema": { "type": "object", "properties": { "data": { "anyOf": [{ "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "object", "properties": {}, "additionalProperties": true }] }, "component": { "type": "string" }, "s": { "type": "number" }, "us": { "type": "number" }, "type": { "type": "string" }, "id": { "type": "string" } }, "required": ["data", "s", "type", "id"], "additionalProperties": true } }, "$schema": "http://json-schema.org/draft-07/schema#" };
|
|
7
|
-
const schema28 = { "type": "object", "properties": { "data": { "anyOf": [{ "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "object", "properties": {}, "additionalProperties": true }] }, "component": { "type": "string" }, "s": { "type": "number" }, "us": { "type": "number" }, "type": { "type": "string" }, "id": { "type": "string" } }, "required": ["data", "s", "type", "id"], "additionalProperties": true };
|
|
8
|
-
function validate10(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
9
|
-
if (data.data === undefined) {
|
|
10
|
-
const err0 = { instancePath, schemaPath: "#/definitions/readingv1JsonSchema/required", keyword: "required", params: { missingProperty: "data" }, message: "must have required property '" + "data" + "'" };
|
|
11
|
-
if (vErrors === null) {
|
|
12
|
-
vErrors = [err0];
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
vErrors.push(err0);
|
|
16
|
-
}
|
|
17
|
-
errors++;
|
|
18
|
-
}
|
|
19
|
-
if (data.s === undefined) {
|
|
20
|
-
const err1 = { instancePath, schemaPath: "#/definitions/readingv1JsonSchema/required", keyword: "required", params: { missingProperty: "s" }, message: "must have required property '" + "s" + "'" };
|
|
21
|
-
if (vErrors === null) {
|
|
22
|
-
vErrors = [err1];
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
vErrors.push(err1);
|
|
26
|
-
}
|
|
27
|
-
errors++;
|
|
28
|
-
}
|
|
29
|
-
if (data.type === undefined) {
|
|
30
|
-
const err2 = { instancePath, schemaPath: "#/definitions/readingv1JsonSchema/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property '" + "type" + "'" };
|
|
31
|
-
if (vErrors === null) {
|
|
32
|
-
vErrors = [err2];
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
vErrors.push(err2);
|
|
36
|
-
}
|
|
37
|
-
errors++;
|
|
38
|
-
}
|
|
39
|
-
if (data.id === undefined) {
|
|
40
|
-
const err3 = { instancePath, schemaPath: "#/definitions/readingv1JsonSchema/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property '" + "id" + "'" };
|
|
41
|
-
if (vErrors === null) {
|
|
42
|
-
vErrors = [err3];
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
vErrors.push(err3);
|
|
46
|
-
}
|
|
47
|
-
errors++;
|
|
48
|
-
}
|
|
49
|
-
for (const key0 in data) {
|
|
50
|
-
if (!((((((key0 === "data") || (key0 === "component")) || (key0 === "s")) || (key0 === "us")) || (key0 === "type")) || (key0 === "id"))) {
|
|
51
|
-
delete data[key0];
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (data.data !== undefined) {
|
|
55
|
-
let data0 = data.data;
|
|
56
|
-
const _errs4 = errors;
|
|
57
|
-
let valid2 = false;
|
|
58
|
-
const _errs5 = errors;
|
|
59
|
-
if (typeof data0 !== "string") {
|
|
60
|
-
const err4 = { instancePath: instancePath + "/data", schemaPath: "#/definitions/readingv1JsonSchema/properties/data/anyOf/0/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
61
|
-
if (vErrors === null) {
|
|
62
|
-
vErrors = [err4];
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
vErrors.push(err4);
|
|
66
|
-
}
|
|
67
|
-
errors++;
|
|
68
|
-
}
|
|
69
|
-
var _valid0 = _errs5 === errors;
|
|
70
|
-
valid2 = valid2 || _valid0;
|
|
71
|
-
if (!valid2) {
|
|
72
|
-
const _errs7 = errors;
|
|
73
|
-
if (!((typeof data0 == "number") && (isFinite(data0)))) {
|
|
74
|
-
const err5 = { instancePath: instancePath + "/data", schemaPath: "#/definitions/readingv1JsonSchema/properties/data/anyOf/1/type", keyword: "type", params: { type: "number" }, message: "must be number" };
|
|
75
|
-
if (vErrors === null) {
|
|
76
|
-
vErrors = [err5];
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
vErrors.push(err5);
|
|
80
|
-
}
|
|
81
|
-
errors++;
|
|
82
|
-
}
|
|
83
|
-
var _valid0 = _errs7 === errors;
|
|
84
|
-
valid2 = valid2 || _valid0;
|
|
85
|
-
if (!valid2) {
|
|
86
|
-
const _errs9 = errors;
|
|
87
|
-
if (typeof data0 !== "boolean") {
|
|
88
|
-
const err6 = { instancePath: instancePath + "/data", schemaPath: "#/definitions/readingv1JsonSchema/properties/data/anyOf/2/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" };
|
|
89
|
-
if (vErrors === null) {
|
|
90
|
-
vErrors = [err6];
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
vErrors.push(err6);
|
|
94
|
-
}
|
|
95
|
-
errors++;
|
|
96
|
-
}
|
|
97
|
-
var _valid0 = _errs9 === errors;
|
|
98
|
-
valid2 = valid2 || _valid0;
|
|
99
|
-
if (!valid2) {
|
|
100
|
-
const _errs11 = errors;
|
|
101
|
-
if (data0 && typeof data0 == "object" && !Array.isArray(data0)) {
|
|
102
|
-
for (const key1 in data0) {
|
|
103
|
-
delete data0[key1];
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
const err7 = { instancePath: instancePath + "/data", schemaPath: "#/definitions/readingv1JsonSchema/properties/data/anyOf/3/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
108
|
-
if (vErrors === null) {
|
|
109
|
-
vErrors = [err7];
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
vErrors.push(err7);
|
|
113
|
-
}
|
|
114
|
-
errors++;
|
|
115
|
-
}
|
|
116
|
-
var _valid0 = _errs11 === errors;
|
|
117
|
-
valid2 = valid2 || _valid0;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
if (!valid2) {
|
|
122
|
-
const err8 = { instancePath: instancePath + "/data", schemaPath: "#/definitions/readingv1JsonSchema/properties/data/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
|
|
123
|
-
if (vErrors === null) {
|
|
124
|
-
vErrors = [err8];
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
vErrors.push(err8);
|
|
128
|
-
}
|
|
129
|
-
errors++;
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
errors = _errs4;
|
|
133
|
-
if (vErrors !== null) {
|
|
134
|
-
if (_errs4) {
|
|
135
|
-
vErrors.length = _errs4;
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
vErrors = null;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
if (data.component !== undefined) {
|
|
144
|
-
if (typeof data.component !== "string") {
|
|
145
|
-
const err9 = { instancePath: instancePath + "/component", schemaPath: "#/definitions/readingv1JsonSchema/properties/component/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
146
|
-
if (vErrors === null) {
|
|
147
|
-
vErrors = [err9];
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
vErrors.push(err9);
|
|
151
|
-
}
|
|
152
|
-
errors++;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
if (data.s !== undefined) {
|
|
156
|
-
let data2 = data.s;
|
|
157
|
-
if (!((typeof data2 == "number") && (isFinite(data2)))) {
|
|
158
|
-
const err10 = { instancePath: instancePath + "/s", schemaPath: "#/definitions/readingv1JsonSchema/properties/s/type", keyword: "type", params: { type: "number" }, message: "must be number" };
|
|
159
|
-
if (vErrors === null) {
|
|
160
|
-
vErrors = [err10];
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
vErrors.push(err10);
|
|
164
|
-
}
|
|
165
|
-
errors++;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
if (data.us !== undefined) {
|
|
169
|
-
let data3 = data.us;
|
|
170
|
-
if (!((typeof data3 == "number") && (isFinite(data3)))) {
|
|
171
|
-
const err11 = { instancePath: instancePath + "/us", schemaPath: "#/definitions/readingv1JsonSchema/properties/us/type", keyword: "type", params: { type: "number" }, message: "must be number" };
|
|
172
|
-
if (vErrors === null) {
|
|
173
|
-
vErrors = [err11];
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
vErrors.push(err11);
|
|
177
|
-
}
|
|
178
|
-
errors++;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
if (data.type !== undefined) {
|
|
182
|
-
if (typeof data.type !== "string") {
|
|
183
|
-
const err12 = { instancePath: instancePath + "/type", schemaPath: "#/definitions/readingv1JsonSchema/properties/type/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
184
|
-
if (vErrors === null) {
|
|
185
|
-
vErrors = [err12];
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
vErrors.push(err12);
|
|
189
|
-
}
|
|
190
|
-
errors++;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
if (data.id !== undefined) {
|
|
194
|
-
if (typeof data.id !== "string") {
|
|
195
|
-
const err13 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/readingv1JsonSchema/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
196
|
-
if (vErrors === null) {
|
|
197
|
-
vErrors = [err13];
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
vErrors.push(err13);
|
|
201
|
-
}
|
|
202
|
-
errors++;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
const err14 = { instancePath, schemaPath: "#/definitions/readingv1JsonSchema/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
208
|
-
if (vErrors === null) {
|
|
209
|
-
vErrors = [err14];
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
vErrors.push(err14);
|
|
213
|
-
}
|
|
214
|
-
errors++;
|
|
215
|
-
} validate10.errors = vErrors; return errors === 0; }
|
package/dist/generator.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/generator.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const kit_generator_1 = require("@xube/kit-generator");
|
|
4
|
-
const aggregate_1 = require("./decode/aggregate");
|
|
5
|
-
const reading_1 = require("./decode/reading");
|
|
6
|
-
const message_1 = require("./message/message");
|
|
7
|
-
const generatedFilePaths = [
|
|
8
|
-
...(0, kit_generator_1.generateTypeSchemaFiles)("aggregateMetadata", aggregate_1.AggregateMetadataSchema, __dirname),
|
|
9
|
-
...(0, kit_generator_1.generateTypeSchemaFiles)("aggregateMetadataV1", aggregate_1.AggregateMetadataV1Schema, __dirname),
|
|
10
|
-
...(0, kit_generator_1.generateTypeSchemaFiles)("aggregateMetadataTypes", aggregate_1.AggregateMetadataSchemas, __dirname),
|
|
11
|
-
...(0, kit_generator_1.generateTypeSchemaFiles)("deviceReadingMetadataV1", reading_1.DeviceReadingMetadataV1Schema, __dirname),
|
|
12
|
-
...(0, kit_generator_1.generateTypeSchemaFiles)("deviceReadingV1", reading_1.DeviceReadingV1Schema, __dirname),
|
|
13
|
-
...(0, kit_generator_1.generateTypeSchemaFiles)("readingV1", reading_1.ReadingV1Schema, __dirname),
|
|
14
|
-
...(0, kit_generator_1.generateTypeSchemaFiles)("readingMetadataV1", reading_1.ReadingMetadataV1Schema, __dirname),
|
|
15
|
-
...(0, kit_generator_1.generateTypeSchemaFiles)("dataMessage", message_1.DataMessageSchema, __dirname)
|
|
16
|
-
];
|
|
17
|
-
(0, kit_generator_1.generateExportIndex)(generatedFilePaths, __dirname);
|
package/src/generated/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export {validate as validateAggregateMetadata} from './validators/aggregateMetadata'
|
|
2
|
-
export * from './types/aggregateMetadata'
|
|
3
|
-
export {validate as validateAggregateMetadataV1} from './validators/aggregateMetadataV1'
|
|
4
|
-
export * from './types/aggregateMetadataV1'
|
|
5
|
-
export {validate as validateAggregateMetadataTypes} from './validators/aggregateMetadataTypes'
|
|
6
|
-
export * from './types/aggregateMetadataTypes'
|
|
7
|
-
export {validate as validateDeviceReadingMetadataV1} from './validators/deviceReadingMetadataV1'
|
|
8
|
-
export * from './types/deviceReadingMetadataV1'
|
|
9
|
-
export {validate as validateDeviceReadingV1} from './validators/deviceReadingV1'
|
|
10
|
-
export * from './types/deviceReadingV1'
|
|
11
|
-
export {validate as validateReadingV1} from './validators/readingV1'
|
|
12
|
-
export * from './types/readingV1'
|
|
13
|
-
export {validate as validateReadingMetadataV1} from './validators/readingMetadataV1'
|
|
14
|
-
export * from './types/readingMetadataV1'
|
|
15
|
-
export {validate as validateDataMessage} from './validators/dataMessage'
|
|
16
|
-
export * from './types/dataMessage'
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* I am a generated file.
|
|
4
|
-
*
|
|
5
|
-
* If you change me, you and other developers will be sad.
|
|
6
|
-
*
|
|
7
|
-
* #StayGeneratedStayHappy
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export type AggregateMetadata = {
|
|
11
|
-
v: number;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import { XubeLog } from "@xube/kit-log";
|
|
17
|
-
import validate from "../validators/aggregateMetadata";
|
|
18
|
-
|
|
19
|
-
export const isAggregateMetadata = (item: unknown): item is AggregateMetadata => {
|
|
20
|
-
const isValid: boolean = validate(item);
|
|
21
|
-
if(!isValid){
|
|
22
|
-
XubeLog.getInstance().info(JSON.stringify((validate as typeof validate & {errors: object}).errors, null, 2));
|
|
23
|
-
}
|
|
24
|
-
return isValid;
|
|
25
|
-
}
|
|
26
|
-
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* I am a generated file.
|
|
4
|
-
*
|
|
5
|
-
* If you change me, you and other developers will be sad.
|
|
6
|
-
*
|
|
7
|
-
* #StayGeneratedStayHappy
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export type AggregateMetadataTypes = {
|
|
11
|
-
v: 1;
|
|
12
|
-
s: number;
|
|
13
|
-
m: {
|
|
14
|
-
m: {
|
|
15
|
-
s: number;
|
|
16
|
-
us: number;
|
|
17
|
-
};
|
|
18
|
-
s?: number | undefined;
|
|
19
|
-
}[];
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
import { XubeLog } from "@xube/kit-log";
|
|
25
|
-
import validate from "../validators/aggregateMetadataTypes";
|
|
26
|
-
|
|
27
|
-
export const isAggregateMetadataTypes = (item: unknown): item is AggregateMetadataTypes => {
|
|
28
|
-
const isValid: boolean = validate(item);
|
|
29
|
-
if(!isValid){
|
|
30
|
-
XubeLog.getInstance().info(JSON.stringify((validate as typeof validate & {errors: object}).errors, null, 2));
|
|
31
|
-
}
|
|
32
|
-
return isValid;
|
|
33
|
-
}
|
|
34
|
-
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* I am a generated file.
|
|
4
|
-
*
|
|
5
|
-
* If you change me, you and other developers will be sad.
|
|
6
|
-
*
|
|
7
|
-
* #StayGeneratedStayHappy
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export type AggregateMetadataV1 = {
|
|
11
|
-
v: 1;
|
|
12
|
-
s: number;
|
|
13
|
-
m: {
|
|
14
|
-
m: {
|
|
15
|
-
s: number;
|
|
16
|
-
us: number;
|
|
17
|
-
};
|
|
18
|
-
s?: number | undefined;
|
|
19
|
-
}[];
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
import { XubeLog } from "@xube/kit-log";
|
|
25
|
-
import validate from "../validators/aggregateMetadataV1";
|
|
26
|
-
|
|
27
|
-
export const isAggregateMetadataV1 = (item: unknown): item is AggregateMetadataV1 => {
|
|
28
|
-
const isValid: boolean = validate(item);
|
|
29
|
-
if(!isValid){
|
|
30
|
-
XubeLog.getInstance().info(JSON.stringify((validate as typeof validate & {errors: object}).errors, null, 2));
|
|
31
|
-
}
|
|
32
|
-
return isValid;
|
|
33
|
-
}
|
|
34
|
-
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* I am a generated file.
|
|
4
|
-
*
|
|
5
|
-
* If you change me, you and other developers will be sad.
|
|
6
|
-
*
|
|
7
|
-
* #StayGeneratedStayHappy
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export type DataMessage = {
|
|
11
|
-
payload: string;
|
|
12
|
-
account: string;
|
|
13
|
-
device: string;
|
|
14
|
-
component: string;
|
|
15
|
-
timestamp: number;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import { XubeLog } from "@xube/kit-log";
|
|
21
|
-
import validate from "../validators/dataMessage";
|
|
22
|
-
|
|
23
|
-
export const isDataMessage = (item: unknown): item is DataMessage => {
|
|
24
|
-
const isValid: boolean = validate(item);
|
|
25
|
-
if(!isValid){
|
|
26
|
-
XubeLog.getInstance().info(JSON.stringify((validate as typeof validate & {errors: object}).errors, null, 2));
|
|
27
|
-
}
|
|
28
|
-
return isValid;
|
|
29
|
-
}
|
|
30
|
-
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* I am a generated file.
|
|
4
|
-
*
|
|
5
|
-
* If you change me, you and other developers will be sad.
|
|
6
|
-
*
|
|
7
|
-
* #StayGeneratedStayHappy
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export type DeviceReadingMetadataV1 = {
|
|
11
|
-
s: number;
|
|
12
|
-
us: number;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import { XubeLog } from "@xube/kit-log";
|
|
18
|
-
import validate from "../validators/deviceReadingMetadataV1";
|
|
19
|
-
|
|
20
|
-
export const isDeviceReadingMetadataV1 = (item: unknown): item is DeviceReadingMetadataV1 => {
|
|
21
|
-
const isValid: boolean = validate(item);
|
|
22
|
-
if(!isValid){
|
|
23
|
-
XubeLog.getInstance().info(JSON.stringify((validate as typeof validate & {errors: object}).errors, null, 2));
|
|
24
|
-
}
|
|
25
|
-
return isValid;
|
|
26
|
-
}
|
|
27
|
-
|