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

@process.co/element-types

v0.0.21

Published

[<img src="https://img.shields.io/npm/v/%40process.co%2Felement-types" />](https://www.npmjs.com/package/@process.co/element-types) [<img src="https://img.shields.io/github/v/release/process-co/npm-element-types" />](https://github.com/process-co/npm-elem

Readme

@process.co/element-types

TypeScript types and authoring helpers for Process.co element modules (apps, actions, signals). Use this package when defining element source in TypeScript so this, props, hooks, and host params.$ surfaces are checked at compile time.

Runtime loaders, FERN merge output, and compatibility shims live in other packages (for example @process.co/compatibility, @process.co/elements).

Installation

npm install @process.co/element-types

Pinned version (GitHub)

npm install git+https://github.com/process-co/npm-element-types.git#v0.0.1

Latest from main (GitHub)

npm install git+https://github.com/process-co/npm-element-types.git#main

Element modules

App (defineApp)

import { defineApp, type DeriveAppInstance } from '@process.co/element-types';

const exampleApp = defineApp({
  type: 'app',
  app: 'example_app',
  props: {
    apiKey: {
      label: 'API Key',
      type: 'string',
    },
  } as const,
  methods: {
    async ping(this: DeriveAppInstance<typeof exampleApp>) {
      return { ok: true };
    },
  },
});

export type ExampleApp = typeof exampleApp;
export default exampleApp;

Action (defineAction)

import { defineAction, type DeriveActionInstance } from '@process.co/element-types';

export const sendMessage = defineAction({
  type: 'action',
  app: 'example_app',
  key: 'send_message',
  props: { /* … */ } as const,
  methods: {
    async run(this: DeriveActionInstance<typeof sendMessage>, params) {
      // params.$ — FlowFunctions, send, stash, etc.
      return {};
    },
  },
});

Signal (defineSignal)

Signals handle inbound events (webhooks, etc.) via run. Optional hooks run on publish/save and lifecycle transitions.

import { defineSignal } from '@process.co/element-types';

export const inboundWebhook = defineSignal({
  type: 'signal',
  app: 'example_app',
  key: 'inbound_webhook',
  props: {
    httpInterface: { type: '$.interface.http' },
    cacheMaxAge: { type: '$.interface.duration', default: 86_400 },
  } as const,
  hooks: {
    async save({ $ }) {
      if ($.isDraft) return;
      await $.http.configureResponseCaching({
        maxAge: this.cacheMaxAge,
        varyBy: '*',
      });
    },
    async activate({ $ }) {
      $.export('lifecycle', 'activated');
    },
  },
  methods: {
    async run({ $, event }) {
      const parsed = await $.enforceSchema($.interfaceEmitSchema, event.body);
      if (!parsed.ok) throw new Error(parsed.message);
      await this.httpInterface.respond({ status: 200, body: { ok: true } });
    },
  },
});

Top-level run is still accepted for older definitions; runtime normalizes either shape via restructureElement in @process.co/compatibility.

Hook names accept both modern (save, activate, deactivate) and legacy (onSave, onActivate, onDeactivate) aliases.

Signal host surfaces

Host capabilities are split by hook so TypeScript prevents calling the wrong API:

| Surface | When | params.$ type | Typical capabilities | |--------|------|-----------------|----------------------| | run | Live webhook / test execution | SignalRunHostServices | enforceSchema, export, $transitionToSlot, interfaceEmitSchema | | hooks.save | Publish / save materialization | SignalSaveHookHostServices | isDraft, http.configureResponseCaching | | hooks.activate / hooks.deactivate | Lifecycle | SignalLifecycleHookHostServices | isDraft, export |

this in hooks is DeriveSignalHookInstance (props only). this in run is DeriveSignalInstance (includes runtime helpers such as HTTP interface methods).

Draft vs production ($.isDraft)

SignalHookHostContext.isDraft is true during draft/editor materialization and false on publish/production hook runs.

The API runner resolves this with resolveSignalHookIsDraft:

import { resolveSignalHookIsDraft } from '@process.co/element-types';

resolveSignalHookIsDraft({ isDraft: true }); // explicit flag wins
resolveSignalHookIsDraft({ executionContext: 'editor' }); // true
resolveSignalHookIsDraft({ executionContext: 'production' }); // false

HTTP interface schema validation

Design-time schema blobs on $.interface.schema are described by HttpInterfaceSchemaWire. When validation is enabled, the runtime loads the compiled Zod ESM at compiledValidatorKey and validates through the host — not by parsing exportSchema JSON alone.

In element code:

  • await $.enforceSchema(schema, value) — full Zod parse via the Process API (in run).
  • validateEmitPayload / setSignalEmitValidationHost — shared emit validation when a host binding is installed (worker / bundled copies).

See JSDoc on HttpInterfaceSchemaWire, EnforceSchemaResult, and PROCESS_CO_ENFORCE_SCHEMA_HOST_PAYLOAD_MARKER for RPC envelope details.

Type helpers

| Export | Purpose | |--------|---------| | DeriveAppInstance<T> | this for app methods | | DeriveActionInstance<T> | this for action methods | | DeriveSignalInstance<T> | this for signal run | | DeriveSignalHookInstance<T> | this for signal hooks | | PropType<T>, PropDefinitionType<…> | Prop value types from definitions | | SignalEventShape, SignalRunOptions | Inbound event + run parameters | | RunReturn<T> | Awaited return type of a module’s run |

Other exports

  • SlotsISlotDefinition, builtin action slot registry types.
  • Authoring contractELEMENT_AUTHORING_CONTRACT_VERSION, *AuthoringContract wire types (runtime materialization: @process.co/compatibility authoring-spec).
  • CLI wire typesProcessElementCliOutputWire and related shapes from process-element output.
  • HTTP cache policyConfigureResponseCachingOptions, HTTP_REQUEST_CACHE_POLICY_KEY, replay/vary wire types.
  • Zod → JSON SchemazodObjectToContainerExportJsonSchema for container export tooling.
  • Platform loaderisPlatformBoundLoaderType, PLATFORM_BOUND_LOADER_TYPE_PREFIXES.

Development (monorepo)

pnpm --filter @process.co/element-types build
pnpm --filter @process.co/element-types test

To publish to npm, prune/build/sync from the monorepo root — see root AGENTS.md and .cursor/skills/process-publishing-workflow.

License

ISC