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

@trigora/contracts

v0.3.0

Published

Shared Trigora type contracts for flows, triggers, events, and deployment payloads.

Downloads

1,443

Readme

@trigora/contracts

Shared public contracts for Trigora.

@trigora/contracts is the shared contracts layer used across Trigora packages and advanced integrations.

Most users should start with:

  • trigora for CLI usage
  • @trigora/sdk for defining flows

This package is mainly intended for:

  • typed API clients
  • advanced integrations
  • tooling that consumes Trigora responses

If you are authoring flows directly, you will usually want @trigora/sdk instead.

Install

npm install @trigora/contracts

What This Package Covers

This package exports public contracts for:

  • triggers
  • flow definitions
  • flow events and runtime context
  • deployment request and response payloads
  • structured API errors
  • hosted flow management responses

Everything is exported from the package root:

import type {
  ApiErrorResponse,
  CreateDeploymentRequest,
  CreateDeploymentResponse,
  FlowDefinition,
  FlowRecord,
  FlowStatusResponse,
  Trigger,
} from '@trigora/contracts';

Flow Authoring Contracts

These contracts define the core shape of Trigora flows:

  • ManualTrigger
  • WebhookTrigger
  • CronTrigger
  • Trigger
  • FlowDefinition
  • FlowRunFn
  • FlowEvent
  • FlowContext
  • JsonValue
  • WebhookFlowResult

For webhook flows, FlowEvent can also include request metadata with headers, method, URL, and rawBody in addition to the parsed payload.

Example:

import type { FlowDefinition } from '@trigora/contracts';

const flow: FlowDefinition = {
  id: 'hello',
  trigger: { type: 'manual' },
  async run(event, ctx) {
    await ctx.log.info('Hello from Trigora', {
      payload: event.payload,
    });
  },
};

Trigger contracts are strict, so invalid or mixed trigger fields should fail at compile time.

Deployment Contracts (Advanced)

These contracts are primarily intended for advanced integrations and tooling. Most users will not need to interact with these directly.

They cover the public deployment request and response shapes:

  • DeploymentManifestFlow
  • DeploymentManifest
  • DeploymentArtifactFile
  • DeploymentArtifact
  • CreateDeploymentRequest
  • DeploymentStatus
  • DeploymentManifestSnapshot
  • DeployedFlowResponse
  • CreateDeploymentResponse

Example:

import type { CreateDeploymentRequest, DeploymentManifest } from '@trigora/contracts';

const manifest: DeploymentManifest = {
  version: 1,
  flows: [
    {
      id: 'hello',
      entrypoint: 'flows/hello.ts',
      routePath: '/hello',
      trigger: { type: 'webhook' },
    },
  ],
};

const request: CreateDeploymentRequest = {
  manifest,
  artifact: {
    version: 1,
    format: 'esm',
    target: 'node20',
    files: [],
  },
};

Structured API Error Contracts

Client-facing errors use a structured shape:

  • ApiErrorCode
  • ApiErrorStep
  • ApiErrorResponse

Example:

import type { ApiErrorResponse } from '@trigora/contracts';

const error: ApiErrorResponse = {
  error: {
    code: 'internal_error',
    message: 'Failed to activate deployment.',
    step: 'activating',
  },
};

These contracts let typed clients branch on stable error codes and optional error steps without relying on ad hoc response parsing.

Hosted Flow Management Contracts

These contracts support hosted flow management responses used by the CLI and other typed clients:

  • FlowTriggerType
  • FlowStatus
  • WebhookFlowRecord
  • CronFlowRecord
  • QueueFlowRecord
  • FlowRecord
  • ListFlowsResponse
  • GetFlowResponse
  • FlowStatusResponse

Example:

import type { ListFlowsResponse } from '@trigora/contracts';

const response: ListFlowsResponse = {
  flows: [
    {
      id: '402c04b0-62c8-4d0b-942f-0ee2329436a8',
      name: 'hello',
      trigger: 'webhook',
      status: 'ready',
      createdAt: '2026-04-21T10:00:00.000Z',
      endpoint: 'https://trigora.dev/f/402c04b0-62c8-4d0b-942f-0ee2329436a8',
      route: '/hello',
    },
  ],
};

FlowStatusResponse is the shared response shape for flow status changes such as disable and enable.

When To Use @trigora/contracts

Use this package when you are:

  • building a typed API client for Trigora Cloud
  • integrating with deployment or hosted flow management responses
  • building tooling around Trigora manifests or responses

Most application authors should use @trigora/sdk for defining flows and trigora for running and deploying them.

Related Packages

  • trigora - CLI for local development, hosted deploys, and flow management
  • @trigora/sdk - flow authoring SDK built on top of these contracts

License

MIT