@hello.nrfcloud.com/proto-map 7.0.0 → 7.1.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.
@@ -50,9 +50,11 @@ export var LWM2MObjectDefinition = Type.Object({
50
50
  'Latitude'
51
51
  ]
52
52
  }),
53
- Operations: Type.Literal('R', {
54
- description: 'Only read-properties are supported'
55
- }),
53
+ Operations: Type.Union([
54
+ Type.Literal('R'),
55
+ Type.Literal('W'),
56
+ Type.Literal('RW')
57
+ ]),
56
58
  MultipleInstances: Type.Literal('Single'),
57
59
  Mandatory: Type.Union([
58
60
  Type.Literal('Optional'),
@@ -42,6 +42,11 @@
42
42
  *
43
43
  * Describes observed sea water level.
44
44
  */ LwM2MObjectID[LwM2MObjectID["SeaWaterLevel_14230"] = 14230] = "SeaWaterLevel_14230";
45
+ /**
46
+ * RGB LED (14240)
47
+ *
48
+ * Describes an RGB LED. Use different instances to address different LEDs.
49
+ */ LwM2MObjectID[LwM2MObjectID["RGBLED_14240"] = 14240] = "RGBLED_14240";
45
50
  })(LwM2MObjectID || (LwM2MObjectID = {}));
46
51
  /**
47
52
  * The LwM2M Object IDs defined in this repo.
@@ -53,5 +58,6 @@
53
58
  14205,
54
59
  14210,
55
60
  14220,
56
- 14230
61
+ 14230,
62
+ 14240
57
63
  ];
@@ -600,4 +600,73 @@ var _obj;
600
600
  Description: "The timestamp of when the observation was made."
601
601
  }
602
602
  }
603
+ }), /**
604
+ * RGB LED (14240)
605
+ *
606
+ * Describes an RGB LED. Use different instances to address different LEDs.
607
+ */ _define_property(_obj, LwM2MObjectID.RGBLED_14240, {
608
+ ObjectID: LwM2MObjectID.RGBLED_14240,
609
+ ObjectVersion: "1.0",
610
+ Name: "RGB LED",
611
+ Description: "Describes an RGB LED. Use different instances to address different LEDs.",
612
+ Resources: {
613
+ 0: {
614
+ ResourceID: 0,
615
+ Name: "Red",
616
+ Mandatory: true,
617
+ Type: ResourceType.Integer,
618
+ Description: "The red brightness level of the LED.",
619
+ RangeEnumeration: {
620
+ min: 0,
621
+ max: 255
622
+ }
623
+ },
624
+ /**
625
+ * Green (Integer)
626
+ *
627
+ * The green brightness level of the LED.
628
+ *
629
+ * Minimum: 0
630
+ * Maximum: 255
631
+ */ 1: {
632
+ ResourceID: 1,
633
+ Name: "Green",
634
+ Mandatory: true,
635
+ Type: ResourceType.Integer,
636
+ Description: "The green brightness level of the LED.",
637
+ RangeEnumeration: {
638
+ min: 0,
639
+ max: 255
640
+ }
641
+ },
642
+ /**
643
+ * Blue (Integer)
644
+ *
645
+ * The blue brightness level of the LED.
646
+ *
647
+ * Minimum: 0
648
+ * Maximum: 255
649
+ */ 2: {
650
+ ResourceID: 2,
651
+ Name: "Blue",
652
+ Mandatory: true,
653
+ Type: ResourceType.Integer,
654
+ Description: "The blue brightness level of the LED.",
655
+ RangeEnumeration: {
656
+ min: 0,
657
+ max: 255
658
+ }
659
+ },
660
+ /**
661
+ * Timestamp (Time)
662
+ *
663
+ * The timestamp of when the LED was changed.
664
+ */ 99: {
665
+ ResourceID: 99,
666
+ Name: "Timestamp",
667
+ Mandatory: true,
668
+ Type: ResourceType.Time,
669
+ Description: "The timestamp of when the LED was changed."
670
+ }
671
+ }
603
672
  }), _obj);
@@ -0,0 +1,5 @@
1
+ /**
2
+ * RGB LED (14240)
3
+ *
4
+ * Describes an RGB LED. Use different instances to address different LEDs.
5
+ */ export { };
@@ -0,0 +1,14 @@
1
+ import { NumberResource, DateResource, validate } from "../validation.js";
2
+ import { LwM2MObjectID } from "../LwM2MObjectID.js";
3
+ /**
4
+ * Validate RGB LED (14240)
5
+ *
6
+ * Ensures the given object is an LwM2M object according to the schema 14240.xml.
7
+ */ export var validate14240 = function(o, onError) {
8
+ return validate(LwM2MObjectID.RGBLED_14240, "1.0", {
9
+ 0: NumberResource,
10
+ 1: NumberResource,
11
+ 2: NumberResource,
12
+ 99: DateResource
13
+ })(o, onError);
14
+ };
@@ -6,3 +6,4 @@ export { validate14205 } from "./object/validate14205.js";
6
6
  export { validate14210 } from "./object/validate14210.js";
