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

@materi.ai/proto

v0.1.3

Published

Materi Event Schema - TypeScript bindings for Protocol Buffer event definitions

Readme

@materi/proto

TypeScript bindings for Materi Event Schema - Protocol Buffer event definitions for the Materi collaboration platform.

Installation

npm install @materi/proto
# or
yarn add @materi/proto
# or
pnpm add @materi/proto

Usage

Basic Import

import {
    DomainEvent,
    UserCreatedEvent,
    DocumentCreatedEvent,
    Status,
    SourceService,
} from '@materi/proto';

// Create a user event
const event: UserCreatedEvent = {
    userId: 'user-123',
    email: '[email protected]',
    name: 'Alice',
    createdAt: new Date(),
};

Serialization

import { UserCreatedEvent } from '@materi/proto';

// Create event
const event: UserCreatedEvent = {
    userId: 'user-123',
    email: '[email protected]',
    name: 'Alice',
};

// Encode to binary
const bytes = UserCreatedEvent.encode(event).finish();

// Decode from binary
const decoded = UserCreatedEvent.decode(bytes);
console.log(decoded.email); // '[email protected]'

JSON Serialization

import { UserCreatedEvent } from '@materi/proto';

const event: UserCreatedEvent = {
    userId: 'user-123',
    email: '[email protected]',
    name: 'Alice',
};

// To JSON
const json = UserCreatedEvent.toJSON(event);

// From JSON
const parsed = UserCreatedEvent.fromJSON(json);

Domain Event Envelope

import { DomainEvent } from '@materi/proto';

const envelope: DomainEvent = {
    eventId: 'evt-456',
    eventType: 'user.created',
    aggregateId: 'user-123',
    aggregateType: 'user',
    version: 1,
    occurredAt: new Date(),
    publishedAt: new Date(),
    sourceService: 'api',
    userId: 'system',
    correlationId: 'req-789',
    traceId: 'trace-abc',
    spanId: 'span-def',
};

Available Domains

Envelope (Core)

  • DomainEvent - Universal event envelope
  • EventAcknowledgment - Consumer acknowledgment

User Domain

  • UserCreatedEvent
  • UserUpdatedEvent
  • UserDeletedEvent
  • UserLoginEvent
  • UserLogoutEvent
  • UserPasswordChangedEvent
  • UserMFAEnabledEvent
  • UserMFADisabledEvent
  • UserLoginFailedEvent
  • UserLockedEvent
  • UserUnlockedEvent

Document Domain

  • DocumentCreatedEvent
  • DocumentUpdatedEvent
  • DocumentDeletedEvent
  • DocumentSharedEvent

Workspace Domain

  • WorkspaceCreatedEvent
  • WorkspaceUpdatedEvent
  • WorkspaceMemberAddedEvent
  • WorkspaceMemberRemovedEvent
  • WorkspaceDeletedEvent

Collaboration Domain

  • CollaborationSessionStartedEvent
  • CollaborationSessionEndedEvent
  • OperationAppliedEvent
  • PresenceUpdatedEvent
  • ConflictResolvedEvent

Aria (AI/ML) Domain

  • AriaAnalysisStartedEvent
  • AriaAnalysisCompleteEvent
  • AriaAnalysisFailedEvent
  • AriaSafetyGatePassedEvent
  • AriaSafetyGateBlockedEvent

Notification Domain

  • EmailSentEvent
  • EmailDeliveryFailedEvent
  • NotificationPublishedEvent
  • NotificationReadEvent

Audit Domain

  • PermissionDeniedEvent
  • DataAccessLoggedEvent
  • AuditLogCreatedEvent

Shared Types

  • Status - Entity status enum
  • SourceService - Service identifier enum
  • PermissionLevel - Permission level enum
  • OperationType - Operation type enum
  • EventMetadata - Event metadata
  • AggregateMetadata - Aggregate metadata
  • SchemaMetadata - Schema metadata

Direct Domain Access

For granular imports:

// Import from specific domain
import { UserCreatedEvent } from '@materi/proto/domains/user';
import { DocumentCreatedEvent } from '@materi/proto/domains/document';

TypeScript Support

This package includes full TypeScript type definitions:

import type { UserCreatedEvent, DomainEvent } from '@materi/proto';

function processEvent(event: DomainEvent): void {
    console.log(event.eventId);
}

function createUser(data: Partial<UserCreatedEvent>): UserCreatedEvent {
    return {
        userId: data.userId ?? '',
        email: data.email ?? '',
        name: data.name ?? '',
        ...data,
    };
}

Module Formats

This package supports both ESM and CommonJS:

// ESM
import { UserCreatedEvent } from '@materi/proto';

// CommonJS
const { UserCreatedEvent } = require('@materi/proto');

Development

Regenerate from Proto

# From ts/ directory
npm run generate

# Or from root
make compile-ts

Build

npm run build

Type Check

npm run typecheck

Requirements

  • Node.js >= 18.0.0
  • TypeScript >= 5.0 (for development)

Related Packages

  • Go: github.com/materi/domain/proto
  • Python: materi-proto (PyPI)

License

MIT