@moonlab-tech/velox-earn-types
v1.0.0
Published
TypeScript type definitions for Velox Earn API
Readme
@jasonaviandres/velox-earn-types
TypeScript type definitions for the Velox Earn API. This package provides the Client type that gives full type safety when using the Velox Earn SDK.
Installation
npm install @jasonaviandres/velox-earn-types @jasonaviandres/earn-sdkUsage
import type { Client } from '@jasonaviandres/velox-earn-types';
import { createORPCClient, contract } from '@jasonaviandres/earn-sdk';
import { OpenAPILink } from '@orpc/openapi-client/fetch';
const link = new OpenAPILink(contract as any, {
url: 'https://your-api.com'
});
const client = createORPCClient<Client>(link).api;
// Now you have full type safety!What's Included
Client- Full type definition for all API routes, equivalent toRouterClient<typeof routes>from the server- Complete copy of all server type definitions for full self-containment
Build Process
This package contains a complete copy of the server's type definitions to ensure it's fully self-contained. When the server's routes change, rebuild this package to update the types:
# Make sure the server is built first
cd apps/server && pnpm run build:orpc
# Then build the types package
cd packages/velox-earn-types && pnpm run buildThe build process:
- Copies all type definitions from the server's
dist/srcdirectory todist/server - Generates
dist/index.d.tsthat exports theClienttype - Creates a minimal
dist/index.jsfile (this is a types-only package)
Publishing
This package is published to GitHub Packages:
pnpm publishImportant: Always build the server first before building and publishing this package, as it copies the server's type definitions.
