@cmscraft/schema
The public GraphQL schema of the CMS Craft API, as SDL, plus generated TypeScript types. Use it to generate a typed client without introspecting the live API.
Free during beta. Paid plans will follow; we will announce pricing and give notice before any charge.
Install
npm i -D @cmscraft/schema
pnpm add -D @cmscraft/schema and yarn add -D @cmscraft/schema work the same way.
Use as a codegen schema
@cmscraft/schema/schema.gql is the schema file. Point GraphQL Code Generator
at it:
// codegen.ts
import type { CodegenConfig } from '@graphql-codegen/cli'
const config: CodegenConfig = {
schema: 'node_modules/@cmscraft/schema/schema.gql',
documents: ['src/**/*.graphql'],
generates: {
'src/generated/graphql.ts': { plugins: ['typescript', 'typescript-operations'] }
}
}
export default config
Types
The generated schema types are exported from @cmscraft/schema/types:
import type { Query } from '@cmscraft/schema/types'
Documentation
Endpoint, authentication and API guides: https://docs.cms-craft.com
Questions: [email protected]
License
MIT