@hello.nrfcloud.com/proto-map 5.6.2 → 6.0.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.
Files changed (99) hide show
  1. package/README.md +0 -16
  2. package/api/Context.ts +1 -1
  3. package/api/{ResourceUpdate.spec.ts → ObjectUpdate.spec.ts} +5 -5
  4. package/api/{ResourceUpdate.ts → ObjectUpdate.ts} +4 -4
  5. package/dist/api/Context.js +1 -1
  6. package/dist/api/DeviceId.js +7 -7
  7. package/dist/api/Devices.js +11 -11
  8. package/dist/api/History.js +10 -10
  9. package/dist/api/History.spec.js +17 -17
  10. package/dist/api/LwM2M.js +11 -11
  11. package/dist/api/ObjectUpdate.js +17 -0
  12. package/dist/api/ObjectUpdate.spec.js +26 -0
  13. package/dist/api/ShareDeviceOwnershipConfirmed.js +4 -4
  14. package/dist/api/ShareDeviceRequest.js +4 -4
  15. package/dist/api/Timestamp.js +3 -3
  16. package/dist/api/Timestamp.spec.js +9 -9
  17. package/dist/api/index.js +8 -8
  18. package/dist/generator/addDocBlock.js +2 -2
  19. package/dist/generator/generateLwM2MDefinitions.js +27 -27
  20. package/dist/generator/generateLwM2MDefinitions.spec.js +32 -32
  21. package/dist/generator/generateLwm2mTimestampResources.js +7 -7
  22. package/dist/generator/generateModels.js +26 -111
  23. package/dist/generator/generateType.js +21 -21
  24. package/dist/generator/generateValidator.js +29 -29
  25. package/dist/generator/generateValidators.js +9 -9
  26. package/dist/generator/lwm2m.js +23 -23
  27. package/dist/generator/models.js +14 -96
  28. package/dist/generator/printNode.js +2 -2
  29. package/dist/generator/tokenizeName.js +2 -2
  30. package/dist/generator/tokenizeName.spec.js +20 -20
  31. package/dist/generator/types.js +37 -37
  32. package/dist/lwm2m/LWM2MObjectDefinition.js +30 -30
  33. package/dist/lwm2m/check-lwm2m-rules.js +34 -34
  34. package/dist/lwm2m/definitions.js +4 -4
  35. package/dist/lwm2m/fromXML2JSON.js +4 -4
  36. package/dist/lwm2m/instanceTs.js +2 -2
  37. package/dist/lwm2m/instanceTs.spec.js +10 -10
  38. package/dist/lwm2m/isRegisteredLwM2MObject.js +2 -2
  39. package/dist/lwm2m/isRegisteredLwM2MObject.spec.js +12 -12
  40. package/dist/lwm2m/parseRangeEnumeration.js +1 -1
  41. package/dist/lwm2m/parseRangeEnumeration.spec.js +11 -11
  42. package/dist/lwm2m/unwrapNestedArray.js +2 -2
  43. package/dist/lwm2m/unwrapNestedArray.spec.js +155 -155
  44. package/dist/lwm2m/validate.js +1 -1
  45. package/dist/lwm2m/validation.js +16 -16
  46. package/dist/markdown/getCodeBlock.js +3 -29
  47. package/dist/markdown/parseREADME.js +5 -5
  48. package/dist/models/check-model-rules.js +16 -106
  49. package/dist/models/models.js +6 -115
  50. package/dist/models/types.js +0 -12
  51. package/dist/senml/SenMLSchema.js +16 -16
  52. package/dist/senml/SenMLSchema.spec.js +11 -11
  53. package/dist/senml/hasValue.js +2 -2
  54. package/dist/senml/hasValue.spec.js +4 -4
  55. package/dist/senml/lwm2mToSenML.js +8 -8
  56. package/dist/senml/lwm2mToSenML.spec.js +42 -42
  57. package/dist/senml/parseResourceId.js +1 -1
  58. package/dist/senml/parseResourceId.spec.js +6 -6
  59. package/dist/senml/senMLtoLwM2M.js +14 -14
  60. package/dist/senml/senMLtoLwM2M.spec.js +53 -53
  61. package/dist/senml/validateSenML.js +2 -2
  62. package/dist/senml/validateSenML.spec.js +11 -11
  63. package/models/README.md +0 -4
  64. package/models/check-model-rules.ts +1 -90
  65. package/models/models.ts +1 -8
  66. package/models/types.ts +0 -16
  67. package/package.json +5 -10
  68. package/dist/api/ResourceUpdate.js +0 -17
  69. package/dist/api/ResourceUpdate.spec.js +0 -26
  70. package/dist/generator/isDir.js +0 -163
  71. package/dist/generator/isDir.spec.js +0 -212
  72. package/dist/markdown/getFrontMatter.js +0 -15
  73. package/dist/models/asset_tracker_v2+AWS/examples/examples.spec.js +0 -489
  74. package/models/PCA20035+solar/README.md +0 -10
  75. package/models/PCA20035+solar/transforms/airQuality.md +0 -48
  76. package/models/PCA20035+solar/transforms/battery.md +0 -46
  77. package/models/PCA20035+solar/transforms/button.md +0 -45
  78. package/models/PCA20035+solar/transforms/deviceInfo.md +0 -72
  79. package/models/PCA20035+solar/transforms/gain.md +0 -45
  80. package/models/PCA20035+solar/transforms/geolocationFromGroundfix.md +0 -67
  81. package/models/PCA20035+solar/transforms/geolocationFromMessage.md +0 -80
  82. package/models/PCA20035+solar/transforms/humidity.md +0 -43
  83. package/models/PCA20035+solar/transforms/networkInfo.md +0 -84
  84. package/models/PCA20035+solar/transforms/pressure.md +0 -43
  85. package/models/PCA20035+solar/transforms/temperature.md +0 -43
  86. package/models/asset_tracker_v2+AWS/README.md +0 -6
  87. package/models/asset_tracker_v2+AWS/examples/examples.spec.ts +0 -229
  88. package/models/asset_tracker_v2+AWS/examples/shadow/example-1.json +0 -24
  89. package/models/asset_tracker_v2+AWS/examples/shadow/example-2.json +0 -30
  90. package/models/asset_tracker_v2+AWS/examples/shadow/example-3.json +0 -37
  91. package/models/asset_tracker_v2+AWS/examples/shadow/example-4.json +0 -48
  92. package/models/asset_tracker_v2+AWS/examples/shadow/example-5.json +0 -43
  93. package/models/asset_tracker_v2+AWS/transforms/GNSS.md +0 -66
  94. package/models/asset_tracker_v2+AWS/transforms/battery-voltage.md +0 -50
  95. package/models/asset_tracker_v2+AWS/transforms/device-info.md +0 -61
  96. package/models/asset_tracker_v2+AWS/transforms/env.md +0 -69
  97. package/models/asset_tracker_v2+AWS/transforms/fuel-gauge.md +0 -62
  98. package/models/asset_tracker_v2+AWS/transforms/roam.md +0 -100
  99. package/models/asset_tracker_v2+AWS/transforms/solar.md +0 -58
