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

# Identa Admin TypeScript SDK

TypeScript SDK for the Identa Admin API. This package provides type-safe GraphQL client access to the Identa admin backend for admin dashboard integration.

## Overview

This SDK is automatically generated from the GraphQL schema defined in `../identa/applications/admin/api/admin.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

```
admin-ts-sdk/
├── src/
│   ├── client.ts          # IdentaAdminClient 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 { IdentaAdminClient } from '@identa-io/admin-ts-sdk';

// Initialize the client
const client = new IdentaAdminClient({
  endpoint: 'https://api.identa.io/admin/graphql',
  token: 'your-admin-token'
});

// Make type-safe API requests
const query = `
  query {
    # Your admin query here
  }
`;

const response = await client.request(query);
```

## Schema Updates

When the GraphQL schema in `../identa/applications/admin/api/admin.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 admin 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/admin/api/admin.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`