-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark graph object readonly #1122
Conversation
- Updated the GraphObjectIteratee type to have a readonly entity parameter. When entities are being iterated in the graph store, they should never be modified. This change will indicate what integrations are breaking this pattern. - Add GraphObjectStore test that demonstrates entities are readonly during iteration. This can be ignored to avoid TS errors.
@@ -4,7 +4,7 @@ export interface GraphObjectFilter { | |||
_type: string; | |||
} | |||
|
|||
export type GraphObjectIteratee<T> = (obj: T) => void | Promise<void>; | |||
export type GraphObjectIteratee<T> = (obj: Readonly<T>) => void | Promise<void>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd consider this change a major version bump. Agreed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've decided that since this is enforcing a pre-existing understanding/pattern, it should only be a minor version bump.
@@ -506,6 +506,34 @@ describe('findEntity', () => { | |||
}); | |||
|
|||
describe('iterateEntities', () => { | |||
test('iterated entities are mutable, but only if TS error is ignored.', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍
133dee8
…d within this monorepo. This should improve ability to use alpha packages in the future.
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/@jupiterone/[email protected], npm/@jupiterone/[email protected], npm/@jupiterone/[email protected], npm/@jupiterone/[email protected], npm/@jupiterone/[email protected], npm/@jupiterone/[email protected], npm/@jupiterone/[email protected] |
When graph objects are iterated, mark them as Readonly.
Clean up unnecessary debugging logs.