0.7.16 • Published 10 months ago
@retracedhq/retraced v0.7.16
retraced-js
This is the official NodeJS client for interacting with the Retraced API. Retraced is an "audit logs as a service" provider, allowing developers to easily implement audit logging in their multi-tenant products and services. For more information, see the official website: https://boxyhq.com/audit-logs
Installation
yarn
yarn add @retracedhq/retraced
npm
npm i -s @retracedhq/retraced
Usage
import * as Retraced from "@retracedhq/retraced";
// Initialize the client with your information.
const retraced = new Retraced.Client({
apiKey: "your api key goes here",
projectId: "your project id goes here",
});
// Report some audit events!
async function createNewRecord(request) {
const newRecord = /* transform request into newRecord */
// ... some more business logic here ...
// Now construct the audit event to be reported to Retraced.
const event = {
action: "some.record.created",
group: {
id: "12345",
name: "My Rad Customer",
},
crud: "c",
source_ip: request.ip,
actor: {
id: "ultra.employee@customertowne.xyz",
displayName: "Ultra Employee",
url: "https://customertowne.xyz/employees/123456",
},
target: {
id: newRecord.id,
displayName: newRecord.name,
url: "https://customertowne.xyz/records/" + newRecord.id,
},
};
// The Retraced client's methods are asynchronous.
// You can "fire and forget" them...
retraced.reportEvent(event);
// ... "await" them...
console.log("Reporting...");
await retraced.reportEvent(event);
console.log("Finished reporting!");
// ... or treat them as Promises.
console.log("Reporting...");
retraced.reportEvent(event)
.then(() => { console.log("Finished reporting!"); })
.catch((err) => handleError(err));
}
Next Steps
For more details on the structure of Retraced events, please visit the official documentation.
0.7.15
11 months ago
0.7.16
10 months ago
0.7.13
1 year ago
0.7.12
1 year ago
0.7.14
11 months ago
0.7.11
1 year ago
0.7.10
1 year ago
0.7.9
1 year ago
0.7.8
1 year ago
0.7.7
1 year ago
0.7.6
2 years ago
0.7.5
2 years ago
0.7.4
2 years ago
0.7.2
2 years ago
0.7.1
2 years ago
0.7.0
2 years ago
0.6.2-beta.81
2 years ago
0.6.2-beta.70
2 years ago
0.6.3
2 years ago
0.6.2-beta.67
2 years ago
0.6.2-beta.83
2 years ago
0.6.2-beta.72
2 years ago
0.6.2-beta.74
2 years ago
0.6.2
2 years ago
0.6.1-beta.6
2 years ago
0.6.1-beta.5
2 years ago
0.6.1-beta.4
2 years ago
0.6.1
2 years ago
0.6.0
2 years ago
0.5.1
3 years ago