@sgrs/client-ts
    Preparing search index...

    Interface ClientConfig

    Configuration for the SGRS API client.

    interface ClientConfig {
        apiKey?: string;
        baseUrl: string;
        fetch?: (input: URL | RequestInfo, init?: RequestInit) => Promise<Response>;
        nats?: NatsConfig;
        tenantId?: string;
        timeout?: number;
    }
    Index
    apiKey?: string

    Optional API key for authentication. If provided, will be sent as Authorization: Bearer {apiKey}

    baseUrl: string

    Base URL of the SGRS API (e.g., https://api.sgrs.example.com)

    fetch?: (input: URL | RequestInfo, init?: RequestInit) => Promise<Response>

    Optional custom fetch implementation (for Node.js or custom environments) Defaults to global fetch

    Type Declaration

      • (input: URL | RequestInfo, init?: RequestInit): Promise<Response>
      • Parameters

        • input: URL | RequestInfo
        • Optionalinit: RequestInit

        Returns Promise<Response>

    nats?: NatsConfig

    Optional NATS configuration for real-time event streaming.

    When provided, client.events becomes active. Call await client.connect() to establish the NATS connection, then subscribe to governance events.

    The nats npm package must be installed separately: npm install nats

    const client = createClient({
    baseUrl: 'https://api.example.com',
    tenantId: 'acme',
    nats: { servers: 'nats://localhost:4222', token: process.env.NATS_TOKEN },
    });
    await client.connect();
    client.events.onVetoActivated('acme', (event) => haltSwarm(event));
    tenantId?: string

    Tenant ID sent as X-Tenant-ID on every request. Required by the API server for all authenticated routes.

    timeout?: number

    Request timeout in milliseconds (default: 30000)