@hello.nrfcloud.com/proto-map 5.6.2 → 5.6.3

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.
Files changed (68) hide show
  1. package/api/Context.ts +1 -1
  2. package/api/{ResourceUpdate.spec.ts → ObjectUpdate.spec.ts} +5 -5
  3. package/api/{ResourceUpdate.ts → ObjectUpdate.ts} +4 -4
  4. package/dist/api/Context.js +1 -1
  5. package/dist/api/DeviceId.js +7 -7
  6. package/dist/api/Devices.js +11 -11
  7. package/dist/api/History.js +10 -10
  8. package/dist/api/History.spec.js +17 -17
  9. package/dist/api/LwM2M.js +11 -11
  10. package/dist/api/ObjectUpdate.js +17 -0
  11. package/dist/api/ObjectUpdate.spec.js +26 -0
  12. package/dist/api/ShareDeviceOwnershipConfirmed.js +4 -4
  13. package/dist/api/ShareDeviceRequest.js +4 -4
  14. package/dist/api/Timestamp.js +3 -3
  15. package/dist/api/Timestamp.spec.js +9 -9
  16. package/dist/api/index.js +8 -8
  17. package/dist/generator/addDocBlock.js +2 -2
  18. package/dist/generator/generateLwM2MDefinitions.js +27 -27
  19. package/dist/generator/generateLwM2MDefinitions.spec.js +32 -32
  20. package/dist/generator/generateLwm2mTimestampResources.js +7 -7
  21. package/dist/generator/generateModels.js +37 -37
  22. package/dist/generator/generateType.js +21 -21
  23. package/dist/generator/generateValidator.js +29 -29
  24. package/dist/generator/generateValidators.js +9 -9
  25. package/dist/generator/isDir.js +1 -1
  26. package/dist/generator/isDir.spec.js +13 -13
  27. package/dist/generator/lwm2m.js +23 -23
  28. package/dist/generator/models.js +23 -23
  29. package/dist/generator/printNode.js +2 -2
  30. package/dist/generator/tokenizeName.js +2 -2
  31. package/dist/generator/tokenizeName.spec.js +20 -20
  32. package/dist/generator/types.js +37 -37
  33. package/dist/lwm2m/LWM2MObjectDefinition.js +30 -30
  34. package/dist/lwm2m/check-lwm2m-rules.js +34 -34
  35. package/dist/lwm2m/definitions.js +4 -4
  36. package/dist/lwm2m/fromXML2JSON.js +4 -4
  37. package/dist/lwm2m/instanceTs.js +2 -2
  38. package/dist/lwm2m/instanceTs.spec.js +10 -10
  39. package/dist/lwm2m/isRegisteredLwM2MObject.js +2 -2
  40. package/dist/lwm2m/isRegisteredLwM2MObject.spec.js +12 -12
  41. package/dist/lwm2m/parseRangeEnumeration.js +1 -1
  42. package/dist/lwm2m/parseRangeEnumeration.spec.js +11 -11
  43. package/dist/lwm2m/unwrapNestedArray.js +2 -2
  44. package/dist/lwm2m/unwrapNestedArray.spec.js +155 -155
  45. package/dist/lwm2m/validate.js +1 -1
  46. package/dist/lwm2m/validation.js +16 -16
  47. package/dist/markdown/getCodeBlock.js +5 -5
  48. package/dist/markdown/getFrontMatter.js +6 -6
  49. package/dist/markdown/parseREADME.js +5 -5
  50. package/dist/models/asset_tracker_v2+AWS/examples/examples.spec.js +21 -21
  51. package/dist/models/check-model-rules.js +42 -42
  52. package/dist/models/models.js +20 -20
  53. package/dist/models/types.js +3 -3
  54. package/dist/senml/SenMLSchema.js +16 -16
  55. package/dist/senml/SenMLSchema.spec.js +11 -11
  56. package/dist/senml/hasValue.js +2 -2
  57. package/dist/senml/hasValue.spec.js +4 -4
  58. package/dist/senml/lwm2mToSenML.js +8 -8
  59. package/dist/senml/lwm2mToSenML.spec.js +42 -42
  60. package/dist/senml/parseResourceId.js +1 -1
  61. package/dist/senml/parseResourceId.spec.js +6 -6
  62. package/dist/senml/senMLtoLwM2M.js +14 -14
  63. package/dist/senml/senMLtoLwM2M.spec.js +53 -53
  64. package/dist/senml/validateSenML.js +2 -2
  65. package/dist/senml/validateSenML.spec.js +11 -11
  66. package/package.json +4 -8
  67. package/dist/api/ResourceUpdate.js +0 -17
  68. package/dist/api/ResourceUpdate.spec.js +0 -26
