Validate direct relationships before upload
It is possible to create relationships between entities where one side or the other is not actually present in the collected set, which may be surfaced by the persister as a warning log event, but is really an error situation we want to expose as early in development as possible. Only mapped relationships can refer to an entity that isn't collected in the run.
Provide a command such as j1-integration validate --direct-relationships which walks relationships and verifies that their from/to _key values point to entities that exist in the current collection.
This will likely require #79 is advanced so that entities can be found quickly by _type & _key.
The getEntity() function recently implemented ought make this part a bit easier:
This will likely require #79 is advanced so that entities can be found quickly by _type & _key.
@ndowmon I think we need to reconsider the API of getEntity, to make it take nothing but a _key value. Consider how https://github.com/JupiterOne/sdk/blob/7eadfcece14ee9330297db07c2952e6af0c04675/packages/integration-sdk-runtime/src/execution/jobState.ts#L15 prevents duplicate keys across all values of _type. This is possible because an integration instance is a scope of keys. What do you think?
cc/ @austinkelleher