Shared TypeScript types for the TrueStar project, automatically generated from the API spec file:
- API request/response types
- Data models (reviews, analysis results, etc.)
- Zod validation schemas
pnpm add @truestarhq/shared-typesimport { AmazonReview, checkAmazonReviewsBody } from "@truestarhq/shared-types";
// Use types
const review: AmazonReview = {
id: "123",
rating: 5,
text: "Great product!",
// ... other fields
};
// Use Zod schemas for validation
const validationResult = checkAmazonReviewsBody.safeParse(requestData);
if (!validationResult.success) {
console.error("Validation failed:", validationResult.error);
}When the OpenAPI spec changes in the API repository:
pnpm updateThis fetches the latest spec from GitHub, regenerates types, and cleans up.
pnpm update- Fetch from GitHub, generate types, and clean uppnpm fetch- Fetch OpenAPI spec from GitHubpnpm codegen- Generate types from existing openapi.yamlpnpm clean- Clean generated types and OpenAPI spec
This package is published to npm. To release a new version:
- Update version in
package.json - Run
pnpm updateto fetch and regenerate types - Commit changes
- Create a git tag
- Push to repository
Package should be automatically published via CI/CD, ideally when updates are made to the API spec file.