7
7
  export { validate14220 } from "./object/validate14220.js";
8
8
  export { validate14230 } from "./object/validate14230.js";
9
+ export { validate14240 } from "./object/validate14240.js";
@@ -8,5 +8,6 @@
8
8
  14205: 99,
9
9
  14210: 99,
10
10
  14220: 99,
11
- 14230: 99
11
+ 14230: 99,
12
+ 14240: 99
12
13
  };
@@ -7,6 +7,7 @@ import { validate14205 } from "./object/validate14205.js";
7
7
  import { validate14210 } from "./object/validate14210.js";
8
8
  import { validate14220 } from "./object/validate14220.js";
9
9
  import { validate14230 } from "./object/validate14230.js";
10
+ import { validate14240 } from "./object/validate14240.js";
10
11
  /**
11
12
  * Contains the validators for all registered LwM2M objects.
12
13
  */ export var validators = new Map();
@@ -18,3 +19,4 @@ validators.set(LwM2MObjectID.Environment_14205, validate14205);
18
19
  validators.set(LwM2MObjectID.SolarCharge_14210, validate14210);
19
20
  validators.set(LwM2MObjectID.ButtonPress_14220, validate14220);
20
21
  validators.set(LwM2MObjectID.SeaWaterLevel_14230, validate14230);
