iotagent-node-lib 4.11.0 → 4.12.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/Changelog CHANGED
@@ -1,3 +1,8 @@
1
+ 4.12.0 (Jan 28th, 2026)
2
+
3
+ - Fix: set default value for defaultTransport to allow set polling and transport for autoprovisioned devices when no IOTA_DEFAULT_TRANSPORT en var is used (#1751)
4
+ - Fix: allow match auto-provisioned devices and groups when the same type is used by several groups (which always uses different apikeys) (#1713)
5
+
1
6
  4.11.0 (Oct 23th, 2025)
2
7
 
3
8
  - Add: IOTA_MONGO_URI env var
package/doc/deprecated.md CHANGED
@@ -12,7 +12,8 @@ longer. In particular:
12
12
 
13
13
  A list of deprecated features and the version in which they were deprecated follows:
14
14
 
15
- - Config `mongodb.*` different from `mongodb.uri` (and associated env vars `IOTA_MONGO_*` except `IOTA_MONGO_URI`) in 4.11.0
15
+ - Config `mongodb.*` different from `mongodb.uri` (and associated env vars `IOTA_MONGO_*` except `IOTA_MONGO_URI`) in
16
+ 4.11.0
16
17
  - Support to NGSI v1 (finally removed in 2.18.0)
17
18
  - Support to Node.js v4 in iotagent-node-lib 2.8.1 (finally removed in 2.9.0)
18
19
  - Support to Node.js v6 in iotagent-node-lib 2.9.0 (finally removed in 2.10.0)
@@ -51,31 +52,31 @@ information in the case you want to use old versions:
51
52
 
52
53
  The following table provides information about the last iotagent-node-lib version supporting currently removed features:
53
54
 
54
- | **Removed feature** | **Last iotagent-node-lib version supporting feature** | **That version release date** |
55
- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------- |
56
- | NGSI v1 API | 2.17.0 | August 30th, 2021 |
57
- | Support to Node.js v4 | 2.8.1 | December 19th, 2018 |
58
- | Support to Node.js v6 | 2.9.0 | May 22nd, 2019 |
59
- | Support to Node.js v8 | 2.12.0 | April 7th, 2020 |
60
- | Support to Node.js v10 | 2.15.0 | February 18th, 2021 |
61
- | Support to Node.js v12 | 2.24.0 | September 2nd, 2022 |
62
- | Support to Node.js v14 | 3.0.0 | March 30th, 2023 |
63
- | Support to Node.js v16 | 4.9.0 | August 22nd, 2025 |
64
- | Support to Node.js v18 | 4.9.0 | August 22nd, 2025 |
65
- | Support to NGSI-LD 1.3 | 2.25.0 | January 24th, 2023 |
66
- | eventType configuration | 2.26.0 | March 15th, 2023 |
67
- | Support to Legacy Expressions | 3.1.0 | April 25th, 2023 |
68
- | bidirectional plugin | 3.3.0 | August 24th, 2023 |
69
- | appendMode configuration (`IOTA_APPEND_MODE` env var) | 3.3.0 | August 24th, 2023 |
70
- | push-mode stats | 4.5.0 | June 11th, 2024 |
71
- | config `mongodb.host` (env var `IOTA_MONGO_HOST`) | Not yet | Not yet |
72
- | config `mongodb.port` (env var `IOTA_MONGO_PORT`) | Not yet | Not yet |
73
- | config `mongodb.db` (env var `IOTA_MONGO_DB`) | Not yet | Not yet |
74
- | config `mongodb.replicaSet` (env var `IOTA_MONGO_REPLICASET`) | Not yet | Not yet |
75
- | config `mongodb.user` (env var `IOTA_MONGO_USER`) | Not yet | Not yet |
76
- | config `mongodb.password` (env var `IOTA_MONGO_PASSWORD`) | Not yet | Not yet |
77
- | config `mongodb.authSource` (env var `IOTA_MONGO_AUTH_SOURCE`) | Not yet | Not yet |
78
- | config `mongodb.retries` (env var `IOTA_MONGO_RETRIES`) | Not yet | Not yet |
79
- | config `mongodb.retryTime` (env var `IOTA_MONGO_RETRY_TIME`) | Not yet | Not yet |
80
- | config `mongodb.ssl` (env var `IOTA_MONGO_SSL`) | Not yet | Not yet |
81
- | config `mongodb.extraArgs` (env var `IOTA_MONGO_EXTRAARGS`) | Not yet | Not yet |
55
+ | **Removed feature** | **Last iotagent-node-lib version supporting feature** | **That version release date** |
56
+ | -------------------------------------------------------------- | ----------------------------------------------------- | ----------------------------- |
57
+ | NGSI v1 API | 2.17.0 | August 30th, 2021 |
58
+ | Support to Node.js v4 | 2.8.1 | December 19th, 2018 |
59
+ | Support to Node.js v6 | 2.9.0 | May 22nd, 2019 |
60
+ | Support to Node.js v8 | 2.12.0 | April 7th, 2020 |
61
+ | Support to Node.js v10 | 2.15.0 | February 18th, 2021 |
62
+ | Support to Node.js v12 | 2.24.0 | September 2nd, 2022 |
63
+ | Support to Node.js v14 | 3.0.0 | March 30th, 2023 |
64
+ | Support to Node.js v16 | 4.9.0 | August 22nd, 2025 |
65
+ | Support to Node.js v18 | 4.9.0 | August 22nd, 2025 |
66
+ | Support to NGSI-LD 1.3 | 2.25.0 | January 24th, 2023 |
67
+ | eventType configuration | 2.26.0 | March 15th, 2023 |
68
+ | Support to Legacy Expressions | 3.1.0 | April 25th, 2023 |
69
+ | bidirectional plugin | 3.3.0 | August 24th, 2023 |
70
+ | appendMode configuration (`IOTA_APPEND_MODE` env var) | 3.3.0 | August 24th, 2023 |
71
+ | push-mode stats | 4.5.0 | June 11th, 2024 |
72
+ | config `mongodb.host` (env var `IOTA_MONGO_HOST`) | Not yet | Not yet |
73
+ | config `mongodb.port` (env var `IOTA_MONGO_PORT`) | Not yet | Not yet |
74
+ | config `mongodb.db` (env var `IOTA_MONGO_DB`) | Not yet | Not yet |
75
+ | config `mongodb.replicaSet` (env var `IOTA_MONGO_REPLICASET`) | Not yet | Not yet |
76
+ | config `mongodb.user` (env var `IOTA_MONGO_USER`) | Not yet | Not yet |
77
+ | config `mongodb.password` (env var `IOTA_MONGO_PASSWORD`) | Not yet | Not yet |
78
+ | config `mongodb.authSource` (env var `IOTA_MONGO_AUTH_SOURCE`) | Not yet | Not yet |
79
+ | config `mongodb.retries` (env var `IOTA_MONGO_RETRIES`) | Not yet | Not yet |
80
+ | config `mongodb.retryTime` (env var `IOTA_MONGO_RETRY_TIME`) | Not yet | Not yet |
81
+ | config `mongodb.ssl` (env var `IOTA_MONGO_SSL`) | Not yet | Not yet |
82
+ | config `mongodb.extraArgs` (env var `IOTA_MONGO_EXTRAARGS`) | Not yet | Not yet |
@@ -368,6 +368,12 @@ function processEnvironmentVariables() {
368
368
  // Default transport
369
369
  if (process.env.IOTA_DEFAULT_TRANSPORT !== undefined) {
370
370
  config.defaultTransport = process.env.IOTA_DEFAULT_TRANSPORT;
371
+ } else {
372
+ // defaultTransport is "MQTT" by default even when no ENV VAR is used
373
+ // and should be available in iotagent-library to allow
374
+ // set polling and transport for autoprovisioned devices
375
+ // at lib/services/devices/deviceService.js#L302
376
+ config.defaultTransport = 'MQTT';
371
377
  }
372
378
 
373
379
  // Default explicitAttrs
@@ -168,7 +168,21 @@ function executeWithDeviceInformation(operationFunction) {
168
168
  deviceInformation
169
169
  );
170
170
  const currentType = type ? type : deviceInformation.type;
171
- config.getGroupRegistry().getTypeSilently(currentType, function (error, deviceGroup) {
171
+
172
+ function getConfiguration(currentType, deviceInformation, callback) {
173
+ config
174
+ .getGroupRegistry()
175
+ .getSilently(deviceInformation.resource, deviceInformation.apikey, function (error, deviceGroup) {
176
+ if (error) {
177
+ config.getGroupRegistry().getTypeSilently(currentType, function (error, deviceGroup) {
178
+ callback(error, deviceGroup);
179
+ });
180
+ } else {
181
+ callback(null, deviceGroup);
182
+ }
183
+ });
184
+ }
185
+ getConfiguration(currentType, deviceInformation, function (error, deviceGroup) {
172
186
  let typeInformation;
173
187
  const configDeviceInfo = config.getConfig().types[currentType];
174
188
  if (error) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "iotagent-node-lib",
3
3
  "license": "AGPL-3.0-only",
4
4
  "description": "IoT Agent library to interface with NGSI Context Broker",
5
- "version": "4.11.0",
5
+ "version": "4.12.0",
6
6
  "homepage": "https://github.com/telefonicaid/iotagent-node-lib",
7
7
  "keywords": [
8
8
  "fiware",
@@ -2235,6 +2235,79 @@ const testCases = [
2235
2235
  }
2236
2236
  ]
2237
2237
  },
2238
+ {
2239
+ describeName: '0201 - Simple groups with commands',
2240
+ provision: {
2241
+ url: 'http://localhost:' + config.iota.server.port + '/iot/services',
2242
+ method: 'POST',
2243
+ json: {
2244
+ services: [
2245
+ {
2246
+ resource: '/iot/json',
2247
+ apikey: globalEnv.apikey,
2248
+ entity_type: globalEnv.entity_type,
2249
+ commands: [
2250
+ {
2251
+ name: 'cmd1',
2252
+ type: 'command'
2253
+ }
2254
+ ],
2255
+ endpoint: 'http://myendpoint.com',
2256
+ transport: 'http',
2257
+ lazy: [],
2258
+ attributes: [],
2259
+ static_attributes: []
2260
+ },
2261
+ {
2262
+ resource: '/iot/json',
2263
+ apikey: globalEnv.apikey + 'OTHER',
2264
+ entity_type: globalEnv.entity_type,
2265
+ commands: [
2266
+ {
2267
+ name: 'cmd1',
2268
+ type: 'command'
2269
+ }
2270
+ ],
2271
+ transport: 'mqtt',
2272
+ lazy: [],
2273
+ attributes: [],
2274
+ static_attributes: []
2275
+ }
2276
+ ]
2277
+ },
2278
+ headers: {
2279
+ 'fiware-service': globalEnv.service,
2280
+ 'fiware-servicepath': globalEnv.servicePath
2281
+ }
2282
+ },
2283
+ should: [
2284
+ {
2285
+ shouldName:
2286
+ 'A - WHEN sending not provisioned object_ids (measures) through http IT should store commands into Context Broker',
2287
+ type: 'single',
2288
+ skip: '!lib', // there is not CB registration mock
2289
+ measure: {
2290
+ url: 'http://localhost:' + config.http.port + '/iot/json',
2291
+ method: 'POST',
2292
+ qs: {
2293
+ i: globalEnv.deviceId,
2294
+ k: globalEnv.apikey
2295
+ },
2296
+ json: {
2297
+ b: 10
2298
+ }
2299
+ },
2300
+ expectation: {
2301
+ id: globalEnv.entity_name,
2302
+ type: globalEnv.entity_type,
2303
+ b: {
2304
+ value: 10,
2305
+ type: 'Text'
2306
+ }
2307
+ }
2308
+ }
2309
+ ]
2310
+ },
2238
2311
  // 0300 - STATIC ATTRIBUTES TESTS
2239
2312
  {
2240
2313
  describeName:
@@ -243,7 +243,7 @@ describe('NGSI-v2 - In memory device registry', function () {
243
243
  should.exist(device.type);
244
244
  device.name.should.equal('name5');
245
245
  device.type.should.equal('Light5');
246
- Object.keys(device).length.should.equal(13);
246
+ Object.keys(device).length.should.equal(14);
247
247
  done();
248
248
  });
249
249
  });