npm package: @identa-io/business-ts-sdk
Description: TypeScript SDK for Identa Business API - GraphQL client for business dashboard integration
Author: Identa.io
Latest version: 0.3.3

# 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

```bash
npm install
```

## Generating the Client

The TypeScript client is generated from the GraphQL schema in the identa repository. To regenerate:

```bash
# Generate types from schema
npm run codegen

# Generate and watch for changes
npm run codegen:watch

# Build the package
npm run build
```

## Project 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 scripts
```

## Usage

```typescript
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:

1. Pull the latest changes from the identa repository
2. Run `npm run codegen` to regenerate TypeScript types
3. Run `npm run build` to compile the updated SDK
4. 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:

1. Monitors changes to the GraphQL schema in the identa repository
2. Automatically runs `npm run codegen` when schema changes are detected
3. Creates a pull request with the updated generated types
4. Publishes updated SDK versions to npm

To implement this in the future, create `.github/workflows/codegen.yml` with appropriate triggers and actions.

## Development

```bash
# Install dependencies
npm install

# Generate types
npm run codegen

# Build the package
npm run build

# Clean generated files
npm run clean
```

## Notes

- The `generated/` directory contains auto-generated code and should not be edited manually
- The schema path in `codegen.ts` is 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`