or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

component-context.mdcomponent-structure.mdevent-system.mdindex.mdinterface-types.mdprop-types.mdservice-types.md
tile.json

tessl/npm-pipedream--types

TypeScript types for Pipedream components (sources and actions)

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@pipedream/types@0.3.x

To install, run

npx @tessl/cli install tessl/npm-pipedream--types@0.3.0

index.mddocs/

@pipedream/types

@pipedream/types provides comprehensive TypeScript type definitions for Pipedream's component development ecosystem. It enables developers to build type-safe Pipedream components including event sources and actions by providing interfaces, type definitions, and schemas that cover the complete component API structure.

Package Information

  • Package Name: @pipedream/types
  • Package Type: npm
  • Language: TypeScript
  • Installation: npm install @pipedream/types

Core Imports

import { PipedreamComponent, ComponentProps, TimerInterface, HttpInterface } from "@pipedream/types";

For importing specific type categories:

import { 
  // Component structure
  PipedreamComponent, PipedreamApp,
  
  // Props and interfaces
  UserInputProp, ComponentProps, TimerInterface, HttpInterface,
  
  // Events and context
  ComponentThis, EmitMethod, EventMetadata,
  
  // Utilities
  DedupeStrategy, AuthContext
} from "@pipedream/types";

Basic Usage

import { PipedreamComponent, ComponentProps, TimerInterface } from "@pipedream/types";

// Define a basic timer-based component
const component: PipedreamComponent = {
  key: "example-timer-component",
  name: "Example Timer Component",
  version: "0.0.1",
  description: "An example component that runs on a timer",
  props: {
    timer: {
      type: "$.interface.timer",
      default: {
        intervalSeconds: 60 * 15, // 15 minutes
      },
    },
    db: "$.service.db",
  },
  async run(event) {
    // Access typed context
    const { timer, db, $emit } = this;
    
    // Emit typed events
    this.$emit({ message: "Timer triggered" }, {
      id: Date.now(),
      summary: "Timer execution",
      ts: Date.now(),
    });
  },
};

Architecture

@pipedream/types is organized around several key type systems:

  • Component Structure: Core interfaces for defining Pipedream components (PipedreamComponent, PipedreamApp)
  • Prop System: Complete typing for component properties including user inputs, interfaces, and services
  • Interface Types: Strongly typed interfaces for triggers (TimerInterface, HttpInterface, AppHookInterface)
  • Context Types: Runtime context objects available during component execution (ComponentThis, AuthContext)
  • Event System: Types for event emission and metadata (EmitMethod, EventMetadata)
  • Validation Types: Schema definitions and validation patterns for component configuration

Capabilities

Component Structure

Core interfaces and types for defining Pipedream components, including the main component interface, app definitions, and lifecycle hooks.

interface PipedreamComponent {
  key?: string;
  name: string;
  version: string;
  description?: string;
  props: ComponentProps;
  methods?: ComponentMethods;
  hooks?: ComponentHooks;
  dedupe?: DedupeStrategy;
  run: (event: any) => Promise<void> | void;
}

interface PipedreamApp {
  type: "app";
  app: string;
  propDefinitions?: PropDefinitions;
  methods?: AppMethods;
}

Component Structure

Prop Types

Comprehensive type system for component properties including user input props, validation schemas, and dynamic option loading.

interface UserInputProp {
  type: PropType;
  label?: string;
  description?: string;
  optional?: boolean;
  default?: any;
  secret?: boolean;
  options?: PropOptions;
  useQuery?: boolean;
  propDefinition?: [PipedreamApp, string, any?];
  appProp?: string;
  baseIdProp?: string;
  tableIdProp?: string;
}

type PropType = 
  | "string" | "boolean" | "integer" | "app"
  | "string[]" | "boolean[]" | "integer[]"
  | "$.airtable.baseId" | "$.airtable.tableId" | "$.airtable.viewId";

Prop Types

Interface Types

Strongly typed interfaces for component triggers including timer-based execution, HTTP endpoints, and app webhooks.

interface TimerInterface {
  type: "$.interface.timer";
  default?: {
    intervalSeconds?: number;
    cron?: string;
  };
}

interface HttpInterface {
  type: "$.interface.http";
  customResponse?: boolean;
  respond?: HttpRespondMethod;
}

interface AppHookInterface {
  type: "$.interface.apphook";
  appProp: string;
  eventNames: string[];
}

Interface Types

Event System

Types for event emission, metadata, and deduplication strategies used throughout the Pipedream component lifecycle.

interface EmitMethod {
  (event: any, metadata?: EventMetadata): void;
}

interface EventMetadata {
  id?: string | number;
  summary?: string;
  ts?: number;
}

type DedupeStrategy = "unique" | "greatest" | "last";

Event System

Component Context

Runtime context types available during component execution, including access to props, services, and authentication.

interface ComponentThis {
  [propName: string]: any;
  $emit: EmitMethod;
  $auth?: AuthContext;
  db?: DatabaseService;
  http?: HttpEndpoint & { respond: HttpRespondMethod };
}

interface AuthContext {
  oauth_access_token?: string;
  oauth_refresh_token?: string;
  api_key?: string;
  [key: string]: any;
}

Component Context

Service Types

Type definitions for Pipedream's built-in services including database storage and HTTP response handling.

interface DatabaseService {
  type: "$.service.db";
  get: (key: string) => any;
  set: (key: string, value: any) => void;
}

interface HttpRespondMethod {
  (response: {
    status: number;
    headers?: Record<string, string>;
    body?: string | object | Buffer;
  }): void;
}

Service Types