22
+ validators.set(LwM2MObjectID.RGBLED_14240, validate14240);
@@ -0,0 +1,54 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <LWM2M xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://openmobilealliance.org/tech/profiles/LWM2M-v1_1.xsd">
3
+ <Object ObjectType="MODefinition">
4
+ <Name>RGB LED</Name>
5
+ <Description1><![CDATA[Describes an RGB LED. Use different instances to address different LEDs.]]></Description1>
6
+ <ObjectID>14240</ObjectID>
7
+ <ObjectURN>urn:oma:lwm2m:x:14240</ObjectURN>
8
+ <MultipleInstances>Multiple</MultipleInstances>
9
+ <Mandatory>Optional</Mandatory>
10
+ <Resources>
11
+ <Item ID="0">
12
+ <Name>Red</Name>
13
+ <Operations>RW</Operations>
14
+ <MultipleInstances>Single</MultipleInstances>
15
+ <Mandatory>Mandatory</Mandatory>
16
+ <Type>Integer</Type>
17
+ <RangeEnumeration>0..255</RangeEnumeration>
18
+ <Units/>
19
+ <Description><![CDATA[The red brightness level of the LED.]]></Description>
20
+ </Item>
21
+ <Item ID="1">
22
+ <Name>Green</Name>
23
+ <Operations>RW</Operations>
24
+ <MultipleInstances>Single</MultipleInstances>
25
+ <Mandatory>Mandatory</Mandatory>
26
+ <Type>Integer</Type>
27
+ <RangeEnumeration>0..255</RangeEnumeration>
28
+ <Units/>
29
+ <Description><![CDATA[The green brightness level of the LED.]]></Description>
30
+ </Item>
31
+ <Item ID="2">
32
+ <Name>Blue</Name>
33
+ <Operations>RW</Operations>
34
+ <MultipleInstances>Single</MultipleInstances>
35
+ <Mandatory>Mandatory</Mandatory>
36
+ <Type>Integer</Type>
37
+ <RangeEnumeration>0..255</RangeEnumeration>
38
+ <Units/>
39
+ <Description><![CDATA[The blue brightness level of the LED.]]></Description>
40
+ </Item>
41
+ <Item ID="99">
42
+ <Name>Timestamp</Name>
43
+ <Operations>R</Operations>
44
+ <MultipleInstances>Single</MultipleInstances>
45
+ <Mandatory>Mandatory</Mandatory>
46
+ <Type>Time</Type>
47
+ <RangeEnumeration/>
48
+ <Units/>
49
+ <Description><![CDATA[The timestamp of when the LED was changed.]]></Description>
50
+ </Item>
51
+ </Resources>
52
+ <Description2/>
53
+ </Object>
54
+ </LWM2M>
@@ -44,9 +44,11 @@ export const LWM2MObjectDefinition = Type.Object(
44
44
  Type.Integer({ minimum: 0, maximum: 65534 }),
45
45
  Type.Object({
46
46
  Name: Type.String({ minLength: 1, examples: ['Latitude'] }),
47
- Operations: Type.Literal('R', {
48
- description: 'Only read-properties are supported',
49
- }),
47
+ Operations: Type.Union([
48
+ Type.Literal('R'),
49
+ Type.Literal('W'),
50
+ Type.Literal('RW'),
51
+ ]),
50
52
  MultipleInstances: Type.Literal('Single'),
51
53
  Mandatory: Type.Union([
52
54
  Type.Literal('Optional'),
@@ -49,7 +49,13 @@ export enum LwM2MObjectID {
49
49
  *
50
50
  * Describes observed sea water level.
51
51
  */
52
- SeaWaterLevel_14230 = 14230
52
+ SeaWaterLevel_14230 = 14230,
53
+ /**
54
+ * RGB LED (14240)
55
+ *
56
+ * Describes an RGB LED. Use different instances to address different LEDs.
57
+ */
58
+ RGBLED_14240 = 14240
53
59
  }
54
60
  /**
55
61
  * The LwM2M Object IDs defined in this repo.
@@ -70,4 +76,6 @@ export const LwM2MObjectIDs = [
70
76
  // Button press (14220)
71
77
  LwM2MObjectID.ButtonPress_14220,
72
78
  // Sea Water Level (14230)
73
- LwM2MObjectID.SeaWaterLevel_14230];
79
+ LwM2MObjectID.SeaWaterLevel_14230,
80
+ // RGB LED (14240)
81
+ LwM2MObjectID.RGBLED_14240];
@@ -278,4 +278,38 @@ export const definitions: Record<LwM2MObjectID, LWM2MObjectInfo> = { /**
278
278
  *
279
279
  * The timestamp of when the observation was made.
280
280
  */
281
- 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Description: "The timestamp of when the observation was made." } } } };
281
+ 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Description: "The timestamp of when the observation was made." } } }, /**
282
+ * RGB LED (14240)
283
+ *
284
+ * Describes an RGB LED. Use different instances to address different LEDs.
285
+ */
286
+ [LwM2MObjectID.RGBLED_14240]: { ObjectID: LwM2MObjectID.RGBLED_14240, ObjectVersion: "1.0", Name: "RGB LED", Description: "Describes an RGB LED. Use different instances to address different LEDs.", Resources: { /**
287
+ * Red (Integer)
288
+ *
289
+ * The red brightness level of the LED.
290
+ *
291
+ * Minimum: 0
292
+ * Maximum: 255
293
+ */
294
+ 0: { ResourceID: 0, Name: "Red", Mandatory: true, Type: ResourceType.Integer, Description: "The red brightness level of the LED.", RangeEnumeration: { min: 0, max: 255 } }, /**
295
+ * Green (Integer)
296
+ *
297
+ * The green brightness level of the LED.
298
+ *
299
+ * Minimum: 0
300
+ * Maximum: 255
301
+ */
302
+ 1: { ResourceID: 1, Name: "Green", Mandatory: true, Type: ResourceType.Integer, Description: "The green brightness level of the LED.", RangeEnumeration: { min: 0, max: 255 } }, /**
303
+ * Blue (Integer)
304
+ *
305
+ * The blue brightness level of the LED.
306
+ *
307
+ * Minimum: 0
308
+ * Maximum: 255
309
+ */
310
+ 2: { ResourceID: 2, Name: "Blue", Mandatory: true, Type: ResourceType.Integer, Description: "The blue brightness level of the LED.", RangeEnumeration: { min: 0, max: 255 } }, /**
311
+ * Timestamp (Time)
312
+ *
313
+ * The timestamp of when the LED was changed.
314
+ */
315
+ 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Description: "The timestamp of when the LED was changed." } } } };
@@ -0,0 +1,49 @@
1
+ import type { LwM2MObject } from "../LwM2MObject.js";
2
+ import { LwM2MObjectID } from "../LwM2MObjectID.js";
3
+ /**
4
+ * RGB LED (14240)
5
+ *
6
+ * Describes an RGB LED. Use different instances to address different LEDs.
7
+ */
8
+ export type RGBLED_14240 = LwM2MObject<{
9
+ ObjectID: LwM2MObjectID.RGBLED_14240;
10
+ ObjectVersion: "1.0";
11
+ Resources: {
12
+ /**
13
+ * Red
14
+ *
15
+ * The red brightness level of the LED.
16
+ */
17
+ /**
18
+ * Minimum: 0
19
+ * Maximum: 255
20
+ */
21
+ 0: number;
22
+ /**
23
+ * Green
24
+ *
25
+ * The green brightness level of the LED.
26
+ */
27
+ /**
28
+ * Minimum: 0
29
+ * Maximum: 255
30
+ */
31
+ 1: number;
32
+ /**
33
+ * Blue
34
+ *
35
+ * The blue brightness level of the LED.
36
+ */
37
+ /**
38
+ * Minimum: 0
39
+ * Maximum: 255
40
+ */
41
+ 2: number;
42
+ /**
43
+ * Timestamp
44
+ *
45
+ * The timestamp of when the LED was changed.
46
+ */
47
+ 99: Date;
48
+ };
49
+ }>;
@@ -0,0 +1,10 @@
1
+ import type { LwM2MObject } from "../LwM2MObject.js";
2
+ import { NumberResource, DateResource, validate } from "../validation.js";
3
+ import type { RGBLED_14240 } from "../objects.js";
4
+ import { LwM2MObjectID } from "../LwM2MObjectID.js";
5
+ /**
6
+ * Validate RGB LED (14240)
7
+ *
8
+ * Ensures the given object is an LwM2M object according to the schema 14240.xml.
9
+ */
10
+ export const validate14240 = (o: unknown, onError?: (error: Error) => void): o is LwM2MObject<RGBLED_14240> => validate(LwM2MObjectID.RGBLED_14240, "1.0", { 0: NumberResource, 1: NumberResource, 2: NumberResource, 99: DateResource })(o, onError);
package/lwm2m/objects.ts CHANGED
@@ -13,4 +13,6 @@ export { validate14210 } from "./object/validate14210.js";
13
13
  export type { ButtonPress_14220 } from "./object/14220.js";
