@alteriom/mqtt-schema 0.2.0 → 0.2.1

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.
@@ -1,44 +1,44 @@
1
- # Validation Rules (Operational Layer)
2
-
3
- This file captures dynamic / contextual validation that is OUTSIDE pure structural JSON Schema constraints.
4
-
5
- ## Timing & Rate
6
- - Future timestamp drift: reject if > 5s ahead of server reference.
7
- - Heartbeat interval recommended 30s; backend may rate-limit <10s.
8
- - Sensor data soft min 30s unless negotiated high-frequency mode.
9
-
10
- ## Heartbeat Firmware Version Exception
11
- - Only heartbeat topic may omit `firmware_version` when unchanged.
12
- - All other topics require the field.
13
-
14
- ## Forbidden / Drop Conditions
15
- | Reason | Condition |
16
- |--------|----------|
17
- | missing_fields | Required base fields absent (heartbeat firmware exception applied). |
18
- | invalid_timestamp | Non-ISO 8601 / unparseable timestamp. |
19
- | deprecated_keys | Usage of forbidden alias keys (f, fw, ver, version, u, up, rssi). |
20
- | invalid_sensor_entry | Sensor object missing `value` key. |
21
- | future_drift | Timestamp too far in future (>5s). |
22
- | out_of_range | battery_level not 0-100 OR quality_score not 0-1. |
23
- | invalid_numeric | Non-numeric where numeric expected. |
24
- | spec_violation | Generic fallback after failed internal validation. |
25
-
26
- ## Sensor Object Semantics
27
- - `value` REQUIRED.
28
- - `unit`, `raw_value`, `calibrated_value`, `quality_score`, `name`, `location`, `additional_data` OPTIONAL.
29
- - If `quality_score` present must be 0.0–1.0 inclusive.
30
-
31
- ## Metrics Constraints
32
- - Gateway metrics MUST appear under `metrics` (never at top-level).
33
- - Required minimal metric: `uptime_s`.
34
-
35
- ## Firmware Update Status
36
- - `status` must be one of: pending, downloading, flashing, verifying, rebooting, completed, failed.
37
- - `progress_pct` (if present) must be 0–100.
38
-
39
- ## Extensibility
40
- - Unknown top-level keys tolerated (future evolution) except if they collide with any deprecated alias or reserved future keys announced in CHANGELOG.
41
-
42
- ## Versioning
43
- - Current `schema_version`: 1
44
- - Additions remain optional; breaking changes introduce new schema set.
1
+ # Validation Rules (Operational Layer)
2
+
3
+ This file captures dynamic / contextual validation that is OUTSIDE pure structural JSON Schema constraints.
4
+
5
+ ## Timing & Rate
6
+ - Future timestamp drift: reject if > 5s ahead of server reference.
7
+ - Heartbeat interval recommended 30s; backend may rate-limit <10s.
8
+ - Sensor data soft min 30s unless negotiated high-frequency mode.
9
+
10
+ ## Heartbeat Firmware Version Exception
11
+ - Only heartbeat topic may omit `firmware_version` when unchanged.
12
+ - All other topics require the field.
13
+
14
+ ## Forbidden / Drop Conditions
15
+ | Reason | Condition |
16
+ |--------|----------|
17
+ | missing_fields | Required base fields absent (heartbeat firmware exception applied). |
18
+ | invalid_timestamp | Non-ISO 8601 / unparseable timestamp. |
19
+ | deprecated_keys | Usage of forbidden alias keys (f, fw, ver, version, u, up, rssi). |
20
+ | invalid_sensor_entry | Sensor object missing `value` key. |
21
+ | future_drift | Timestamp too far in future (>5s). |
22
+ | out_of_range | battery_level not 0-100 OR quality_score not 0-1. |
23
+ | invalid_numeric | Non-numeric where numeric expected. |
24
+ | spec_violation | Generic fallback after failed internal validation. |
25
+
26
+ ## Sensor Object Semantics
27
+ - `value` REQUIRED.
28
+ - `unit`, `raw_value`, `calibrated_value`, `quality_score`, `name`, `location`, `additional_data` OPTIONAL.
29
+ - If `quality_score` present must be 0.0–1.0 inclusive.
30
+
31
+ ## Metrics Constraints
32
+ - Gateway metrics MUST appear under `metrics` (never at top-level).
33
+ - Required minimal metric: `uptime_s`.
34
+
35
+ ## Firmware Update Status
36
+ - `status` must be one of: pending, downloading, flashing, verifying, rebooting, completed, failed.
37
+ - `progress_pct` (if present) must be 0–100.
38
+
39
+ ## Extensibility
40
+ - Unknown top-level keys tolerated (future evolution) except if they collide with any deprecated alias or reserved future keys announced in CHANGELOG.
41
+
42
+ ## Versioning
43
+ - Current `schema_version`: 1
44
+ - Additions remain optional; breaking changes introduce new schema set.
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@alteriom/mqtt-schema",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Alteriom MQTT v1 schemas, TypeScript types, and validation helpers for web integration",
5
5
  "license": "MIT",
6
6
  "author": "Alteriom Development Team",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/Alteriom/alteriom-firmware.git"
9
+ "url": "https://github.com/Alteriom/alteriom-mqtt-schema.git"
10
10
  },
11
- "homepage": "https://github.com/Alteriom/alteriom-firmware/tree/main/docs/mqtt_schema",
11
+ "homepage": "https://github.com/Alteriom/alteriom-mqtt-schema#readme",
12
12
  "bugs": {
13
- "url": "https://github.com/Alteriom/alteriom-firmware/issues"
13
+ "url": "https://github.com/Alteriom/alteriom-mqtt-schema/issues"
14
14
  },
15
15
  "type": "commonjs",
16
16
  "main": "dist/cjs/index.js",
@@ -60,6 +60,9 @@
60
60
  "README.md",
61
61
  "LICENSE"
62
62
  ],
63
+ "publishConfig": {
64
+ "access": "public"
65
+ },
63
66
  "scripts": {
64
67
  "prebuild": "npm run clean && node scripts/copy-schemas.cjs",
65
68
  "build:cjs": "tsc -p tsconfig.json",
@@ -69,6 +72,9 @@
69
72
  "prepare": "npm run build",
70
73
  "lint": "echo 'No linter configured'",
71
74
  "test": "node test/validate-fixtures.cjs",
75
+ "verify:schemas": "node scripts/check-schema-sync.cjs",
76
+ "verify:release": "node scripts/check-release-integrity.cjs",
77
+ "verify": "npm run verify:schemas && npm run verify:release && npm test",
72
78
  "release:prepare": "node scripts/release-prepare.cjs"
73
79
  },
74
80
  "keywords": [