Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@contentrain/generator
Advanced tools
Type and schema generator for Contentrain SDK.
npm install @contentrain/generator
# Generate types for all models
contentrain-generate
# Generate types with custom configuration
contentrain-generate --content ./content --output ./types
import { ContentrainGenerator } from '@contentrain/generator'
// Initialize generator
const generator = new ContentrainGenerator({
contentPath: './content',
output: './types'
})
// Generate types
await generator.generate()
interface GeneratorConfig {
// Path to content directory (default: 'contentrain')
contentPath?: string
// Output path for generated types (default: 'contentrain/types')
output?: string
}
The generator creates TypeScript interfaces for your content models. For example:
// Base model type that all content models extend
export interface BaseContentrainModel {
ID: string
createdAt: string
updatedAt: string
status: 'draft' | 'changed' | 'publish'
scheduled: boolean
}
// Generated from metadata.json
// {
// "name": "BlogPost",
// "modelId": "blog-posts",
// ...
// }
interface IBlogPost extends BaseContentrainModel {
title: string
content: string
author: string
tags: string[]
}
// Generated from metadata.json
// {
// "name": "Author",
// "modelId": "authors",
// ...
// }
interface IAuthor extends BaseContentrainModel {
name: string
bio: string
avatar: string
}
// Type mapping for model IDs to their respective interfaces
export type ContentrainTypeMap = {
'blog-posts': IBlogPost
'authors': IAuthor
}
Options:
--content Path to content directory [string] [default: "contentrain"]
--output Output path for types [string] [default: "contentrain/types"]
--help Show help [boolean]
--version Show version number [boolean]
MIT
FAQs
`@contentrain/generator` is a type and schema generator tool for the Contentrain SDK. It generates TypeScript interfaces for your content models and can be used via CLI or programmatically.
The npm package @contentrain/generator receives a total of 0 weekly downloads. As such, @contentrain/generator popularity was classified as not popular.
We found that @contentrain/generator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.