@hello.nrfcloud.com/proto-map 11.0.0 → 12.1.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 +0 -2
- package/dist/generator/generateLwM2MDefinitions.js +1 -0
- package/dist/generator/generateLwM2MDefinitions.spec.js +11 -0
- package/dist/generator/generateLwm2mTimestampResources.js +18 -6
- package/dist/generator/generateType.js +7 -1
- package/dist/generator/lwm2m.js +2 -1
- package/dist/lwm2m/LWM2MObjectDefinition.js +4 -1
- package/dist/lwm2m/LwM2MObjectID.js +7 -1
- package/dist/lwm2m/definitions.js +81 -0
- package/dist/lwm2m/instanceTs.js +1 -1
- package/dist/lwm2m/object/14401.d.js +5 -0
- package/dist/lwm2m/object/validate14401.js +12 -0
- package/dist/lwm2m/objects.js +1 -0
- package/dist/lwm2m/timestampResources.js +47 -12
- package/dist/lwm2m/validators.js +2 -0
- package/dist/senml/lwm2mToSenML.js +1 -1
- package/dist/senml/senMLtoLwM2M.js +1 -1
- package/lwm2m/14401.xml +34 -0
- package/lwm2m/LWM2MObjectDefinition.ts +4 -1
- package/lwm2m/LWM2MObjectInfo.ts +1 -0
- package/lwm2m/LwM2MObjectID.ts +10 -2
- package/lwm2m/LwM2MObjectInstance.ts +8 -1
- package/lwm2m/ParsedLwM2MObjectDefinition.ts +1 -1
- package/lwm2m/definitions.ts +65 -50
- package/lwm2m/instanceTs.ts +1 -1
- package/lwm2m/object/14401.d.ts +25 -0
- package/lwm2m/object/validate14401.ts +14 -0
- package/lwm2m/objects.ts +3 -1
- package/lwm2m/timestampResources.ts +2 -1
- package/lwm2m/validators.ts +3 -1
- package/package.json +7 -7
- package/senml/lwm2mToSenML.ts +1 -1
- package/senml/senMLtoLwM2M.ts +1 -1
package/lwm2m/objects.ts
CHANGED
|
@@ -17,4 +17,6 @@ export { validate14230 } from "./object/validate14230.js";
|
|
|
17
17
|
export type { RGBLED_14240 } from "./object/14240.js";
|
|
18
18
|
export { validate14240 } from "./object/validate14240.js";
|
|
19
19
|
export type { ApplicationConfiguration_14301 } from "./object/14301.js";
|
|
20
|
-
export { validate14301 } from "./object/validate14301.js";
|
|
20
|
+
export { validate14301 } from "./object/validate14301.js";
|
|
21
|
+
export type { NRFCloudServiceInfo_14401 } from "./object/14401.js";
|
|
22
|
+
export { validate14401 } from "./object/validate14401.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { LwM2MObjectID } from "./LwM2MObjectID.js";
|
|
1
2
|
/**
|
|
2
3
|
* Contains the ID of the resource that defines the timestamp for each LwM2M object definition
|
|
3
4
|
*/
|
|
4
|
-
export const timestampResources: Readonly<
|
|
5
|
+
export const timestampResources: Readonly<Map<LwM2MObjectID, number>> = new Map<LwM2MObjectID, number>([[LwM2MObjectID.Geolocation_14201, 99], [LwM2MObjectID.BatteryAndPower_14202, 99], [LwM2MObjectID.ConnectionInformation_14203, 99], [LwM2MObjectID.DeviceInformation_14204, 99], [LwM2MObjectID.Environment_14205, 99], [LwM2MObjectID.SolarCharge_14210, 99], [LwM2MObjectID.ButtonPress_14220, 99], [LwM2MObjectID.SeaWaterLevel_14230, 99], [LwM2MObjectID.RGBLED_14240, 99], [LwM2MObjectID.ApplicationConfiguration_14301, 99], [LwM2MObjectID.NRFCloudServiceInfo_14401, 99]]);
|
package/lwm2m/validators.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { validate14220 } from "./object/validate14220.js";
|
|
|
10
10
|
import { validate14230 } from "./object/validate14230.js";
|
|
11
11
|
import { validate14240 } from "./object/validate14240.js";
|
|
12
12
|
import { validate14301 } from "./object/validate14301.js";
|
|
13
|
+
import { validate14401 } from "./object/validate14401.js";
|
|
13
14
|
/**
|
|
14
15
|
* Contains the validators for all registered LwM2M objects.
|
|
15
16
|
*/
|
|
@@ -27,4 +28,5 @@ validators.set(LwM2MObjectID.SolarCharge_14210, validate14210)
|
|
|
27
28
|
validators.set(LwM2MObjectID.ButtonPress_14220, validate14220)
|
|
28
29
|
validators.set(LwM2MObjectID.SeaWaterLevel_14230, validate14230)
|
|
29
30
|
validators.set(LwM2MObjectID.RGBLED_14240, validate14240)
|
|
30
|
-
validators.set(LwM2MObjectID.ApplicationConfiguration_14301, validate14301)
|
|
31
|
+
validators.set(LwM2MObjectID.ApplicationConfiguration_14301, validate14301)
|
|
32
|
+
validators.set(LwM2MObjectID.NRFCloudServiceInfo_14401, validate14401)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hello.nrfcloud.com/proto-map",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.1.0",
|
|
4
4
|
"description": "Documents the communication protocol between devices, the hello.nrfcloud.com/map backend and web application",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"prepublishOnly": "./compile.sh"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@bifravst/eslint-config-typescript": "6.1.
|
|
39
|
-
"@bifravst/prettier-config": "1.0.
|
|
38
|
+
"@bifravst/eslint-config-typescript": "6.1.2",
|
|
39
|
+
"@bifravst/prettier-config": "1.0.2",
|
|
40
40
|
"@commitlint/config-conventional": "19.2.2",
|
|
41
41
|
"@swc/cli": "0.3.12",
|
|
42
|
-
"@swc/core": "1.5.
|
|
43
|
-
"@types/node": "20.
|
|
42
|
+
"@swc/core": "1.5.25",
|
|
43
|
+
"@types/node": "20.14.2",
|
|
44
44
|
"@types/xml2js": "0.4.14",
|
|
45
45
|
"chalk": "5.3.0",
|
|
46
46
|
"globstar": "1.0.0",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"remark": "15.0.1",
|
|
51
51
|
"remark-frontmatter": "5.0.0",
|
|
52
52
|
"tsmatchers": "5.0.2",
|
|
53
|
-
"tsx": "4.
|
|
53
|
+
"tsx": "4.13.2",
|
|
54
54
|
"xml2js": "0.6.2",
|
|
55
|
-
"yaml": "2.4.
|
|
55
|
+
"yaml": "2.4.3"
|
|
56
56
|
},
|
|
57
57
|
"lint-staged": {
|
|
58
58
|
"*.{ts,tsx}": [
|
package/senml/lwm2mToSenML.ts
CHANGED
|
@@ -16,7 +16,7 @@ export const lwm2mToSenML = (
|
|
|
16
16
|
): { senML: SenMLType } | { errors: Array<Error> } => {
|
|
17
17
|
const def = definitions[lwm2m.ObjectID]
|
|
18
18
|
const i = instanceTs(lwm2m)
|
|
19
|
-
const tsResourceId = timestampResources
|
|
19
|
+
const tsResourceId = timestampResources.get(lwm2m.ObjectID) as number // All registered objects must have a timestamp resource
|
|
20
20
|
const [first, ...rest] = Object.entries({
|
|
21
21
|
...lwm2m.Resources,
|
|
22
22
|
[tsResourceId]: undefined,
|
package/senml/senMLtoLwM2M.ts
CHANGED
|
@@ -51,7 +51,7 @@ export const senMLtoLwM2M = (
|
|
|
51
51
|
return { error: new Error(`Invalid resource ID: ${itemResourceId}`) }
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const tsRes = timestampResources
|
|
54
|
+
const tsRes = timestampResources.get(resourceId.ObjectID)
|
|
55
55
|
if (tsRes === undefined) {
|
|
56
56
|
return {
|
|
57
57
|
error: new Error(
|