@@ -32,7 +32,7 @@ var _obj;
32
32
  min: -90,
33
33
  max: 90
34
34
  },
35
- Units: "\xb0"
35
+ Units: "\u00B0"
36
36
  },
37
37
  /**
38
38
  * Longitude (Float)
@@ -51,7 +51,7 @@ var _obj;
51
51
  min: -180,
52
52
  max: 180
53
53
  },
54
- Units: "\xb0"
54
+ Units: "\u00B0"
55
55
  },
56
56
  /**
57
57
  * Altitude (Float)
@@ -106,7 +106,7 @@ var _obj;
106
106
  min: 0,
107
107
  max: 360
108
108
  },
109
- Units: "\xb0"
109
+ Units: "\u00B0"
110
110
  },
111
111
  /**
112
112
  * Source (String)
@@ -432,7 +432,7 @@ var _obj;
432
432
  Mandatory: false,
433
433
  Type: ResourceType.Float,
434
434
  Description: "Environmental temperature in Celsius. Examples: 23.5, -10.2.",
435
- Units: "\xb0C"
435
+ Units: "\u00B0C"
436
436
  },
437
437
  /**
438
438
  * Humidity (Float)
@@ -147,9 +147,9 @@ function _ts_generator(thisArg, body) {
147
147
  };
148
148
  }
149
149
  }
150
- import xml2js from "xml2js";
151
- import { readFile } from "node:fs/promises";
152
- import path from "node:path";
150
+ import xml2js from 'xml2js';
151
+ import { readFile } from 'node:fs/promises';
152
+ import path from 'node:path';
153
153
  /**
154
154
  * From XML to JSON
155
155
  */ export var fromXML2JSON = function() {
@@ -170,7 +170,7 @@ import path from "node:path";
170
170
  _ = xml2js.parseStringPromise;
171
171
  return [
172
172
  4,
173
- readFile(subDir("lwm2m", "".concat(id, ".xml")), "utf-8")
173
+ readFile(subDir('lwm2m', "".concat(id, ".xml")), 'utf-8')
174
174
  ];
175
175
  case 1:
176
176
  return [
@@ -1,5 +1,5 @@
1
- import { definitions } from "./definitions.js";
2
- import { timestampResources } from "./timestampResources.js";
1
+ import { definitions } from './definitions.js';
2
+ import { timestampResources } from './timestampResources.js';
3
3
  export var instanceTs = function(instance) {
4
4
  var definition = definitions[instance.ObjectID];
5
5
  var tsResourceId = timestampResources[definition.ObjectID]// All registered objects must have a timestamp resource
@@ -1,16 +1,16 @@
1
- import { describe, it } from "node:test";
2
- import assert from "node:assert/strict";
3
- import { instanceTs } from "./instanceTs.js";
4
- void describe("instanceTs()", function() {
5
- void it("should return the timestamp of the instance", function() {
1
+ import { describe, it } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { instanceTs } from './instanceTs.js';
4
+ void describe('instanceTs()', function() {
5
+ void it('should return the timestamp of the instance', function() {
6
6
  return assert.equal(instanceTs({
7
7
  ObjectID: 14210,
8
- ObjectVersion: "1.0",
8
+ ObjectVersion: '1.0',
9
9
  Resources: {
10
- "0": 3.5399999618530273,
11
- "1": 4.168000221252441,
12
- "99": "2024-02-23T10:18:20.474Z"
10
+ '0': 3.5399999618530273,
11
+ '1': 4.168000221252441,
12
+ '99': '2024-02-23T10:18:20.474Z'
13
13
  }
14
- }).getTime(), new Date("2024-02-23T10:18:20.474Z").getTime());
14
+ }).getTime(), new Date('2024-02-23T10:18:20.474Z').getTime());
15
15
  });
16
16
  });
@@ -1,3 +1,3 @@
1
- import { validators } from "./validators.js";
2
- import { validate } from "./validate.js";
1
+ import { validators } from './validators.js';
2
+ import { validate } from './validate.js';
3
3
  export var isRegisteredLwM2MObject = validate(validators);
@@ -1,11 +1,11 @@
1
- import { describe, it } from "node:test";
2
- import assert from "node:assert/strict";
3
- import { isRegisteredLwM2MObject } from "./isRegisteredLwM2MObject.js";
4
- void describe("isRegisteredLwM2MObject()", function() {
5
- void it("should validate a LwM2M object", function() {
1
+ import { describe, it } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { isRegisteredLwM2MObject } from './isRegisteredLwM2MObject.js';
4
+ void describe('isRegisteredLwM2MObject()', function() {
5
+ void it('should validate a LwM2M object', function() {
6
6
  var o = {
7
7
  ObjectID: 14201,
8
- ObjectVersion: "1.0",
8
+ ObjectVersion: '1.0',
9
9
  Resources: {
10
10
  0: 33.98771459323253,
11
11
  1: -84.50632147267358,
@@ -13,29 +13,29 @@ void describe("isRegisteredLwM2MObject()", function() {
13
13
  3: 11.317643165588379,
14
14
  4: 0.03478508070111275,
15
15
  5: 90.31222534179688,
16
- 6: "GNSS",
16
+ 6: 'GNSS',
17
17
  99: new Date(1699049744000)
18
18
  }
19
19
  };
20
20
  assert.equal(isRegisteredLwM2MObject(o), true);
21
21
  });
22
- void it("should validate a LwM2M object with optional resources", function() {
22
+ void it('should validate a LwM2M object with optional resources', function() {
23
23
  var o = {
24
24
  ObjectID: 14201,
25
- ObjectVersion: "1.0",
25
+ ObjectVersion: '1.0',
26
26
  Resources: {
27
27
  0: 33.98771459323253,
28
28
  1: -84.50632147267358,
29
- 6: "GNSS",
29
+ 6: 'GNSS',
30
30
  99: new Date(1699049744000)
31
31
  }
32
32
  };
33
33
  assert.equal(isRegisteredLwM2MObject(o), true);
34
34
  });
35
- void it("should not validate an unknown LwM2M object", function() {
35
+ void it('should not validate an unknown LwM2M object', function() {
36
36
  var o = {
37
37
  ObjectID: 666,
38
- ObjectVersion: "1.0",
38
+ ObjectVersion: '1.0',
39
39
  Resources: {
40
40
  0: 42
41
41
  }
@@ -1,4 +1,4 @@
1
- import { RangeEnumerationRegExp } from "./LWM2MObjectDefinition.js";
1
+ import { RangeEnumerationRegExp } from './LWM2MObjectDefinition.js';
2
2
  export var parseRangeEnumeration = function(re) {
3
3
  var match = RangeEnumerationRegExp.exec(re);
4
4
  if (match === null) return {
@@ -1,10 +1,10 @@
1
- import { describe, it } from "node:test";
2
- import assert from "node:assert/strict";
3
- import { parseRangeEnumeration } from "./parseRangeEnumeration.js";
4
- import { RangeEnumerationRegExp } from "./LWM2MObjectDefinition.js";
5
- void describe("parseRangeEnumeration()", function() {
6
- void it("should parse valid range enumeration", function() {
7
- var result = parseRangeEnumeration("1..10");
1
+ import { describe, it } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { parseRangeEnumeration } from './parseRangeEnumeration.js';
4
+ import { RangeEnumerationRegExp } from './LWM2MObjectDefinition.js';
5
+ void describe('parseRangeEnumeration()', function() {
6
+ void it('should parse valid range enumeration', function() {
7
+ var result = parseRangeEnumeration('1..10');
8
8
  assert.deepEqual(result, {
9
9
  range: {
10
10
  min: 1,
@@ -12,14 +12,14 @@ void describe("parseRangeEnumeration()", function() {
12
12
  }
13
13
  });
14
14
  });
15
- void it("should handle invalid range enumeration", function() {
16
- var result = parseRangeEnumeration("10..1");
15
+ void it('should handle invalid range enumeration', function() {
16
+ var result = parseRangeEnumeration('10..1');
17
17
  assert.deepEqual(result, {
18
18
  error: new Error("'min' must be smaller than 'max' in RangeEnumeration '10..1'!")
19
19
  });
20
20
  });
21
- void it("should handle invalid input", function() {
22
- var result = parseRangeEnumeration("invalid");
21
+ void it('should handle invalid input', function() {
22
+ var result = parseRangeEnumeration('invalid');
23
23
  assert.deepEqual(result, {
24
24
  error: new Error("Could not match 'invalid' against ".concat(RangeEnumerationRegExp, "!"))
25
25
  });
@@ -99,10 +99,10 @@ function _unsupported_iterable_to_array(o, minLen) {
99
99
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
100
100
  }
101
101
  export var unwrapNestedArray = function(object) {
102
- if (typeof object === "string") return object;
102
+ if (typeof object === 'string') return object;
103
103
  return Object.entries(object).reduce(function(result, param) {
104
104
  var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
105
- if (typeof v === "string") return _object_spread_props(_object_spread({}, result), _define_property({}, k, v));
105
+ if (typeof v === 'string') return _object_spread_props(_object_spread({}, result), _define_property({}, k, v));
106
106
  if (Array.isArray(v)) {
107
107
  if (v.length === 1) {
108
108
  return _object_spread_props(_object_spread({}, result), _define_property({}, k, unwrapNestedArray(v[0])));