@xube/kit-aws-data-schema 0.0.81 → 0.0.83

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.
@@ -72,21 +72,21 @@ export declare const ReadingMetadataV1Schema: z.ZodObject<{
72
72
  }>;
73
73
  export declare const ReadingV1Schema: z.ZodObject<{
74
74
  data: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>]>;
75
- component: z.ZodString;
75
+ component: z.ZodOptional<z.ZodString>;
76
76
  s: z.ZodNumber;
77
77
  us: z.ZodOptional<z.ZodNumber>;
78
78
  type: z.ZodString;
79
79
  id: z.ZodString;
80
80
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
81
81
  data: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>]>;
82
- component: z.ZodString;
82
+ component: z.ZodOptional<z.ZodString>;
83
83
  s: z.ZodNumber;
84
84
  us: z.ZodOptional<z.ZodNumber>;
85
85
  type: z.ZodString;
86
86
  id: z.ZodString;
87
87
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
88
88
  data: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>]>;
89
- component: z.ZodString;
89
+ component: z.ZodOptional<z.ZodString>;
90
90
  s: z.ZodNumber;
91
91
  us: z.ZodOptional<z.ZodNumber>;
92
92
  type: z.ZodString;
@@ -17,7 +17,7 @@ exports.ReadingMetadataV1Schema = exports.DeviceReadingMetadataV1Schema;
17
17
  exports.ReadingV1Schema = zod_1.z
18
18
  .object({
19
19
  data: exports.ReadingDataTypesSchema,
20
- component: zod_1.z.string(),
20
+ component: zod_1.z.string().optional(),
21
21
  })
22
22
  .merge(kit_schema_1.BaseDataSchema)
23
23
  .passthrough();
@@ -7,7 +7,7 @@
7
7
  */
8
8
  export type ReadingV1 = {
9
9
  data: string | number | boolean | {};
10
- component: string;
10
+ component?: string | undefined;
11
11
  s: number;
12
12
  us?: number | undefined;
13
13
  type: string;
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validate = void 0;
4
4
  exports.validate = validate10;
5
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", "component", "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", "component", "s", "type", "id"], "additionalProperties": true };
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
8
  function validate10(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) {
9
9
  if (data.data === undefined) {
10
10
  const err0 = { instancePath, schemaPath: "#/definitions/readingv1JsonSchema/required", keyword: "required", params: { missingProperty: "data" }, message: "must have required property '" + "data" + "'" };
@@ -16,8 +16,8 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
16
16
  }
17
17
  errors++;
18
18
  }
19
- if (data.component === undefined) {
20
- const err1 = { instancePath, schemaPath: "#/definitions/readingv1JsonSchema/required", keyword: "required", params: { missingProperty: "component" }, message: "must have required property '" + "component" + "'" };
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
21
  if (vErrors === null) {
22
22
  vErrors = [err1];
23
23
  }
@@ -26,8 +26,8 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
26
26
  }
27
27
  errors++;
28
28
  }
29
- if (data.s === undefined) {
30
- const err2 = { instancePath, schemaPath: "#/definitions/readingv1JsonSchema/required", keyword: "required", params: { missingProperty: "s" }, message: "must have required property '" + "s" + "'" };
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
31
  if (vErrors === null) {
32
32
  vErrors = [err2];
33
33
  }
@@ -36,8 +36,8 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
36
36
  }
37
37
  errors++;
38
38
  }
39
- if (data.type === undefined) {
40
- const err3 = { instancePath, schemaPath: "#/definitions/readingv1JsonSchema/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property '" + "type" + "'" };
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
41
  if (vErrors === null) {
42
42
  vErrors = [err3];
43
43
  }
@@ -46,28 +46,18 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
46
46
  }
47
47
  errors++;
48
48
  }
