Overview

The official Velatir SDK for TypeScript and JavaScript provides a simple decorator-based approach to add human-in-the-loop approval to your functions. Simply decorate any function with @reviewTask() and Velatir will:
  • Intercept function calls and create approval requests
  • Route requests through your configured policies and flows
  • Wait for human approval before executing sensitive operations
  • Handle denials gracefully with detailed feedback

Quick Example

import * as velatir from '@velatir/sdk';

velatir.init({ apiKey: "your-api-key" });

class EmailService {
  @velatir.reviewTask()
  async sendEmail(to: string, subject: string, body: string): Promise<void> {
    // Your email sending logic here
  }
}

Installation & Documentation

Get the latest version and complete documentation from npm:

@velatir/sdk on npm

Install with npm install @velatir/sdk - includes full API reference, examples, and TypeScript support

Features

  • Decorator-based integration - Just add @reviewTask() to any function
  • Full TypeScript support - Complete type safety and IntelliSense
  • Async/sync support - Works with both synchronous and asynchronous functions
  • Configurable polling - Customize approval timeout and retry behavior
  • Rich metadata - Add context for better approval routing
  • Error handling - Graceful handling of denials with feedback