@ai-workflow-pack/client
v1.0.0
Published
Service-to-service HTTP clients for AI Workflow microservices
Maintainers
Readme
@ai-workflow/client
Service-to-service HTTP client library for AI Workflow microservices communication.
Installation
npm install @ai-workflow/clientUsage
Auth Client
import { AuthServiceClient } from '@ai-workflow/client';
const authClient = new AuthServiceClient('http://auth-service:3000');
// Validate JWT token
const user = await authClient.validateToken(token);
// Get user by ID
const user = await authClient.getUserById(userId);Workflow Client
import { WorkflowServiceClient } from '@ai-workflow/client';
const workflowClient = new WorkflowServiceClient('http://workflow-service:3000');
// Get workflow definition
const workflow = await workflowClient.getWorkflow(workflowId);
// List workflows
const workflows = await workflowClient.listWorkflows({ status: 'active' });Executor Client
import { ExecutorServiceClient } from '@ai-workflow/client';
const executorClient = new ExecutorServiceClient('http://executor-service:3000');
// Execute workflow
const execution = await executorClient.executeWorkflow(workflowId, inputData);
// Get execution status
const status = await executorClient.getExecutionStatus(executionId);Features
- ✅ Type-safe client methods
- ✅ Automatic retry with exponential backoff
- ✅ Request/response interceptors
- ✅ Error handling and transformation
- ✅ Configurable timeout
- ✅ Circuit breaker support
Configuration
const client = new WorkflowServiceClient('http://workflow-service:3000', {
timeout: 30000,
retries: 3,
retryDelay: 1000,
headers: {
'X-Custom-Header': 'value'
}
});License
MIT
