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 🙏

© 2024 – Pkg Stats / Ryan Hefner

windmill-ts

v0.3.2

Published

Type-safe client for Windmill

Downloads

777

Readme

windmill-ts

A TypeScript code generator for creating type-safe clients for Windmill.

https://github.com/user-attachments/assets/b6bc15a0-3e17-4d93-8b7f-cf10505e14c9

Under the hood, it uses the official windmill-client library to interact with Windmill, and exposes a similar interface.

The output is a single file that could be used from Windmill itself (by creating a script from the output and importing it from other TypeScript files), and from your own codebase (by setting up windmill-client in it).

Features

  • Generates fully typed TypeScript client code for your Windmill workspace
  • Type-safe access to scripts, flows and resources
  • Automatic schema generation from Windmill's JSON schemas
  • Integration with the Windmill CLI configuration

Requirements

  • A configured Windmill CLI environment

Refer to the Windmill docs for instructions on how to set up the Windmill CLI.

Installation

npm install windmill-ts

Usage

The simplest way to use windmill-ts is to run it with no arguments, which will use your active Windmill CLI workspace:

npx windmill-ts ./generated-client.ts

You can also specify a specific workspace:

npx windmill-ts -w my-workspace ./generated-client.ts

To output to stdout instead of a file, use - as the output path:

npx windmill-ts -

Generated Client Usage

The generated client provides type-safe functions for running scripts and flows, and getting resources:

import {
  runScript,
  runScriptAsync,
  runFlow,
  runFlowAsync,
  getResource,
} from "./generated-client";

// Run a script synchronously
const result = await runScript("my/script/path", {
  // TypeScript will enforce the correct argument types here
  arg1: "value",
  arg2: 42,
});

// Run a script asynchronously
const jobId = await runScriptAsync("my/script/path", {
  arg1: "value",
  arg2: 42,
});

// Run a flow
const flowResult = await runFlow("my/flow/path", {
  input1: "value",
  input2: true,
});

// Get a resource with type validation
const resource = await getResource("my/resource/path");
// TypeScript will infer the correct type based on the resource type

How It Works

The generator:

  1. Connects to your configured Windmill workspace
  2. Fetches all available scripts, flows and resource types
  3. Generates Zod schemas for validating inputs
  4. Creates type-safe wrapper functions for running scripts and flows
  5. Handles resource type references and validations

License

This project is licensed under the Unlicense - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.