iotagent-node-lib 3.4.1 → 3.4.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.
@@ -343,7 +343,8 @@ function sendUpdateValueNgsi2(entityName, attributes, typeInformation, token, ca
343
343
  const payload = {
344
344
  entities: [
345
345
  {
346
- id: entityName
346
+ // CB entity id should be always a String
347
+ id: String(entityName)
347
348
  }
348
349
  ]
349
350
  };
@@ -351,7 +352,8 @@ function sendUpdateValueNgsi2(entityName, attributes, typeInformation, token, ca
351
352
  let url = '/v2/op/update';
352
353
 
353
354
  if (typeInformation && typeInformation.type) {
354
- payload.entities[0].type = typeInformation.type;
355
+ // CB entity type should be always a String
356
+ payload.entities[0].type = String(typeInformation.type);
355
357
  }
356
358
 
357
359
  payload.actionType = 'append';
@@ -677,8 +679,9 @@ function sendUpdateValueNgsi2(entityName, attributes, typeInformation, token, ca
677
679
  logger.debug(context, 'sendUpdateValueNgsi2 entityNameExp %j ', typeInformation.entityNameExp);
678
680
  entityName = expressionPlugin.applyExpression(typeInformation.entityNameExp, ctxt, typeInformation);
679
681
  // CB entity id should be always a String
680
- payload.entities[0].id = String(entityName);
681
- ctxt['entity_name'] = String(entityName);
682
+ entityName = String(entityName);
683
+ payload.entities[0].id = entityName;
684
+ ctxt['entity_name'] = entityName;
682
685
  } catch (e) {
683
686
  logger.debug(
684
687
  context,
@@ -831,10 +834,10 @@ function sendUpdateValueNgsi2(entityName, attributes, typeInformation, token, ca
831
834
  payload
832
835
  );
833
836
  }
834
-
837
+ // CB entity id and type should be always a String
835
838
  let newEntity = {
836
- id: newEntityName ? newEntityName : payload.entities[0].id,
837
- type: attr.entity_type ? attr.entity_type : payload.entities[0].type
839
+ id: newEntityName ? String(newEntityName) : String(payload.entities[0].id),
840
+ type: attr.entity_type ? String(attr.entity_type) : String(payload.entities[0].type)
838
841
  };
839
842
  // Check if there is already a newEntity created
840
843
  const alreadyEntity = payload.entities.find((entity) => {
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": "3.4.1",
5
+ "version": "3.4.3",
6
6
  "homepage": "https://github.com/telefonicaid/iotagent-node-lib",
7
7
  "keywords": [
8
8
  "fiware",