Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

fix device-has->user relationship _key #27

Merged
merged 2 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
38 changes: 20 additions & 18 deletions src/steps/user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,33 @@ 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;
}
const userEntity = createUserEntity(user);
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);
}
}
},
);
Expand Down
Loading