npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@govuk-one-login/event-catalogue-utils

v0.3.2

Published

[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=govuk-one-login_event-catalogue-utils&metric=coverage)](https://sonarcloud.io/summary/overall?id=govuk-one-login_event-catalogue-utils)

Downloads

2,427

Readme

Coverage

@govuk-one-login/event-catalogue-utils

Utilities for creating, validating, and sending audit events to TxMA via SQS, in a way that is consistent with the GOV.UK One Login Event Catalogue.

Background

GOV.UK One Login fires audit events throughout the user journey. These get sent to TxMA and some are shared with other pods or relying parties via Shared Signals. Without a consistent format, these events can't be shared reliably. This package wraps the Event Catalogue to make sure events are always valid and consistently structured before they're sent.

Installation

npm install @govuk-one-login/event-catalogue-utils

This package has peer dependencies on the Event Catalogue packages, which are distributed via GitHub Packages. Follow the instructions in the team manual to authenticate with GitHub Packages before installing.

npm install @govuk-one-login/event-catalogue @govuk-one-login/event-catalogue-schemas

API

createEvent(type, entity)

Provides static type-checking that an event matches the Event Catalogue definition for the given event name. Returns the event unchanged.

import { createEvent } from "@govuk-one-login/event-catalogue-utils";

const event = createEvent("AUTH_AUTH_CODE_ISSUED", {
  event_name: "AUTH_AUTH_CODE_ISSUED",
  // ...
});

Use this when you want compile-time safety that your event shape is correct, without sending it anywhere yet.

validateEvent(event)

Validates an event at runtime against its JSON schema from the Event Catalogue. Returns true if valid, false otherwise. Logs errors if validation fails.

import { validateEvent } from "@govuk-one-login/event-catalogue-utils";

if (validateEvent(event)) {
  // event is valid
}

Use this when you receive an event from an external source and need to verify it before processing.

sendEventToSQS(event, queueUrl, options?)

Sends an event to an SQS queue. Creates a default SQS client (eu-west-2) if one is not provided.

import { sendEventToSQS } from "@govuk-one-login/event-catalogue-utils";

await sendEventToSQS(event, process.env.TXMA_QUEUE_URL);

sendToTXMA(type, entity, queueUrl, options?)

The primary function for most use cases. Combines createEvent, validateEvent, and sendEventToSQS into a single call.

import { sendToTXMA } from "@govuk-one-login/event-catalogue-utils";

sendToTXMA("AUTH_AUTH_CODE_ISSUED", event, process.env.TXMA_QUEUE_URL);

customSendToTXMA(queueUrl, options)

Curries the sendToTXMA function with a queue URL and (optional) logParams to provide a reusable simple send-to-TXMA function, which does not need to be passed config every time

import { customSendToTXMA } from "@govuk-one-login/event-catalogue-utils";

const sendEvent = customSendToTXMA(process.env.TXMA_QUEUE_URL, {
  sqsClient: myClient,
  logParams: ["user_id"],
});

sendEvent("AUTH_AUTH_CODE_ISSUED", event);

Options

| Option | Type | Description | |--------|------|-------------| | sqsClient | SQSClient | A custom AWS SQS client. Defaults to a memoized client in eu-west-2. | | logParams | string[] | Keys to extract from the event and include in the success log message. |