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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@texturehq/events

v1.10.1

Published

The library of Texture events.

Readme

@texturehq/events

npm version

This package contains the official TypeScript definitions and Zod schemas for all Texture webhook events. It's designed to help you build type-safe integrations with Texture's webhook system.

Features

  • Type definitions and Zod schemas for all Texture webhook events
  • Version-controlled event schemas with access to all historical versions
  • Runtime validation using Zod
  • Full TypeScript support

Available Events

The following webhook events are supported:

Device Events

  • device.connected - Emitted when a device connects to Texture
  • device.disconnected - Emitted when a device disconnects
  • device.discovered - Emitted when a new device is discovered
  • device.updated - Emitted when device properties are updated

Command Events

  • command.succeeded - Emitted when a device command completes successfully
  • command.failed - Emitted when a device command fails

Connection Events

  • connection.failed - Emitted when a device connection attempt fails

Customer Events

  • customer.created - Emitted when a new customer is created
  • customer.updated - Emitted when customer information is updated
  • customer.deleted - Emitted when a customer is deleted

Site Events

  • site.created - Emitted when a new site is created
  • site.updated - Emitted when site information is updated
  • site.deleted - Emitted when a site is deleted

Enrollment Events

  • enrollment.submitted - Emitted when a new enrollment is submitted
  • enrollment.approved - Emitted when an enrollment is approved
  • enrollment.rejected - Emitted when an enrollment is rejected

Installation

npm install @texturehq/events
# or
yarn add @texturehq/events

Usage

Latest Version

Each event type has a named export that always points to its latest version. This is the recommended way to use the package:

import { DeviceConnectedEventSchema, DeviceConnectedEvent } from "@texturehq/events";

// Example webhook handler
const handleWebhook = (event: unknown) => {
  try {
    // Validate and type the event using latest version
    const parsedEvent = DeviceConnectedEventSchema.parse(event);
    
    // TypeScript knows this is a DeviceConnectedEvent
    console.log(parsedEvent.data.deviceId);
  } catch (error) {
    // Handle validation error
    console.error("Invalid event format", error);
  }
};

Version-Specific Usage

All event schemas are versioned, and you can access any specific version directly. This is useful if you need to maintain compatibility with older event versions:

import {
  DeviceConnectedEventSchema_1_0_0,  // Specific version
  DeviceConnectedEvent_1_0_0         // Type for specific version
} from "@texturehq/events";

// Use a specific version of the schema
const handleLegacyWebhook = (event: unknown) => {
  const parsedEvent = DeviceConnectedEventSchema_1_0_0.parse(event);
  // TypeScript knows this is specifically a DeviceConnectedEvent_1_0_0
};

When we make changes to an event schema, we:

  1. Create a new versioned schema (e.g., DeviceConnectedEventSchema_1_1_0)
  2. Update the main export (DeviceConnectedEventSchema) to point to the latest version
  3. Maintain all previous versions for backwards compatibility

Event Structure

All events follow a consistent structure:

{
  type: string;      // The event type (e.g., "device.connected")
  version: string;   // The schema version (e.g., "1.0.0")
  data: {           // Event-specific payload
    // ... event specific fields
  }
}

For more details on these events and webhook integration, consult our docs or contact us.

License

MIT