@alteriom/mqtt-schema 0.2.0
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 +174 -0
- package/dist/cjs/generated/types.d.ts +101 -0
- package/dist/cjs/generated/types.js +104 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +23 -0
- package/dist/cjs/schema_data.d.ts +319 -0
- package/dist/cjs/schema_data.js +402 -0
- package/dist/cjs/schemas/control_response.schema.json +15 -0
- package/dist/cjs/schemas/envelope.schema.json +16 -0
- package/dist/cjs/schemas/firmware_status.schema.json +17 -0
- package/dist/cjs/schemas/gateway_info.schema.json +21 -0
- package/dist/cjs/schemas/gateway_metrics.schema.json +26 -0
- package/dist/cjs/schemas/mqtt_v1_bundle.json +14 -0
- package/dist/cjs/schemas/sensor_data.schema.json +33 -0
- package/dist/cjs/schemas/sensor_heartbeat.schema.json +14 -0
- package/dist/cjs/schemas/sensor_status.schema.json +14 -0
- package/dist/cjs/schemas/validation_rules.md +44 -0
- package/dist/cjs/types.d.ts +1 -0
- package/dist/cjs/types.js +23 -0
- package/dist/cjs/validators.d.ts +23 -0
- package/dist/cjs/validators.js +84 -0
- package/dist/esm/generated/types.js +92 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/schema_data.js +399 -0
- package/dist/esm/schemas/control_response.schema.json +15 -0
- package/dist/esm/schemas/envelope.schema.json +16 -0
- package/dist/esm/schemas/firmware_status.schema.json +17 -0
- package/dist/esm/schemas/gateway_info.schema.json +21 -0
- package/dist/esm/schemas/gateway_metrics.schema.json +26 -0
- package/dist/esm/schemas/mqtt_v1_bundle.json +14 -0
- package/dist/esm/schemas/sensor_data.schema.json +33 -0
- package/dist/esm/schemas/sensor_heartbeat.schema.json +14 -0
- package/dist/esm/schemas/sensor_status.schema.json +14 -0
- package/dist/esm/schemas/validation_rules.md +44 -0
- package/dist/esm/types.js +7 -0
- package/dist/esm/validators.js +76 -0
- package/package.json +91 -0
@@ -0,0 +1,319 @@
|
|
1
|
+
export declare const envelope_schema: {
|
2
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
3
|
+
readonly $id: "https://schemas.alteriom.io/mqtt/v1/envelope.schema.json";
|
4
|
+
readonly title: "Alteriom MQTT Base Envelope v1";
|
5
|
+
readonly type: "object";
|
6
|
+
readonly required: readonly ["schema_version", "device_id", "device_type", "timestamp", "firmware_version"];
|
7
|
+
readonly properties: {
|
8
|
+
readonly schema_version: {
|
9
|
+
readonly type: "integer";
|
10
|
+
readonly const: 1;
|
11
|
+
};
|
12
|
+
readonly device_id: {
|
13
|
+
readonly type: "string";
|
14
|
+
readonly minLength: 1;
|
15
|
+
readonly maxLength: 64;
|
16
|
+
readonly pattern: "^[A-Za-z0-9_-]+$";
|
17
|
+
};
|
18
|
+
readonly device_type: {
|
19
|
+
readonly type: "string";
|
20
|
+
readonly enum: readonly ["sensor", "gateway"];
|
21
|
+
};
|
22
|
+
readonly timestamp: {
|
23
|
+
readonly type: "string";
|
24
|
+
readonly format: "date-time";
|
25
|
+
};
|
26
|
+
readonly firmware_version: {
|
27
|
+
readonly type: "string";
|
28
|
+
readonly minLength: 1;
|
29
|
+
readonly maxLength: 40;
|
30
|
+
};
|
31
|
+
readonly hardware_version: {
|
32
|
+
readonly type: "string";
|
33
|
+
readonly maxLength: 80;
|
34
|
+
};
|
35
|
+
};
|
36
|
+
readonly additionalProperties: true;
|
37
|
+
};
|
38
|
+
export declare const sensor_data_schema: {
|
39
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
40
|
+
readonly $id: "https://schemas.alteriom.io/mqtt/v1/sensor_data.schema.json";
|
41
|
+
readonly title: "Sensor Data Message v1";
|
42
|
+
readonly allOf: readonly [{
|
43
|
+
readonly $ref: "envelope.schema.json";
|
44
|
+
}];
|
45
|
+
readonly type: "object";
|
46
|
+
readonly required: readonly ["sensors"];
|
47
|
+
readonly properties: {
|
48
|
+
readonly sensors: {
|
49
|
+
readonly type: "object";
|
50
|
+
readonly minProperties: 1;
|
51
|
+
readonly additionalProperties: {
|
52
|
+
readonly type: "object";
|
53
|
+
readonly required: readonly ["value"];
|
54
|
+
readonly properties: {
|
55
|
+
readonly value: {
|
56
|
+
readonly type: readonly ["number", "integer"];
|
57
|
+
};
|
58
|
+
readonly unit: {
|
59
|
+
readonly type: "string";
|
60
|
+
};
|
61
|
+
readonly raw_value: {
|
62
|
+
readonly type: readonly ["number", "integer"];
|
63
|
+
};
|
64
|
+
readonly calibrated_value: {
|
65
|
+
readonly type: readonly ["number", "integer"];
|
66
|
+
};
|
67
|
+
readonly quality_score: {
|
68
|
+
readonly type: "number";
|
69
|
+
readonly minimum: 0;
|
70
|
+
readonly maximum: 1;
|
71
|
+
};
|
72
|
+
readonly name: {
|
73
|
+
readonly type: "string";
|
74
|
+
};
|
75
|
+
readonly location: {
|
76
|
+
readonly type: "string";
|
77
|
+
};
|
78
|
+
readonly additional_data: {
|
79
|
+
readonly type: "object";
|
80
|
+
};
|
81
|
+
};
|
82
|
+
readonly additionalProperties: false;
|
83
|
+
};
|
84
|
+
};
|
85
|
+
readonly battery_level: {
|
86
|
+
readonly type: "integer";
|
87
|
+
readonly minimum: 0;
|
88
|
+
readonly maximum: 100;
|
89
|
+
};
|
90
|
+
readonly signal_strength: {
|
91
|
+
readonly type: "integer";
|
92
|
+
readonly minimum: -200;
|
93
|
+
readonly maximum: 0;
|
94
|
+
};
|
95
|
+
readonly additional: {
|
96
|
+
readonly type: "object";
|
97
|
+
};
|
98
|
+
};
|
99
|
+
readonly additionalProperties: true;
|
100
|
+
};
|
101
|
+
export declare const sensor_heartbeat_schema: {
|
102
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
103
|
+
readonly $id: "https://schemas.alteriom.io/mqtt/v1/sensor_heartbeat.schema.json";
|
104
|
+
readonly title: "Sensor Heartbeat v1";
|
105
|
+
readonly type: "object";
|
106
|
+
readonly required: readonly ["schema_version", "device_id", "device_type", "timestamp"];
|
107
|
+
readonly properties: {
|
108
|
+
readonly schema_version: {
|
109
|
+
readonly type: "integer";
|
110
|
+
readonly const: 1;
|
111
|
+
};
|
112
|
+
readonly device_id: {
|
113
|
+
readonly type: "string";
|
114
|
+
readonly minLength: 1;
|
115
|
+
readonly maxLength: 64;
|
116
|
+
readonly pattern: "^[A-Za-z0-9_-]+$";
|
117
|
+
};
|
118
|
+
readonly device_type: {
|
119
|
+
readonly type: "string";
|
120
|
+
readonly enum: readonly ["sensor", "gateway"];
|
121
|
+
};
|
122
|
+
readonly timestamp: {
|
123
|
+
readonly type: "string";
|
124
|
+
readonly format: "date-time";
|
125
|
+
};
|
126
|
+
};
|
127
|
+
readonly additionalProperties: true;
|
128
|
+
};
|
129
|
+
export declare const sensor_status_schema: {
|
130
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
131
|
+
readonly $id: "https://schemas.alteriom.io/mqtt/v1/sensor_status.schema.json";
|
132
|
+
readonly title: "Sensor Status v1";
|
133
|
+
readonly allOf: readonly [{
|
134
|
+
readonly $ref: "envelope.schema.json";
|
135
|
+
}];
|
136
|
+
readonly type: "object";
|
137
|
+
readonly required: readonly ["status"];
|
138
|
+
readonly properties: {
|
139
|
+
readonly status: {
|
140
|
+
readonly type: "string";
|
141
|
+
readonly enum: readonly ["online", "offline", "updating", "error"];
|
142
|
+
};
|
143
|
+
readonly battery_level: {
|
144
|
+
readonly type: "integer";
|
145
|
+
readonly minimum: 0;
|
146
|
+
readonly maximum: 100;
|
147
|
+
};
|
148
|
+
readonly signal_strength: {
|
149
|
+
readonly type: "integer";
|
150
|
+
readonly minimum: -200;
|
151
|
+
readonly maximum: 0;
|
152
|
+
};
|
153
|
+
};
|
154
|
+
readonly additionalProperties: true;
|
155
|
+
};
|
156
|
+
export declare const gateway_info_schema: {
|
157
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
158
|
+
readonly $id: "https://schemas.alteriom.io/mqtt/v1/gateway_info.schema.json";
|
159
|
+
readonly title: "Gateway Info v1";
|
160
|
+
readonly allOf: readonly [{
|
161
|
+
readonly $ref: "envelope.schema.json";
|
162
|
+
}];
|
163
|
+
readonly type: "object";
|
164
|
+
readonly properties: {
|
165
|
+
readonly mac_address: {
|
166
|
+
readonly type: "string";
|
167
|
+
readonly pattern: "^[0-9A-Fa-f:]{17}$";
|
168
|
+
};
|
169
|
+
readonly ip_address: {
|
170
|
+
readonly type: "string";
|
171
|
+
readonly format: "ipv4";
|
172
|
+
};
|
173
|
+
readonly capabilities: {
|
174
|
+
readonly type: "object";
|
175
|
+
readonly properties: {
|
176
|
+
readonly max_nodes: {
|
177
|
+
readonly type: "integer";
|
178
|
+
readonly minimum: 0;
|
179
|
+
};
|
180
|
+
readonly supports_mesh: {
|
181
|
+
readonly type: "boolean";
|
182
|
+
};
|
183
|
+
readonly firmware_update: {
|
184
|
+
readonly type: "boolean";
|
185
|
+
};
|
186
|
+
};
|
187
|
+
readonly additionalProperties: true;
|
188
|
+
};
|
189
|
+
};
|
190
|
+
readonly additionalProperties: true;
|
191
|
+
};
|
192
|
+
export declare const gateway_metrics_schema: {
|
193
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
194
|
+
readonly $id: "https://schemas.alteriom.io/mqtt/v1/gateway_metrics.schema.json";
|
195
|
+
readonly title: "Gateway Metrics v1";
|
196
|
+
readonly allOf: readonly [{
|
197
|
+
readonly $ref: "envelope.schema.json";
|
198
|
+
}];
|
199
|
+
readonly type: "object";
|
200
|
+
readonly required: readonly ["metrics"];
|
201
|
+
readonly properties: {
|
202
|
+
readonly metrics: {
|
203
|
+
readonly type: "object";
|
204
|
+
readonly required: readonly ["uptime_s"];
|
205
|
+
readonly properties: {
|
206
|
+
readonly uptime_s: {
|
207
|
+
readonly type: "integer";
|
208
|
+
readonly minimum: 0;
|
209
|
+
};
|
210
|
+
readonly cpu_usage_pct: {
|
211
|
+
readonly type: "number";
|
212
|
+
readonly minimum: 0;
|
213
|
+
readonly maximum: 100;
|
214
|
+
};
|
215
|
+
readonly memory_usage_pct: {
|
216
|
+
readonly type: "number";
|
217
|
+
readonly minimum: 0;
|
218
|
+
readonly maximum: 100;
|
219
|
+
};
|
220
|
+
readonly temperature_c: {
|
221
|
+
readonly type: "number";
|
222
|
+
};
|
223
|
+
readonly connected_devices: {
|
224
|
+
readonly type: "integer";
|
225
|
+
readonly minimum: 0;
|
226
|
+
};
|
227
|
+
readonly mesh_nodes: {
|
228
|
+
readonly type: "integer";
|
229
|
+
readonly minimum: 0;
|
230
|
+
};
|
231
|
+
readonly packet_loss_pct: {
|
232
|
+
readonly type: "number";
|
233
|
+
readonly minimum: 0;
|
234
|
+
readonly maximum: 100;
|
235
|
+
};
|
236
|
+
readonly data_throughput_kbps: {
|
237
|
+
readonly type: "number";
|
238
|
+
readonly minimum: 0;
|
239
|
+
};
|
240
|
+
};
|
241
|
+
readonly additionalProperties: true;
|
242
|
+
};
|
243
|
+
};
|
244
|
+
readonly additionalProperties: true;
|
245
|
+
};
|
246
|
+
export declare const firmware_status_schema: {
|
247
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
248
|
+
readonly $id: "https://schemas.alteriom.io/mqtt/v1/firmware_status.schema.json";
|
249
|
+
readonly title: "Firmware Update Status v1";
|
250
|
+
readonly allOf: readonly [{
|
251
|
+
readonly $ref: "envelope.schema.json";
|
252
|
+
}];
|
253
|
+
readonly type: "object";
|
254
|
+
readonly required: readonly ["status"];
|
255
|
+
readonly properties: {
|
256
|
+
readonly event: {
|
257
|
+
readonly type: "string";
|
258
|
+
};
|
259
|
+
readonly from_version: {
|
260
|
+
readonly type: "string";
|
261
|
+
};
|
262
|
+
readonly to_version: {
|
263
|
+
readonly type: "string";
|
264
|
+
};
|
265
|
+
readonly status: {
|
266
|
+
readonly type: "string";
|
267
|
+
readonly enum: readonly ["pending", "downloading", "flashing", "verifying", "rebooting", "completed", "failed"];
|
268
|
+
};
|
269
|
+
readonly progress_pct: {
|
270
|
+
readonly type: "number";
|
271
|
+
readonly minimum: 0;
|
272
|
+
readonly maximum: 100;
|
273
|
+
};
|
274
|
+
readonly error: {
|
275
|
+
readonly type: readonly ["string", "null"];
|
276
|
+
};
|
277
|
+
};
|
278
|
+
readonly additionalProperties: true;
|
279
|
+
};
|
280
|
+
export declare const control_response_schema: {
|
281
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
282
|
+
readonly $id: "https://schemas.alteriom.io/mqtt/v1/control_response.schema.json";
|
283
|
+
readonly title: "Control / Command Response v1";
|
284
|
+
readonly allOf: readonly [{
|
285
|
+
readonly $ref: "envelope.schema.json";
|
286
|
+
}];
|
287
|
+
readonly type: "object";
|
288
|
+
readonly required: readonly ["status"];
|
289
|
+
readonly properties: {
|
290
|
+
readonly command: {
|
291
|
+
readonly type: "string";
|
292
|
+
};
|
293
|
+
readonly status: {
|
294
|
+
readonly type: "string";
|
295
|
+
readonly enum: readonly ["ok", "error"];
|
296
|
+
};
|
297
|
+
readonly message: {
|
298
|
+
readonly type: "string";
|
299
|
+
};
|
300
|
+
readonly result: {
|
301
|
+
readonly type: readonly ["object", "array", "string", "number", "boolean", "null"];
|
302
|
+
};
|
303
|
+
};
|
304
|
+
readonly additionalProperties: true;
|
305
|
+
};
|
306
|
+
export declare const mqtt_v1_bundle_json: {
|
307
|
+
readonly $comment: "Convenience bundle referencing all v1 schema artifact filenames for tooling discovery.";
|
308
|
+
readonly version: 1;
|
309
|
+
readonly schemas: {
|
310
|
+
readonly envelope: "envelope.schema.json";
|
311
|
+
readonly sensor_data: "sensor_data.schema.json";
|
312
|
+
readonly sensor_heartbeat: "sensor_heartbeat.schema.json";
|
313
|
+
readonly sensor_status: "sensor_status.schema.json";
|
314
|
+
readonly gateway_info: "gateway_info.schema.json";
|
315
|
+
readonly gateway_metrics: "gateway_metrics.schema.json";
|
316
|
+
readonly firmware_status: "firmware_status.schema.json";
|
317
|
+
readonly control_response: "control_response.schema.json";
|
318
|
+
};
|
319
|
+
};
|