@identa-io/business-ts-sdk
v0.3.3
Published
TypeScript SDK for Identa Business API - GraphQL client for business dashboard integration
Maintainers
Readme
Identa Business TypeScript SDK
TypeScript SDK for the Identa Business API. This package provides type-safe GraphQL client access to the Identa business backend for business dashboard integration.
Overview
This SDK is automatically generated from the GraphQL schema defined in ../identa/applications/business/api/business.graphql. It provides:
- Full TypeScript type definitions for all GraphQL types
- Type-safe client for making API requests
- Auto-completion support in IDEs
- Runtime type safety
Installation
npm installGenerating the Client
The TypeScript client is generated from the GraphQL schema in the identa repository. To regenerate:
# Generate types from schema
npm run codegen
# Generate and watch for changes
npm run codegen:watch
# Build the package
npm run buildProject Structure
business-ts-sdk/
├── src/
│ ├── client.ts # IdentaBusinessClient wrapper class
│ └── index.ts # Main export file
├── generated/ # Auto-generated GraphQL types (not committed)
│ └── graphql.ts # Generated types and SDK
├── dist/ # Compiled JavaScript (not committed)
├── codegen.ts # GraphQL Code Generator configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Package dependencies and scriptsUsage
import { IdentaBusinessClient } from '@identa-io/business-ts-sdk';
// Initialize the client
const client = new IdentaBusinessClient({
endpoint: 'https://api.identa.io/business/graphql',
token: 'your-business-token'
});
// Make type-safe API requests
const query = `
query {
# Your business query here
}
`;
const response = await client.request(query);Schema Updates
When the GraphQL schema in ../identa/applications/business/api/business.graphql is updated:
- Pull the latest changes from the identa repository
- Run
npm run codegento regenerate TypeScript types - Run
npm run buildto compile the updated SDK - Test the changes in your business dashboard application
Future: GitHub Actions Integration
This project is structured to support automated code generation via GitHub Actions. In the future, you can add a workflow that:
- Monitors changes to the GraphQL schema in the identa repository
- Automatically runs
npm run codegenwhen schema changes are detected - Creates a pull request with the updated generated types
- Publishes updated SDK versions to npm
To implement this in the future, create .github/workflows/codegen.yml with appropriate triggers and actions.
Development
# Install dependencies
npm install
# Generate types
npm run codegen
# Build the package
npm run build
# Clean generated files
npm run cleanNotes
- The
generated/directory contains auto-generated code and should not be edited manually - The schema path in
codegen.tsis relative (../identa/applications/business/api/business.graphql) - This is a partial schema - gqlgen adds core GraphQL definitions during server code generation
- Custom scalars (Time, Upload, ID) are mapped to TypeScript types in
codegen.ts
