# `@magicapply/retool-typebox-client`

A minimal TypeBox client for Retool Workflows with compile-time autocompletion.

This package implements the two-block workflow described in the docs. Block 1
fetches remote TypeMap syntax and compiles it into JSON Schema; Block 2 consumes
the plain payload object to provide fully typed validation helpers.

## Installation

```bash
npm install @magicapply/retool-typebox-client
```

## Block 1: `fetchAndBuild`

```javascript
const { fetchAndBuildPayload } = require('@magicapply/retool-typebox-client');

// Replace with your schema registry URL
const SCHEMA_REGISTRY_URL = 'https://example.com/api/schemas';

return await fetchAndBuildPayload(SCHEMA_REGISTRY_URL);
```

## Block 2: `runValidation`

```javascript
// @ts-check
const { createClient } = require('@magicapply/retool-typebox-client');

const payload = /** @type {const} */ (fetchAndBuild.data);
const client = createClient(payload);

// Example
client.assert('example.onboard.user', { id: '1', name: 'Jane', email: 'a@b.c' });
```

See `AGENTS.md` for an overview of the project and `AI-CONTEXT.md` for more
details on the two-block workflow.