14
14
  export { validate14220 } from "./object/validate14220.js";
15
15
  export type { SeaWaterLevel_14230 } from "./object/14230.js";
16
- export { validate14230 } from "./object/validate14230.js";
16
+ export { validate14230 } from "./object/validate14230.js";
17
+ export type { RGBLED_14240 } from "./object/14240.js";
18
+ export { validate14240 } from "./object/validate14240.js";
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Contains the ID of the resource that defines the timestamp for each LwM2M object definition
3
3
  */
4
- export const timestampResources: Readonly<Record<number, number>> = { 14201: 99, 14202: 99, 14203: 99, 14204: 99, 14205: 99, 14210: 99, 14220: 99, 14230: 99 };
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 };
@@ -7,6 +7,7 @@ import { validate14205 } from "./object/validate14205.js";
7
7
  import { validate14210 } from "./object/validate14210.js";
8
8
  import { validate14220 } from "./object/validate14220.js";
9
9
  import { validate14230 } from "./object/validate14230.js";
10
+ import { validate14240 } from "./object/validate14240.js";
10
11
  /**
11
12
  * Contains the validators for all registered LwM2M objects.
12
13
  */
@@ -18,4 +19,5 @@ validators.set(LwM2MObjectID.DeviceInformation_14204, validate14204)
18
19
  validators.set(LwM2MObjectID.Environment_14205, validate14205)
19
20
  validators.set(LwM2MObjectID.SolarCharge_14210, validate14210)
20
21
  validators.set(LwM2MObjectID.ButtonPress_14220, validate14220)
21
- validators.set(LwM2MObjectID.SeaWaterLevel_14230, validate14230)
22
+ validators.set(LwM2MObjectID.SeaWaterLevel_14230, validate14230)
23
+ validators.set(LwM2MObjectID.RGBLED_14240, validate14240)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hello.nrfcloud.com/proto-map",
3
- "version": "7.0.0",
3
+ "version": "7.1.1",
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": {
@@ -43,7 +43,7 @@
43
43
  "@bifravst/prettier-config": "1.0.0",
44
44
  "@commitlint/config-conventional": "19.2.2",
45
45
  "@swc/cli": "0.3.12",
46
- "@swc/core": "1.4.17",
46
+ "@swc/core": "1.5.0",
47
47
  "@types/node": "20.12.7",
48
48
  "@types/xml2js": "0.4.14",
49
49
  "chalk": "5.3.0",
@@ -104,7 +104,7 @@
104
104
  "lwm2m"
105
105
  ],
106
106
  "peerDependencies": {
107
- "@sinclair/typebox": "^0.32.22",
107
+ "@sinclair/typebox": "^0.32.24",
108
108
  "ajv": "^8.12.0"
109
109
  }
110
110
  }