From 3accf3b973eadc74c504ef7edb15e0ee3ce625f8 Mon Sep 17 00:00:00 2001 From: Ronald Arias Date: Tue, 6 Aug 2024 11:21:18 -0500 Subject: [PATCH 1/2] fix device-has->user relationship _key --- src/steps/user/index.ts | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/steps/user/index.ts b/src/steps/user/index.ts index 3101523..e0c0d56 100644 --- a/src/steps/user/index.ts +++ b/src/steps/user/index.ts @@ -41,7 +41,7 @@ export async function buildDeviceHasUserRelationships({ const userSchema = toJsonSchema(user); logger.warn({ userSchema }, `User doesn't have a unique key`); } catch (err) { - // pass + logger.warn({ err }, 'Failed to extract user schema'); } continue; } @@ -49,23 +49,25 @@ export async function buildDeviceHasUserRelationships({ if (!jobState.hasKey(userEntity._key)) { await jobState.addEntity(userEntity); } - await jobState.addRelationship( - createDirectRelationship({ - _class: RelationshipClass.HAS, - from: deviceEntity, - to: userEntity, - properties: { - lastEvent: user.last_event.event, - lastEventStatus: user.last_event.status, - lastEventNpaStatus: user.last_event.npa_status, - lastEventActor: user.last_event.actor, - lastEventOccurredOn: parseTimePropertyValue( - user.last_event.timestamp, - 'ms', - ), - }, - }), - ); + const relationship = createDirectRelationship({ + _class: RelationshipClass.HAS, + from: deviceEntity, + to: userEntity, + properties: { + _key: `${deviceEntity._key}|has|${userEntity._key}-${user._id}`, + lastEvent: user.last_event.event, + lastEventStatus: user.last_event.status, + lastEventNpaStatus: user.last_event.npa_status, + lastEventActor: user.last_event.actor, + lastEventOccurredOn: parseTimePropertyValue( + user.last_event.timestamp, + 'ms', + ), + }, + }); + if (!jobState.hasKey(relationship._key)) { + await jobState.addRelationship(relationship); + } } }, ); From c2acb077068c7385fe73665f34b3456998710a19 Mon Sep 17 00:00:00 2001 From: Ronald Arias Date: Tue, 6 Aug 2024 11:24:23 -0500 Subject: [PATCH 2/2] v1.2.9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 31e541b..a289fc9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jupiterone/graph-netskope", - "version": "1.2.8", + "version": "1.2.9", "description": "A JupiterOne Integration for ingesting data of the Netskope", "repository": { "type": "git",