@routeflow/types
v1.0.23
Published
Auto-generated TypeScript types from the RouteFlow API OpenAPI specification
Maintainers
Readme
@routeflow/types
Auto-generated TypeScript types from the RouteFlow API OpenAPI specification.
Installation
npm install @routeflow/typesUsage
Friendly Type Aliases
Import commonly used types from the /exports subpath:
import type { Run, Stop, Driver, CreateRunRequest } from '@routeflow/types/exports';
const run: Run = {
id: '123',
name: 'Morning Deliveries',
status: 'DRAFT',
// ...
};Raw OpenAPI Types
For advanced usage (path-based typing, type utilities):
import type { paths, components, operations } from '@routeflow/types';
// Extract request body for a specific endpoint
type CreateRunBody = paths['/api/runs']['post']['requestBody']['content']['application/json'];
// Access any schema directly
type RunSchema = components['schemas']['RunResponseDto'];Type Generation
Types are auto-generated from the RouteFlow API's OpenAPI specification using openapi-typescript.
Generate from Local API
# Start the API first
cd ../routeflow-api && npm run start:dev
# Generate types
npm run generateGenerate from Production API
npm run generate:prodPackage Structure
routeflow-types/
├── src/
│ ├── index.ts # Auto-generated types (DO NOT EDIT)
│ └── exports.ts # Friendly type aliases
├── dist/ # Compiled output
├── package.json
└── README.mdAvailable Types
Entities
User,OrganizationRun,Stop,Driver,DocumentTrackingStatus,TrackingLocation
Request Types
LoginRequest,RegisterRequestCreateRunRequest,UpdateRunRequestCreateStopRequest,UpdateStopRequestCreateDocumentRequest
Enums
RunStatus- DRAFT, ASSIGNED, IN_PROGRESS, COMPLETED, CANCELLEDStopStatus- PENDING, EN_ROUTE, ARRIVED, DELIVERED, etc.StopType- PICKUP, DELIVERY, BOTHDocumentType- POD, PHOTO, SIGNATURE, etc.
Pagination
PaginatedRuns,PaginatedStops,PaginatedDrivers
Raw Types
paths- All API endpoints with their methodscomponents- All schemas, parameters, responsesoperations- All operation definitions
Development
# Install dependencies
npm install
# Generate types (requires API running on localhost:3001)
npm run generate
# Build
npm run build
# Type check
npm run type-checkLicense
MIT
