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

auditing-thrift-model

Package Overview
Dependencies
Maintainers
4
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auditing-thrift-model

Thrift model for auditing updates

  • 0.4.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
4
Weekly downloads
 
Created
Source

Thrift model for auditing updates

How to use

Scala

in build.sbt

libraryDependencies ++= Seq(
    "com.gu" %% "auditing-thrift-model" % "0.3.0"
)

somewhere in your code

import com.gu.auditing.model.v1.{App, Notification}

Notification(
    app = App.YourAppHere,
    operation = "EatFruit",
    userEmail = "banana@email.com",
    date = new DateTime().toString(),
    resourceId = Some("apple"),
    message = Some("{json}")
)))

node.js

You'll probably want to use thrift-serializer to handle the messages.

Sending messages

var Notification = require('auditing-thrift-model').Notification;
var App = require('auditing-thrift-model').App;

var message = new Notification({
    app = App.YourAppHere,
    operation = "EatFruit",
    userEmail = "banana@email.com",
    date = (new Date()).toISOString(),
    resourceId = "apple",
    message = JSON.stringify({json})
});

serializer.write(message, serializer.Compression.Gzip, function (err, bytes) {
    // use the buffer somehow
});

Receiving notifications

var serializer = require('thrift-serialize');
var Notification = require('auditing-thrift-model').Notification;

serializer.read(Notification, data, function (err, message) {
    console.log(message.operation, message.date);
    // You can have the full name of the source app calling
    console.log(message.getAppName());
});

Develop

Prerequisites

  • Install thrift using brew install thrift

Add an application

The list of allowed applications is kept as an enum, add new ones in App.

Release

The model is used both by Scala applications and node.js lambda.

  • sbt release to publish a new version on Sonatype
  • npm run compile to compile the model for node.js
  • update the version of package.json it should match the one you just released on Sonatype
  • npm publish ./ to publish the new version on npm

FAQs

Package last updated on 09 Nov 2016

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