-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from statelyai/davidkpiano/context-event-sanit…
…ization Add sanitization
- Loading branch information
Showing
3 changed files
with
144 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
"@statelyai/inspect": minor | ||
--- | ||
|
||
Added new options `sanitizeContext` and `sanitizeEvent` to the inspector configuration. These options allow users to sanitize sensitive data from the context and events before they are sent to the inspector, and also to remove non-serializable data. | ||
|
||
Example usage: | ||
|
||
```typescript | ||
const inspector = createInspector({ | ||
sanitizeContext: (context) => { | ||
// Remove sensitive data from context | ||
const { password, ...safeContext } = context; | ||
return safeContext; | ||
}, | ||
sanitizeEvent: (event) => { | ||
// Remove sensitive data from event | ||
if (event.type === 'SUBMIT_FORM') { | ||
const { creditCardNumber, ...safeEvent } = event; | ||
return safeEvent; | ||
} | ||
return event; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters