New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@retracedhq/retraced

Package Overview
Dependencies
Maintainers
4
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@retracedhq/retraced

The official NodeJS client for interacting with the Retraced audit logging API.

  • 0.7.18
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4K
decreased by-25.21%
Maintainers
4
Weekly downloads
 
Created
Source

retraced-js

CircleCI

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.

Keywords

FAQs

Package last updated on 12 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc