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

@naniteninja/cyrano-contracts

v1.2.1

Published

Shared types, enums, interfaces, and schemas for the Cyrano ecosystem

Readme

@naniteninja/cyrano-contracts

Shared TypeScript contracts for the Cyrano ecosystem — the single source of truth (SSOT) for types, enums, interfaces, constants, and JSON schemas used across:

  • cyranoserver (NestJS backend)
  • cyrano (Angular/Ionic frontend)
  • dashboard-components-lib (Angular component library)
  • Cyrano-Android-Blackbox (Python blackbox service)

Centralizing contracts here prevents drift between services (e.g. mismatched socket event names or payload shapes) and gives every consumer the same compiled types and declaration files.

Quick start

Install

Local development (sibling repos in the same workspace):

npm install file:../cyrano-contracts

Published package (when available on npm):

npm install @naniteninja/cyrano-contracts

Build

npm install
npm run build

Usage

Import from the root barrel or subpath exports:

import { ChatSocketEndpoints, WIRE_PROTOCOL_VERSION } from '@naniteninja/cyrano-contracts';
import type { IMessage, ISendMessageChatPayload } from '@naniteninja/cyrano-contracts';
import { MatcherStatuses } from '@naniteninja/cyrano-contracts/enums';
import type { IGatewayRequest } from '@naniteninja/cyrano-contracts/interfaces';

JSON schemas are shipped as source files and can be imported directly:

import chatPayloadSchema from '@naniteninja/cyrano-contracts/schemas/chat-payload.schema.json';

Directory structure

cyrano-contracts/
├── src/
│   ├── enums/           # String enums (socket endpoints, statuses, flags, …)
│   ├── interfaces/      # Payload and domain interfaces (I-prefixed)
│   ├── types/           # Type aliases and unions
│   ├── constants/       # Shared constants (e.g. WIRE_PROTOCOL_VERSION)
│   ├── schemas/         # JSON Schema files for runtime validation
│   ├── __tests__/       # Contract export and alignment tests
│   └── index.ts         # Root barrel export
├── scripts/
│   └── generate-python.ts   # TS → Python Pydantic codegen
├── generated/python/    # Auto-generated Python output (gitignored)
└── dist/                # Compiled CJS, ESM, and .d.ts (gitignored)

Subpath exports

| Export path | Contents | |---|---| | @naniteninja/cyrano-contracts | Enums, interfaces, types, constants | | @naniteninja/cyrano-contracts/enums | Enums only | | @naniteninja/cyrano-contracts/interfaces | Interfaces only | | @naniteninja/cyrano-contracts/types | Type aliases only | | @naniteninja/cyrano-contracts/constants | Constants only | | @naniteninja/cyrano-contracts/schemas/* | JSON Schema files |

Adding new contracts

  1. Add the definition in the appropriate folder:

    • Socket event names → src/enums/<name>.enum.ts
    • Request/response payloads → src/interfaces/<name>.interface.ts
    • Shared literals/unions → src/types/index.ts
    • Runtime validation → src/schemas/<name>.schema.json
  2. Export from the barrel — add a re-export line to the folder's index.ts (e.g. src/enums/index.ts, src/interfaces/index.ts).

  3. Update tests — extend src/__tests__/contracts.spec.ts if you add enums or interfaces that must remain part of the public surface.

  4. Regenerate Python (if Blackbox needs the new types):

    npm run generate:python

    Copy or sync generated/python/ into the Blackbox repo as needed.

  5. Build and verify:

    npm run build
    npm test

Conventions

  • Interfaces use an I prefix (IMessage, IGatewayRequest).
  • Enums use PascalCase names with matching PascalCase string values (e.g. ChatSocketEndpoints.SendMessageChat = 'SendMessageChat').
  • Prefer extending existing enums/interfaces over duplicating shapes in consumer repos.
  • Bump WIRE_PROTOCOL_VERSION in src/constants/index.ts when making breaking payload changes.

Wire serialization

Date-typed fields are domain types; over JSON (HTTP/Socket.IO) they serialize as ISO-8601 strings. Parse at the ingress boundary in each consumer — do not change contract types to string. See docs/WIRE_SERIALIZATION.md.

Python code generation

The Blackbox service runs Python; TypeScript interfaces and enums are mirrored via a codegen script:

npm run generate:python

This writes Pydantic v2 models to generated/python/:

  • enums.py — from src/enums/
  • models.py — from src/interfaces/
  • constants.py — from src/constants/
  • __init__.py — package barrel

The output directory is gitignored. After generation, copy the files into Cyrano-Android-Blackbox (e.g. cyrano_contracts/) and commit there.

Publishing and versioning

The package is published as @naniteninja/cyrano-contracts (scoped, private/unlicensed).

Version bumps

Follow semver:

  • Patch — documentation, non-breaking fixes
  • Minor — new enums/interfaces/schemas (backward compatible)
  • Major — removed or renamed exports, breaking payload or enum value changes

Update version in package.json, then rebuild. The prepublishOnly script runs npm run build automatically before publish.

Publish

npm run build
npm test
npm publish --access restricted

Ensure you are authenticated to the npm registry that hosts @naniteninja packages.

Local linking

Sibling repos currently consume the package via a file dependency:

"@naniteninja/cyrano-contracts": "file:../cyrano-contracts"

After changing contracts locally, run npm run build in this repo, then reinstall or rebuild the consuming project.

Scripts

| Script | Description | |---|---| | npm run build | Compile ESM, CJS, and declaration files to dist/ | | npm run build:types | Emit declaration files only | | npm run generate:python | Generate Python models in generated/python/ | | npm test | Run Jest contract tests | | npm run lint | ESLint (requires eslint to be configured) |