49
- if (data.id === undefined) {
50
- const err4 = { instancePath, schemaPath: "#/definitions/readingv1JsonSchema/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property '" + "id" + "'" };
51
- if (vErrors === null) {
52
- vErrors = [err4];
53
- }
54
- else {
55
- vErrors.push(err4);
56
- }
57
- errors++;
58
- }
59
49
  if (data.data !== undefined) {
60
50
  let data0 = data.data;
61
51
  const _errs4 = errors;
62
52
  let valid2 = false;
63
53
  const _errs5 = errors;
64
54
  if (typeof data0 !== "string") {
65
- const err5 = { instancePath: instancePath + "/data", schemaPath: "#/definitions/readingv1JsonSchema/properties/data/anyOf/0/type", keyword: "type", params: { type: "string" }, message: "must be string" };
55
+ const err4 = { instancePath: instancePath + "/data", schemaPath: "#/definitions/readingv1JsonSchema/properties/data/anyOf/0/type", keyword: "type", params: { type: "string" }, message: "must be string" };
66
56
  if (vErrors === null) {
67
- vErrors = [err5];
57
+ vErrors = [err4];
68
58
  }
69
59
  else {
70
- vErrors.push(err5);
60
+ vErrors.push(err4);
71
61
  }
72
62
  errors++;
73
63
  }
@@ -76,12 +66,12 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
76
66
  if (!valid2) {
77
67
  const _errs7 = errors;
78
68
  if (!((typeof data0 == "number") && (isFinite(data0)))) {
79
- const err6 = { instancePath: instancePath + "/data", schemaPath: "#/definitions/readingv1JsonSchema/properties/data/anyOf/1/type", keyword: "type", params: { type: "number" }, message: "must be number" };
69
+ const err5 = { instancePath: instancePath + "/data", schemaPath: "#/definitions/readingv1JsonSchema/properties/data/anyOf/1/type", keyword: "type", params: { type: "number" }, message: "must be number" };
80
70
  if (vErrors === null) {
81
- vErrors = [err6];
71
+ vErrors = [err5];
82
72
  }
83
73
  else {
84
- vErrors.push(err6);
74
+ vErrors.push(err5);
85
75
  }
86
76
  errors++;
87
77
  }
@@ -90,12 +80,12 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
90
80
  if (!valid2) {
91
81
  const _errs9 = errors;
92
82
  if (typeof data0 !== "boolean") {
93
- const err7 = { instancePath: instancePath + "/data", schemaPath: "#/definitions/readingv1JsonSchema/properties/data/anyOf/2/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" };
83
+ const err6 = { instancePath: instancePath + "/data", schemaPath: "#/definitions/readingv1JsonSchema/properties/data/anyOf/2/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" };
94
84
  if (vErrors === null) {
95
- vErrors = [err7];
85
+ vErrors = [err6];
96
86
  }
97
87
  else {
98
- vErrors.push(err7);
88
+ vErrors.push(err6);
99
89
  }
100
90
  errors++;
101
91
  }
@@ -105,12 +95,12 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
105
95
  const _errs11 = errors;
106
96
  if (data0 && typeof data0 == "object" && !Array.isArray(data0)) { }
107
97
  else {
108
- const err8 = { instancePath: instancePath + "/data", schemaPath: "#/definitions/readingv1JsonSchema/properties/data/anyOf/3/type", keyword: "type", params: { type: "object" }, message: "must be object" };
98
+ const err7 = { instancePath: instancePath + "/data", schemaPath: "#/definitions/readingv1JsonSchema/properties/data/anyOf/3/type", keyword: "type", params: { type: "object" }, message: "must be object" };
109
99
  if (vErrors === null) {
110
- vErrors = [err8];
100
+ vErrors = [err7];
111
101
  }
112
102
  else {
113
- vErrors.push(err8);
103
+ vErrors.push(err7);
114
104
  }
115
105
  errors++;
116
106
  }
@@ -120,12 +110,12 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
120
110
  }
121
111
  }
122
112
  if (!valid2) {
123
- const err9 = { instancePath: instancePath + "/data", schemaPath: "#/definitions/readingv1JsonSchema/properties/data/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
113
+ const err8 = { instancePath: instancePath + "/data", schemaPath: "#/definitions/readingv1JsonSchema/properties/data/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
124
114
  if (vErrors === null) {
125
- vErrors = [err9];
115
+ vErrors = [err8];
126
116
  }
127
117
  else {
128
- vErrors.push(err9);
118
+ vErrors.push(err8);
129
119
  }
130
120
  errors++;
131
121
  }
@@ -143,12 +133,12 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
143
133
  }
144
134
  if (data.component !== undefined) {
145
135
  if (typeof data.component !== "string") {
146
- const err10 = { instancePath: instancePath + "/component", schemaPath: "#/definitions/readingv1JsonSchema/properties/component/type", keyword: "type", params: { type: "string" }, message: "must be string" };
136
+ const err9 = { instancePath: instancePath + "/component", schemaPath: "#/definitions/readingv1JsonSchema/properties/component/type", keyword: "type", params: { type: "string" }, message: "must be string" };
147
137
  if (vErrors === null) {
148
- vErrors = [err10];
138
+ vErrors = [err9];
149
139
  }
150
140
  else {
151
- vErrors.push(err10);
141
+ vErrors.push(err9);
152
142
  }
153
143
  errors++;
154
144
  }
@@ -156,12 +146,12 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
156
146
  if (data.s !== undefined) {
157
147
  let data2 = data.s;
158
148
  if (!((typeof data2 == "number") && (isFinite(data2)))) {
159
- const err11 = { instancePath: instancePath + "/s", schemaPath: "#/definitions/readingv1JsonSchema/properties/s/type", keyword: "type", params: { type: "number" }, message: "must be number" };
149
+ const err10 = { instancePath: instancePath + "/s", schemaPath: "#/definitions/readingv1JsonSchema/properties/s/type", keyword: "type", params: { type: "number" }, message: "must be number" };
160
150
  if (vErrors === null) {
161
- vErrors = [err11];
151
+ vErrors = [err10];
162
152
  }
163
153
  else {
164
- vErrors.push(err11);
154
+ vErrors.push(err10);
165
155
  }
166
156
  errors++;
167
157
  }
@@ -169,48 +159,48 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
169
159
  if (data.us !== undefined) {
170
160
  let data3 = data.us;
171
161
  if (!((typeof data3 == "number") && (isFinite(data3)))) {
172
- const err12 = { instancePath: instancePath + "/us", schemaPath: "#/definitions/readingv1JsonSchema/properties/us/type", keyword: "type", params: { type: "number" }, message: "must be number" };
162
+ const err11 = { instancePath: instancePath + "/us", schemaPath: "#/definitions/readingv1JsonSchema/properties/us/type", keyword: "type", params: { type: "number" }, message: "must be number" };
173
163
  if (vErrors === null) {
174
- vErrors = [err12];
164
+ vErrors = [err11];
175
165
  }
176
166
  else {
177
- vErrors.push(err12);
167
+ vErrors.push(err11);
178
168
  }
179
169
  errors++;
180
170
  }
181
171
  }
182
172
  if (data.type !== undefined) {
183
173
  if (typeof data.type !== "string") {
184
- const err13 = { instancePath: instancePath + "/type", schemaPath: "#/definitions/readingv1JsonSchema/properties/type/type", keyword: "type", params: { type: "string" }, message: "must be string" };
174
+ const err12 = { instancePath: instancePath + "/type", schemaPath: "#/definitions/readingv1JsonSchema/properties/type/type", keyword: "type", params: { type: "string" }, message: "must be string" };
185
175
  if (vErrors === null) {
186
- vErrors = [err13];
176
+ vErrors = [err12];
187
177
  }
188
178
  else {
189
- vErrors.push(err13);
179
+ vErrors.push(err12);
190
180
  }
191
181
  errors++;
192
182
  }
193
183
  }
194
184
  if (data.id !== undefined) {
195
185
  if (typeof data.id !== "string") {
196
- const err14 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/readingv1JsonSchema/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
186
+ const err13 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/readingv1JsonSchema/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
197
187
  if (vErrors === null) {
198
- vErrors = [err14];
188
+ vErrors = [err13];
199
189
  }
200
190
  else {
201
- vErrors.push(err14);
191
+ vErrors.push(err13);
202
192
  }
203
193
  errors++;
204
194
  }
205
195
  }
206
196
  }
207
197
  else {
208
- const err15 = { instancePath, schemaPath: "#/definitions/readingv1JsonSchema/type", keyword: "type", params: { type: "object" }, message: "must be object" };
198
+ const err14 = { instancePath, schemaPath: "#/definitions/readingv1JsonSchema/type", keyword: "type", params: { type: "object" }, message: "must be object" };
209
199
  if (vErrors === null) {
210
- vErrors = [err15];
200
+ vErrors = [err14];
211
201
  }
212
202
  else {
213
- vErrors.push(err15);
203
+ vErrors.push(err14);
214
204
  }
215
205
  errors++;
216
206
  } validate10.errors = vErrors; return errors === 0; }
package/dist/key/get.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export declare const getDataPartitionKey: (id: string) => string;
2
2
  export declare const getDataSortKey: (componentId: string, seconds: number | string, microseconds?: number | string) => string;
3
+ export declare const getComponentIdFromSortKey: (sortKey: string) => string;
package/dist/key/get.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDataSortKey = exports.getDataPartitionKey = void 0;
3
+ exports.getComponentIdFromSortKey = exports.getDataSortKey = exports.getDataPartitionKey = void 0;
4
4
  const getDataPartitionKey = (id) => {
5
5
  return `DEVICE#${id}`;
6
6
  };
@@ -9,3 +9,7 @@ const getDataSortKey = (componentId, seconds, microseconds) => {
9
9
  return `${componentId}#${seconds}.${microseconds ?? 0}`;
10
10
  };
11
11
  exports.getDataSortKey = getDataSortKey;
12
+ const getComponentIdFromSortKey = (sortKey) => {
13
+ return sortKey.split("#")[0];
14
+ };
15
+ exports.getComponentIdFromSortKey = getComponentIdFromSortKey;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xube/kit-aws-data-schema",
3
- "version": "0.0.81",
3
+ "version": "0.0.83",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -19,16 +19,16 @@
19
19
  "homepage": "https://github.com/XubeLtd/dev-kit#readme",
20
20
  "devDependencies": {
21
21
  "@types/node": "^20.4.7",
22
- "@xube/kit-build": "^0.0.81",
22
+ "@xube/kit-build": "^0.0.83",
23
23
  "ts-node": "^10.9.1",
24
24
  "typescript": "^5.1.6"
25
25
  },
26
26
  "dependencies": {
27
- "@xube/kit-aws-schema": "^0.0.81",
28
- "@xube/kit-constants": "^0.0.81",
29
- "@xube/kit-generator": "^0.0.81",
30
- "@xube/kit-log": "^0.0.81",
31
- "@xube/kit-schema": "^0.0.81",
27
+ "@xube/kit-aws-schema": "^0.0.83",
28
+ "@xube/kit-constants": "^0.0.83",
29
+ "@xube/kit-generator": "^0.0.83",
30
+ "@xube/kit-log": "^0.0.83",
31
+ "@xube/kit-schema": "^0.0.83",
32
32
  "zod": "^3.22.4",
33
33
  "zod-validation-error": "^2.0.0"
34
34
  }
@@ -17,7 +17,7 @@ export const ReadingMetadataV1Schema = DeviceReadingMetadataV1Schema;
17
17
  export const ReadingV1Schema = z
18
18
  .object({
19
19
  data: ReadingDataTypesSchema,
20
- component: z.string(),
20
+ component: z.string().optional(),
21
21
  })
22
22
  .merge(BaseDataSchema)
23
23
  .passthrough();
@@ -9,7 +9,7 @@
9
9
 
10
10
  export type ReadingV1 = {
11
11
  data: string | number | boolean | {};
12
- component: string;
12
+ component?: string | undefined;
13
13
  s: number;
14
14
  us?: number | undefined;
15
15
  type: string;
@@ -1 +1 @@
1
- "use strict";export const validate = validate10;export default validate10;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","component","s","type","id"],"additionalProperties":true}},"$schema":"http://json-schema.org/draft-07/schema#"};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","component","s","type","id"],"additionalProperties":true};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(data && typeof data == "object" && !Array.isArray(data)){if(data.data === undefined){const err0 = {instancePath,schemaPath:"#/definitions/readingv1JsonSchema/required",keyword:"required",params:{missingProperty: "data"},message:"must have required property '"+"data"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.component === undefined){const err1 = {instancePath,schemaPath:"#/definitions/readingv1JsonSchema/required",keyword:"required",params:{missingProperty: "component"},message:"must have required property '"+"component"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.s === undefined){const err2 = {instancePath,schemaPath:"#/definitions/readingv1JsonSchema/required",keyword:"required",params:{missingProperty: "s"},message:"must have required property '"+"s"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.type === undefined){const err3 = {instancePath,schemaPath:"#/definitions/readingv1JsonSchema/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.id === undefined){const err4 = {instancePath,schemaPath:"#/definitions/readingv1JsonSchema/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.data !== undefined){let data0 = data.data;const _errs4 = errors;let valid2 = false;const _errs5 = errors;if(typeof data0 !== "string"){const err5 = {instancePath:instancePath+"/data",schemaPath:"#/definitions/readingv1JsonSchema/properties/data/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}var _valid0 = _errs5 === errors;valid2 = valid2 || _valid0;if(!valid2){const _errs7 = errors;if(!((typeof data0 == "number") && (isFinite(data0)))){const err6 = {instancePath:instancePath+"/data",schemaPath:"#/definitions/readingv1JsonSchema/properties/data/anyOf/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}var _valid0 = _errs7 === errors;valid2 = valid2 || _valid0;if(!valid2){const _errs9 = errors;if(typeof data0 !== "boolean"){const err7 = {instancePath:instancePath+"/data",schemaPath:"#/definitions/readingv1JsonSchema/properties/data/anyOf/2/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}var _valid0 = _errs9 === errors;valid2 = valid2 || _valid0;if(!valid2){const _errs11 = errors;if(data0 && typeof data0 == "object" && !Array.isArray(data0)){}else {const err8 = {instancePath:instancePath+"/data",schemaPath:"#/definitions/readingv1JsonSchema/properties/data/anyOf/3/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}var _valid0 = _errs11 === errors;valid2 = valid2 || _valid0;}}}if(!valid2){const err9 = {instancePath:instancePath+"/data",schemaPath:"#/definitions/readingv1JsonSchema/properties/data/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}else {errors = _errs4;if(vErrors !== null){if(_errs4){vErrors.length = _errs4;}else {vErrors = null;}}}}if(data.component !== undefined){if(typeof data.component !== "string"){const err10 = {instancePath:instancePath+"/component",schemaPath:"#/definitions/readingv1JsonSchema/properties/component/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.s !== undefined){let data2 = data.s;if(!((typeof data2 == "number") && (isFinite(data2)))){const err11 = {instancePath:instancePath+"/s",schemaPath:"#/definitions/readingv1JsonSchema/properties/s/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.us !== undefined){let data3 = data.us;if(!((typeof data3 == "number") && (isFinite(data3)))){const err12 = {instancePath:instancePath+"/us",schemaPath:"#/definitions/readingv1JsonSchema/properties/us/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.type !== undefined){if(typeof data.type !== "string"){const err13 = {instancePath:instancePath+"/type",schemaPath:"#/definitions/readingv1JsonSchema/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data.id !== undefined){if(typeof data.id !== "string"){const err14 = {instancePath:instancePath+"/id",schemaPath:"#/definitions/readingv1JsonSchema/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}}else {const err15 = {instancePath,schemaPath:"#/definitions/readingv1JsonSchema/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}validate10.errors = vErrors;return errors === 0;}
1
+ "use strict";export const validate = validate10;export default validate10;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#"};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};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(data && typeof data == "object" && !Array.isArray(data)){if(data.data === undefined){const err0 = {instancePath,schemaPath:"#/definitions/readingv1JsonSchema/required",keyword:"required",params:{missingProperty: "data"},message:"must have required property '"+"data"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.s === undefined){const err1 = {instancePath,schemaPath:"#/definitions/readingv1JsonSchema/required",keyword:"required",params:{missingProperty: "s"},message:"must have required property '"+"s"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.type === undefined){const err2 = {instancePath,schemaPath:"#/definitions/readingv1JsonSchema/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.id === undefined){const err3 = {instancePath,schemaPath:"#/definitions/readingv1JsonSchema/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.data !== undefined){let data0 = data.data;const _errs4 = errors;let valid2 = false;const _errs5 = errors;if(typeof data0 !== "string"){const err4 = {instancePath:instancePath+"/data",schemaPath:"#/definitions/readingv1JsonSchema/properties/data/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}var _valid0 = _errs5 === errors;valid2 = valid2 || _valid0;if(!valid2){const _errs7 = errors;if(!((typeof data0 == "number") && (isFinite(data0)))){const err5 = {instancePath:instancePath+"/data",schemaPath:"#/definitions/readingv1JsonSchema/properties/data/anyOf/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}var _valid0 = _errs7 === errors;valid2 = valid2 || _valid0;if(!valid2){const _errs9 = errors;if(typeof data0 !== "boolean"){const err6 = {instancePath:instancePath+"/data",schemaPath:"#/definitions/readingv1JsonSchema/properties/data/anyOf/2/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}var _valid0 = _errs9 === errors;valid2 = valid2 || _valid0;if(!valid2){const _errs11 = errors;if(data0 && typeof data0 == "object" && !Array.isArray(data0)){}else {const err7 = {instancePath:instancePath+"/data",schemaPath:"#/definitions/readingv1JsonSchema/properties/data/anyOf/3/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}var _valid0 = _errs11 === errors;valid2 = valid2 || _valid0;}}}if(!valid2){const err8 = {instancePath:instancePath+"/data",schemaPath:"#/definitions/readingv1JsonSchema/properties/data/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}else {errors = _errs4;if(vErrors !== null){if(_errs4){vErrors.length = _errs4;}else {vErrors = null;}}}}if(data.component !== undefined){if(typeof data.component !== "string"){const err9 = {instancePath:instancePath+"/component",schemaPath:"#/definitions/readingv1JsonSchema/properties/component/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.s !== undefined){let data2 = data.s;if(!((typeof data2 == "number") && (isFinite(data2)))){const err10 = {instancePath:instancePath+"/s",schemaPath:"#/definitions/readingv1JsonSchema/properties/s/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.us !== undefined){let data3 = data.us;if(!((typeof data3 == "number") && (isFinite(data3)))){const err11 = {instancePath:instancePath+"/us",schemaPath:"#/definitions/readingv1JsonSchema/properties/us/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.type !== undefined){if(typeof data.type !== "string"){const err12 = {instancePath:instancePath+"/type",schemaPath:"#/definitions/readingv1JsonSchema/properties/type/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.id !== undefined){if(typeof data.id !== "string"){const err13 = {instancePath:instancePath+"/id",schemaPath:"#/definitions/readingv1JsonSchema/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}}else {const err14 = {instancePath,schemaPath:"#/definitions/readingv1JsonSchema/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}validate10.errors = vErrors;return errors === 0;}
package/src/key/get.ts CHANGED
@@ -9,3 +9,7 @@ export const getDataSortKey = (
9
9
  ): string => {
10
10
  return `${componentId}#${seconds}.${microseconds ?? 0}`;
11
11
  };
12
+
13
+ export const getComponentIdFromSortKey = (sortKey: string): string => {
14
+ return sortKey.split("#")[0];
15
+ };