@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/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<Record<number, number>> = { 14201: 99, 14202: 99, 14203: 99, 14204: 99, 14205: 99, 14210: 99, 14220: 99, 14230: 99, 14240: 99, 14301: 99 };
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]]);
@@ -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": "11.0.0",
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.1",
39
- "@bifravst/prettier-config": "1.0.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.24",
43
- "@types/node": "20.12.13",
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.11.0",
53
+ "tsx": "4.13.2",
54
54
  "xml2js": "0.6.2",
55
- "yaml": "2.4.2"
55
+ "yaml": "2.4.3"
56
56
  },
57
57
  "lint-staged": {
58
58
  "*.{ts,tsx}": [
@@ -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[lwm2m.ObjectID] as number // All registered objects must have a timestamp resource
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,
@@ -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[resourceId.ObjectID]
54
+ const tsRes = timestampResources.get(resourceId.ObjectID)
55
55
  if (tsRes === undefined) {
56
56
  return {
57
57
  error: new Error(