@@ -1,254 +1,254 @@
1
- import { describe, it } from "node:test";
2
- import assert from "node:assert/strict";
3
- import { unwrapNestedArray } from "./unwrapNestedArray.js";
4
- void describe("unwrapNestedArray()", function() {
5
- void it("should unwrap an array", function() {
1
+ import { describe, it } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { unwrapNestedArray } from './unwrapNestedArray.js';
4
+ void describe('unwrapNestedArray()', function() {
5
+ void it('should unwrap an array', function() {
6
6
  return assert.deepEqual(unwrapNestedArray({
7
7
  LWM2M: {
8
8
  $: {
9
- "xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
10
- "xsi:noNamespaceSchemaLocation": "http://www.openmobilealliance.org/tech/profiles/LWM2M-v1_1.xsd"
9
+ 'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
10
+ 'xsi:noNamespaceSchemaLocation': 'http://www.openmobilealliance.org/tech/profiles/LWM2M-v1_1.xsd'
11
11
  },
12
12
  Object: [
13
13
  {
14
14
  $: {
15
- ObjectType: "MODefinition"
15
+ ObjectType: 'MODefinition'
16
16
  },
17
17
  Name: [
18
- "Location"
18
+ 'Location'
19
19
  ],
20
20
  Description1: [
21
- "This LwM2M Object provides a range of location telemetry related information which can be queried by the LwM2M Server."
21
+ 'This LwM2M Object provides a range of location telemetry related information which can be queried by the LwM2M Server.'
22
22
  ],
23
23
  ObjectID: [
24
- "6"
24
+ '6'
25
25
  ],
26
26
  ObjectURN: [
27
- "urn:oma:lwm2m:oma:6"
27
+ 'urn:oma:lwm2m:oma:6'
28
28
  ],
29
29
  LWM2MVersion: [
30
- "1.0"
30
+ '1.0'
31
31
  ],
32
32
  ObjectVersion: [
33
- "1.0"
33
+ '1.0'
34
34
  ],
35
35
  MultipleInstances: [
36
- "Single"
36
+ 'Single'
37
37
  ],
38
38
  Mandatory: [
39
- "Optional"
39
+ 'Optional'
40
40
  ],
41
41
  Resources: [
42
42
  {
43
43
  Item: [
44
44
  {
45
45
  $: {
46
- ID: "0"
46
+ ID: '0'
47
47
  },
48
48
  Name: [
49
- "Latitude"
49
+ 'Latitude'
50
50
  ],
51
51
  Operations: [
52
- "R"
52
+ 'R'
53
53
  ],
54
54
  MultipleInstances: [
55
- "Single"
55
+ 'Single'
56
56
  ],
57
57
  Mandatory: [
58
- "Mandatory"
58
+ 'Mandatory'
59
59
  ],
60
60
  Type: [
61
- "Float"
61
+ 'Float'
62
62
  ],
63
63
  RangeEnumeration: [
64
- ""
64
+ ''
65
65
  ],
66
66
  Units: [
67
- "lat"
67
+ 'lat'
68
68
  ],
69
69
  Description: [
70
- "The decimal notation of latitude, e.g. -43.5723 [World Geodetic System 1984]."
70
+ 'The decimal notation of latitude, e.g. -43.5723 [World Geodetic System 1984].'
71
71
  ]
72
72
  },
73
73
  {
74
74
  $: {
75
- ID: "1"
75
+ ID: '1'
76
76
  },
77
77
  Name: [
78
- "Longitude"
78
+ 'Longitude'
79
79
  ],
80
80
  Operations: [
81
- "R"
81
+ 'R'
82
82
  ],
83
83
  MultipleInstances: [
84
- "Single"
84
+ 'Single'
85
85
  ],
86
86
  Mandatory: [
87
- "Mandatory"
87
+ 'Mandatory'
88
88
  ],
89
89
  Type: [
90
- "Float"
90
+ 'Float'
91
91
  ],
92
92
  RangeEnumeration: [
93
- ""
93
+ ''
94
94
  ],
95
95
  Units: [
96
- "lon"
96
+ 'lon'
97
97
  ],
98
98
  Description: [
99
- "The decimal notation of longitude, e.g. 153.21760 [World Geodetic System 1984]."
99
+ 'The decimal notation of longitude, e.g. 153.21760 [World Geodetic System 1984].'
100
100
  ]
101
101
  },
102
102
  {
103
103
  $: {
104
- ID: "2"
104
+ ID: '2'
105
105
  },
106
106
  Name: [
107
- "Altitude"
107
+ 'Altitude'
108
108
  ],
109
109
  Operations: [
110
- "R"
110
+ 'R'
111
111
  ],
112
112
  MultipleInstances: [
113
- "Single"
113
+ 'Single'
114
114
  ],
115
115
  Mandatory: [
116
- "Optional"
116
+ 'Optional'
117
117
  ],
118
118
  Type: [
119
- "Float"
119
+ 'Float'
120
120
  ],
121
121
  RangeEnumeration: [
122
- ""
122
+ ''
123
123
  ],
124
124
  Units: [
125
- "m"
125
+ 'm'
126
126
  ],
127
127
  Description: [
128
- "The decimal notation of altitude in meters above sea level."
128
+ 'The decimal notation of altitude in meters above sea level.'
129
129
  ]
130
130
  },
131
131
  {
132
132
  $: {
133
- ID: "3"
133
+ ID: '3'
134
134
  },
135
135
  Name: [
136
- "Radius"
136
+ 'Radius'
137
137
  ],
138
138
  Operations: [
139
- "R"
139
+ 'R'
140
140
  ],
141
141
  MultipleInstances: [
142
- "Single"
142
+ 'Single'
143
143
  ],
144
144
  Mandatory: [
145
- "Optional"
145
+ 'Optional'
146
146
  ],
147
147
  Type: [
148
- "Float"
148
+ 'Float'
149
149
  ],
150
150
  RangeEnumeration: [
151
- ""
151
+ ''
152
152
  ],
153
153
  Units: [
154
- "m"
154
+ 'm'
155
155
  ],
156
156
  Description: [
157
- "The value in this resource indicates the radius of a circular area in meters. The circular area is used to describe uncertainty about a point for coordinates in a two-dimensional coordinate reference systems (CRS). The center point of a circular area is specified by using the Latitude and the Longitude Resources."
157
+ 'The value in this resource indicates the radius of a circular area in meters. The circular area is used to describe uncertainty about a point for coordinates in a two-dimensional coordinate reference systems (CRS). The center point of a circular area is specified by using the Latitude and the Longitude Resources.'
158
158
  ]
159
159
  },
160
160
  {
161
161
  $: {
162
- ID: "4"
162
+ ID: '4'
163
163
  },
164
164
  Name: [
165
- "Velocity"
165
+ 'Velocity'
166
166
  ],
167
167
  Operations: [
168
- "R"
168
+ 'R'
169
169
  ],
170
170
  MultipleInstances: [
171
- "Single"
171
+ 'Single'
172
172
  ],
173
173
  Mandatory: [
174
- "Optional"
174
+ 'Optional'
175
175
  ],
176
176
  Type: [
177
- "Opaque"
177
+ 'Opaque'
178
178
  ],
179
179
  RangeEnumeration: [
180
- ""
180
+ ''
181
181
  ],
182
182
  Units: [
183
- ""
183
+ ''
184
184
  ],
185
185
  Description: [
186
- "The velocity of the LwM2M Client, as defined in [3GPP-TS_23.032]."
186
+ 'The velocity of the LwM2M Client, as defined in [3GPP-TS_23.032].'
187
187
  ]
188
188
  },
189
189
  {
190
190
  $: {
191
- ID: "5"
191
+ ID: '5'
192
192
  },
193
193
  Name: [
194
- "Timestamp"
194
+ 'Timestamp'
195
195
  ],
196
196
  Operations: [
197
- "R"
197
+ 'R'
198
198
  ],
199
199
  MultipleInstances: [
200
- "Single"
200
+ 'Single'
201
201
  ],
202
202
  Mandatory: [
203
- "Mandatory"
203
+ 'Mandatory'
204
204
  ],
205
205
  Type: [
206
- "Time"
206
+ 'Time'
207
207
  ],
208
208
  RangeEnumeration: [
209
- ""
209
+ ''
210
210
  ],
211
211
  Units: [
212
- ""
212
+ ''
213
213
  ],
214
214
  Description: [
215
- "The timestamp of when the location measurement was performed."
215
+ 'The timestamp of when the location measurement was performed.'
216
216
  ]
217
217
  },
218
218
  {
219
219
  $: {
220
- ID: "6"
220
+ ID: '6'
221
221
  },
222
222
  Name: [
223
- "Speed"
223
+ 'Speed'
224
224
  ],
225
225
  Operations: [
226
- "R"
226
+ 'R'
227
227
  ],
228
228
  MultipleInstances: [
229
- "Single"
229
+ 'Single'
230
230
  ],
231
231
  Mandatory: [
232
- "Optional"
232
+ 'Optional'
233
233
  ],
234
234
  Type: [
235
- "Float"
235
+ 'Float'
236
236
  ],
237
237
  RangeEnumeration: [
238
- ""
238
+ ''
239
239
  ],
240
240
  Units: [
241
- "m/s"
241
+ 'm/s'
242
242
  ],
243
243
  Description: [
244
- "Speed is the time rate of change in position of a LwM2M Client without regard for direction: the scalar component of velocity."
244
+ 'Speed is the time rate of change in position of a LwM2M Client without regard for direction: the scalar component of velocity.'
245
245
  ]
246
246
  }
247
247
  ]
248
248
  }
249
249
  ],
250
250
  Description2: [
251
- ""
251
+ ''
252
252
  ]
253
253
  }
254
254
  ]
@@ -256,117 +256,117 @@ void describe("unwrapNestedArray()", function() {
256
256
  }), {
257
257
  LWM2M: {
258
258
  $: {
259
- "xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
260
- "xsi:noNamespaceSchemaLocation": "http://www.openmobilealliance.org/tech/profiles/LWM2M-v1_1.xsd"
259
+ 'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
260
+ 'xsi:noNamespaceSchemaLocation': 'http://www.openmobilealliance.org/tech/profiles/LWM2M-v1_1.xsd'
261
261
  },
262
262
  Object: {
263
263
  $: {
264
- ObjectType: "MODefinition"
264
+ ObjectType: 'MODefinition'
265
265
  },
266
- Name: "Location",
267
- Description1: "This LwM2M Object provides a range of location telemetry related information which can be queried by the LwM2M Server.",
268
- ObjectID: "6",
269
- ObjectURN: "urn:oma:lwm2m:oma:6",
270
- LWM2MVersion: "1.0",
271
- ObjectVersion: "1.0",
272
- MultipleInstances: "Single",
273
- Mandatory: "Optional",
266
+ Name: 'Location',
267
+ Description1: 'This LwM2M Object provides a range of location telemetry related information which can be queried by the LwM2M Server.',
268
+ ObjectID: '6',
269
+ ObjectURN: 'urn:oma:lwm2m:oma:6',
270
+ LWM2MVersion: '1.0',
271
+ ObjectVersion: '1.0',
272
+ MultipleInstances: 'Single',
273
+ Mandatory: 'Optional',
274
274
  Resources: {
275
275
  Item: [
276
276
  {
277
277
  $: {
278
- ID: "0"
278
+ ID: '0'
279
279
  },
280
- Name: "Latitude",
281
- Operations: "R",
282
- MultipleInstances: "Single",
283
- Mandatory: "Mandatory",
284
- Type: "Float",
285
- RangeEnumeration: "",
286
- Units: "lat",
287
- Description: "The decimal notation of latitude, e.g. -43.5723 [World Geodetic System 1984]."
280
+ Name: 'Latitude',
281
+ Operations: 'R',
282
+ MultipleInstances: 'Single',
283
+ Mandatory: 'Mandatory',
284
+ Type: 'Float',
285
+ RangeEnumeration: '',
286
+ Units: 'lat',
287
+ Description: 'The decimal notation of latitude, e.g. -43.5723 [World Geodetic System 1984].'
288
288
  },
289
289
  {
290
290
  $: {
291
- ID: "1"
291
+ ID: '1'
292
292
  },
293
- Name: "Longitude",
294
- Operations: "R",
295
- MultipleInstances: "Single",
296
- Mandatory: "Mandatory",
297
- Type: "Float",
298
- RangeEnumeration: "",
299
- Units: "lon",
300
- Description: "The decimal notation of longitude, e.g. 153.21760 [World Geodetic System 1984]."
293
+ Name: 'Longitude',
294
+ Operations: 'R',
295
+ MultipleInstances: 'Single',
296
+ Mandatory: 'Mandatory',
297
+ Type: 'Float',
298
+ RangeEnumeration: '',
299
+ Units: 'lon',
300
+ Description: 'The decimal notation of longitude, e.g. 153.21760 [World Geodetic System 1984].'
301
301
  },
302
302
  {
303
303
  $: {
304
- ID: "2"
304
+ ID: '2'
305
305
  },
306
- Name: "Altitude",
307
- Operations: "R",
308
- MultipleInstances: "Single",
309
- Mandatory: "Optional",
310
- Type: "Float",
311
- RangeEnumeration: "",
312
- Units: "m",
313
- Description: "The decimal notation of altitude in meters above sea level."
306
+ Name: 'Altitude',
307
+ Operations: 'R',
308
+ MultipleInstances: 'Single',
309
+ Mandatory: 'Optional',
310
+ Type: 'Float',
311
+ RangeEnumeration: '',
312
+ Units: 'm',
313
+ Description: 'The decimal notation of altitude in meters above sea level.'
314
314
  },
315
315
  {
316
316
  $: {
317
- ID: "3"
317
+ ID: '3'
318
318
  },
319
- Name: "Radius",
320
- Operations: "R",
321
- MultipleInstances: "Single",
322
- Mandatory: "Optional",
323
- Type: "Float",
324
- RangeEnumeration: "",
325
- Units: "m",
326
- Description: "The value in this resource indicates the radius of a circular area in meters. The circular area is used to describe uncertainty about a point for coordinates in a two-dimensional coordinate reference systems (CRS). The center point of a circular area is specified by using the Latitude and the Longitude Resources."
319
+ Name: 'Radius',
320
+ Operations: 'R',
321
+ MultipleInstances: 'Single',
322
+ Mandatory: 'Optional',
323
+ Type: 'Float',
324
+ RangeEnumeration: '',
325
+ Units: 'm',
326
+ Description: 'The value in this resource indicates the radius of a circular area in meters. The circular area is used to describe uncertainty about a point for coordinates in a two-dimensional coordinate reference systems (CRS). The center point of a circular area is specified by using the Latitude and the Longitude Resources.'
327
327
  },
328
328
  {
329
329
  $: {
330
- ID: "4"
330
+ ID: '4'
331
331
  },
332
- Name: "Velocity",
333
- Operations: "R",
334
- MultipleInstances: "Single",
335
- Mandatory: "Optional",
336
- Type: "Opaque",
337
- RangeEnumeration: "",
338
- Units: "",
339
- Description: "The velocity of the LwM2M Client, as defined in [3GPP-TS_23.032]."
332
+ Name: 'Velocity',
333
+ Operations: 'R',
334
+ MultipleInstances: 'Single',
335
+ Mandatory: 'Optional',
336
+ Type: 'Opaque',
337
+ RangeEnumeration: '',
338
+ Units: '',
339
+ Description: 'The velocity of the LwM2M Client, as defined in [3GPP-TS_23.032].'
340
340
  },
341
341
  {
342
342
  $: {
343
- ID: "5"
343
+ ID: '5'
344
344
  },
345
- Name: "Timestamp",
346
- Operations: "R",
347
- MultipleInstances: "Single",
348
- Mandatory: "Mandatory",
349
- Type: "Time",
350
- RangeEnumeration: "",
351
- Units: "",
352
- Description: "The timestamp of when the location measurement was performed."
345
+ Name: 'Timestamp',
346
+ Operations: 'R',
347
+ MultipleInstances: 'Single',
348
+ Mandatory: 'Mandatory',
349
+ Type: 'Time',
350
+ RangeEnumeration: '',
351
+ Units: '',
352
+ Description: 'The timestamp of when the location measurement was performed.'
353
353
  },
354
354
  {
355
355
  $: {
356
- ID: "6"
356
+ ID: '6'
357
357
  },
358
- Name: "Speed",
359
- Operations: "R",
360
- MultipleInstances: "Single",
361
- Mandatory: "Optional",
362
- Type: "Float",
363
- RangeEnumeration: "",
364
- Units: "m/s",
365
- Description: "Speed is the time rate of change in position of a LwM2M Client without regard for direction: the scalar component of velocity."
358
+ Name: 'Speed',
359
+ Operations: 'R',
360
+ MultipleInstances: 'Single',
361
+ Mandatory: 'Optional',
362
+ Type: 'Float',
363
+ RangeEnumeration: '',
364
+ Units: 'm/s',
365
+ Description: 'Speed is the time rate of change in position of a LwM2M Client without regard for direction: the scalar component of velocity.'
366
366
  }
367
367
  ]
368
368
  },
369
- Description2: ""
369
+ Description2: ''
370
370
  }
371
371
  }
372
372
  });
@@ -1,4 +1,4 @@
1
- import { isLwM2MObject } from "./validation.js";
1
+ import { isLwM2MObject } from './validation.js';
2
2
  export var validate = function(validators) {
3
3
  return function(o, onError) {
4
4
  if (!isLwM2MObject(o, onError)) {
@@ -55,7 +55,7 @@ function _unsupported_iterable_to_array(o, minLen) {
55
55
  if (n === "Map" || n === "Set") return Array.from(n);
56
56
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
57
57
  }
58
- import { LwM2MObjectIDs } from "./LwM2MObjectID.js";
58
+ import { LwM2MObjectIDs } from './LwM2MObjectID.js';
59
59
  export var isLwM2MObject = function(object, onError) {
60
60
  var _Object_keys_find;
61
61
  var error = function(message) {
@@ -63,15 +63,15 @@ export var isLwM2MObject = function(object, onError) {
63
63
  return false;
64
64
  };
65
65
  // Must be an object
66
- if (typeof object !== "object" || object === null) return error("Not an object");
66
+ if (typeof object !== 'object' || object === null) return error("Not an object");
67
67
  // Must have valid ObjectID
68
- if (!("ObjectID" in object) || typeof object.ObjectID !== "number" || object.ObjectID < 14200 || object.ObjectID > 15000 || LwM2MObjectIDs.includes(object.ObjectID) === false) return error("Not an valid Object ID: ".concat(JSON.stringify(object.ObjectID)));
68
+ if (!('ObjectID' in object) || typeof object.ObjectID !== 'number' || object.ObjectID < 14200 || object.ObjectID > 15000 || LwM2MObjectIDs.includes(object.ObjectID) === false) return error("Not an valid Object ID: ".concat(JSON.stringify(object.ObjectID)));
69
69
  // ObjectVersion must be valid
70
- if ("ObjectVersion" in object) {
71
- if (typeof object.ObjectVersion !== "string" || !/^\d+\.\d+$/.test(object.ObjectVersion)) return error("Invalid ObjectVersion");
70
+ if ('ObjectVersion' in object) {
71
+ if (typeof object.ObjectVersion !== 'string' || !/^\d+\.\d+$/.test(object.ObjectVersion)) return error("Invalid ObjectVersion");
72
72
  }
73
73
  // Must have valid resources
74
- if (!("Resources" in object) || typeof object.Resources !== "object" || object.Resources === null) return error("Resources must be an object");
74
+ if (!('Resources' in object) || typeof object.Resources !== 'object' || object.Resources === null) return error("Resources must be an object");
75
75
  var _Object_keys_find_length;
76
76
  // All keys must be numbers
77
77
  if (((_Object_keys_find_length = (_Object_keys_find = Object.keys(object.Resources).find(function(k) {
@@ -82,10 +82,10 @@ export var isLwM2MObject = function(object, onError) {
82
82
  // All values must be number, string, boolean, or Date
83
83
  for(var _iterator = Object.values(object.Resources)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
84
84
  var v = _step.value;
85
- if (typeof v === "string") continue;
86
- if (typeof v === "boolean") continue;
87
- if (typeof v === "number") continue;
88
- if (typeof v === "object" && _instanceof(v, Date)) continue;
85
+ if (typeof v === 'string') continue;
86
+ if (typeof v === 'boolean') continue;
87
+ if (typeof v === 'number') continue;
88
+ if (typeof v === 'object' && _instanceof(v, Date)) continue;
89
89
  return error("Invalid value type ".concat(typeof v === "undefined" ? "undefined" : _type_of(v)));
90
90
  }
91
91
  } catch (err) {
@@ -113,7 +113,7 @@ export var validate = function(ObjectID, ObjectVersion, Resources) {
113
113
  if (!isLwM2MObject(o, onError)) return false;
114
114
  if (o.ObjectID !== ObjectID) return error("Given Object ID ".concat(o.ObjectID, " does not match expected ").concat(ObjectID));
115
115
  var _o_ObjectVersion;
116
- if (((_o_ObjectVersion = o.ObjectVersion) !== null && _o_ObjectVersion !== void 0 ? _o_ObjectVersion : "1.0") !== ObjectVersion) return error("Given Object version ".concat(o.ObjectVersion, " does not match expected ").concat(ObjectVersion));
116
+ if (((_o_ObjectVersion = o.ObjectVersion) !== null && _o_ObjectVersion !== void 0 ? _o_ObjectVersion : '1.0') !== ObjectVersion) return error("Given Object version ".concat(o.ObjectVersion, " does not match expected ").concat(ObjectVersion));
117
117
  return Object.entries(Resources).reduce(function(allValid, param) {
118
118
  var _param = _sliced_to_array(param, 2), ResourceID = _param[0], validator = _param[1];
119
119
  if (!allValid) return false;
@@ -125,16 +125,16 @@ export var validate = function(ObjectID, ObjectVersion, Resources) {
125
125
  };
126
126
  };
127
127
  export var NumberResource = function(r) {
128
- return typeof r === "number";
128
+ return typeof r === 'number';
129
129
  };
130
130
  export var StringResource = function(r) {
131
- return typeof r === "string";
131
+ return typeof r === 'string';
132
132
  };
133
133
  export var DateResource = function(r) {
134
- return typeof r === "object" && _instanceof(r, Date);
134
+ return typeof r === 'object' && _instanceof(r, Date);
135
135
  };
136
136
  export var BooleanResource = function(r) {
137
- return typeof r === "boolean";
137
+ return typeof r === 'boolean';
138
138
  };
139
139
  export var OptionalResource = function(validator) {
140
140
  return function(r) {
@@ -142,5 +142,5 @@ export var OptionalResource = function(validator) {
142
142
  };
143
143
  };
144
144
  export var isLwM2MObjectID = function(o) {
145
- return typeof o === "number" && LwM2MObjectIDs.includes(o);
145
+ return typeof o === 'number' && LwM2MObjectIDs.includes(o);
146
146
  };