A WorkOS client for node applications in your organization to control and monitor the access of information within your organization.
You can install the WorkOS JS client in your local environment by running:
yarn add @workos-inc/js
To use the client you must provide an API key located from the WorkOS dashboard either as an environment variable
Or you can set it on your own before your application starts:
Creating an Audit Log event requires a descriptive action name and annotating the event with its CRUD identifier. The action name must contain an action category and an action name separated by a period, for example,
The resulting event being sent to WorkOS looks like:
All events are published to WorkOS asynchronously by default and support
await / async behavior.
Adding Metadata To Events
Metadata provides additional context for your Audit Log events that would be helpful to you or others in the future when looking at an Audit Log event. Values for your metadata are expected to be primitive types:
You're allowed to have maps with its elements being any one of the primitive types.
You can add metadata directly to events by appending the
Resulting in the following being sent to WorkOS:
By adding supportive metadata when you create the event you can see what the original tweet body was and what the body was updated to. For something like a tweet that could get updated multiple times over the course of time, you can't always depend on the database representation to tell you what the body has always been. Without logging it right when the change occurs, you'll forever lose all the individual changes along the way. Good Audit Log events attach all supporting information surrounding the event which could be used to inform the reader in the future what exactly happened, how it happened, and when it happened.