
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
@ttoss/graphql-api-cli
Advanced tools
CLI tool that generates GraphQL schemas and TypeScript types from your @ttoss/graphql-api schema composer, enabling seamless integration with Relay and providing type safety for your GraphQL operations.
pnpm add -D @ttoss/graphql-api-cli
This CLI is essential for GraphQL development workflows using the ttoss ecosystem, providing automated generation of:
schema/schema.graphql file required for Relay introspection queriesschema/types.ts with strongly-typed interfaces for your GraphQL schemaThe tool operates by importing your schemaComposer.ts file, extracting the schema definition, and generating both the SDL schema file and corresponding TypeScript types using GraphQL Code Generator.
ttoss-graphql-api build-schema
Add the build script to your package.json for easy integration:
{
"scripts": {
"build-schema": "ttoss-graphql-api build-schema"
}
}
This command:
src/schemaComposer.ts fileschema/schema.graphql in SDL formatschema/types.ts with TypeScript type definitions-d, --directory)Specify a custom directory for your schemaComposer.ts file:
ttoss-graphql-api build-schema -d src/graphql
ttoss-graphql-api build-schema --directory tests
Default: src
--external)Control which additional dependencies are marked as external during the bundling process:
ttoss-graphql-api build-schema --external graphql-compose,@aws-sdk/client-dynamodb
Default behavior: Automatically excludes all package.json dependencies (except workspace packages and graphql) and appends any specified external dependencies to this list. Workspace dependencies (those with workspace: prefix) are automatically excluded from external handling to prevent bundling issues in monorepo environments. The graphql dependency is always bundled to avoid dynamic require errors.
my-graphql-api/
├── schema/ # Generated files
│ ├── schema.graphql # SDL schema
│ └── types.ts # TypeScript types
├── src/
│ ├── schemaComposer.ts # Your schema definition
│ └── modules/ # GraphQL modules
└── package.json
// src/schemaComposer.ts
import { schemaComposer } from '@ttoss/graphql-api';
import './modules/User/composer';
import './modules/Post/composer';
export { schemaComposer };
For complex projects requiring specific external handling:
# Custom directory with specific externals
ttoss-graphql-api build-schema \
--directory src/api \
--external graphql-compose,dataloader,aws-sdk
{
"scripts": {
"build": "pnpm build-schema && pnpm compile",
"build-schema": "ttoss-graphql-api build-schema",
"dev": "pnpm build-schema && tsx watch server.ts"
}
}
ESM Only: This package is ESM only and requires Node.js with ES modules support.
Bundling Process: Uses esbuild to bundle your schema composer and its dependencies, ensuring all imports are resolved correctly before schema extraction. Automatically excludes all package.json dependencies as external (except workspace packages and graphql), with support for additional external dependencies via the --external option. The graphql package is always bundled to prevent "Dynamic require of 'graphql' is not supported" errors.
Workspace Dependencies: Dependencies with workspace: prefix are automatically excluded from external handling to prevent TypeScript import errors in monorepo environments where workspace packages may export .ts files directly.
Type Generation: Leverages @graphql-codegen/typescript for precise TypeScript type generation with interface declarations and preserved naming conventions.
FAQs
A library for building GraphQL APIs types and schema.
We found that @ttoss/graphql-api-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.