@iota-big3/sdk-production
Version:
Production readiness tools and utilities for SDK
325 lines • 8.14 kB
TypeScript
export interface Logger {
info: (message: string, ...args: unknown[]) => void;
error: (message: string, ...args: unknown[]) => void;
warn: (message: string, ...args: unknown[]) => void;
debug: (message: string, ...args: unknown[]) => void;
}
export interface ApiDocConfig {
tsConfigPath?: string;
outputDir?: string;
baseUrl?: string;
title?: string;
version?: string;
includePrivate?: boolean;
theme?: 'default' | 'dark' | 'minimal';
}
export interface ApiEndpoint {
path: string;
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
description?: string;
parameters?: ApiParameter[];
requestBody?: ApiRequestBody;
responses?: Record<string, ApiResponse>;
tags?: string[];
deprecated?: boolean;
}
export interface ApiParameter {
name: string;
in: 'path' | 'query' | 'header' | 'cookie';
description?: string;
required?: boolean;
schema: ApiSchema;
}
export interface ApiRequestBody {
description?: string;
required?: boolean;
content: Record<string, {
schema: ApiSchema;
}>;
}
export interface ApiResponse {
description: string;
content?: Record<string, {
schema: ApiSchema;
}>;
headers?: Record<string, ApiParameter>;
}
export interface ApiSchema {
type: string;
format?: string;
properties?: Record<string, ApiSchema>;
items?: ApiSchema;
required?: string[];
description?: string;
example?: unknown;
}
export interface ApiDocumentation {
openapi: string;
info: {
title: string;
version: string;
description?: string;
};
servers?: Array<{
url: string;
description?: string;
}>;
paths: Record<string, Record<string, ApiEndpoint>>;
components?: {
schemas?: Record<string, ApiSchema>;
parameters?: Record<string, ApiParameter>;
responses?: Record<string, ApiResponse>;
};
tags?: Array<{
name: string;
description?: string;
}>;
}
export interface PlaygroundConfig {
port?: number;
host?: string;
uiEnabled?: boolean;
authentication?: boolean;
rateLimit?: {
windowMs?: number;
max?: number;
};
cors?: {
origin?: string | string[];
credentials?: boolean;
};
}
export interface PlaygroundExample {
id: string;
title: string;
description?: string;
code: string;
language: 'javascript' | 'typescript' | 'python' | 'curl';
category?: string;
tags?: string[];
}
export interface PlaygroundExecution {
id: string;
exampleId: string;
status: 'pending' | 'running' | 'success' | 'error';
startTime: Date;
endTime?: Date;
output?: unknown;
error?: string;
duration?: number;
}
export interface PlaygroundSession {
id: string;
userId?: string;
createdAt: Date;
lastActivity: Date;
executions: PlaygroundExecution[];
}
export interface HealthCheckConfig {
enabled?: boolean;
interval?: number;
timeout?: number;
retries?: number;
checks?: Array<{
name: string;
check: () => Promise<HealthStatus>;
}>;
webhook?: {
url: string;
headers?: Record<string, string>;
};
}
export interface HealthCheck {
name: string;
check: () => Promise<HealthCheckResult>;
critical?: boolean;
timeout?: number;
interval?: number;
metadata?: Record<string, unknown>;
}
export interface HealthCheckResult {
status: 'healthy' | 'degraded' | 'unhealthy';
message?: string;
details?: Record<string, unknown>;
duration?: number;
timestamp?: Date;
error?: Error;
}
export interface SystemHealth {
status: 'healthy' | 'degraded' | 'unhealthy';
checks: Record<string, HealthCheckResult>;
version?: string;
uptime?: number;
timestamp: Date;
}
export interface HealthMetrics {
cpu: {
usage: number;
loadAverage: number[];
};
memory: {
used: number;
total: number;
percentage: number;
};
disk?: {
used: number;
total: number;
percentage: number;
};
network?: {
rx: number;
tx: number;
};
}
export interface ReleaseConfig {
packagePath?: string;
registry?: string;
dryRun?: boolean;
skipTests?: boolean;
skipChangelog?: boolean;
skipGitTag?: boolean;
preRelease?: boolean;
}
export interface ReleaseType {
type: 'major' | 'minor' | 'patch' | 'prerelease' | 'custom';
preid?: string;
customVersion?: string;
}
export interface ChangelogEntry {
type: 'feat' | 'fix' | 'docs' | 'style' | 'refactor' | 'perf' | 'test' | 'chore';
scope?: string;
subject: string;
body?: string;
breaking?: boolean;
issues?: string[];
commit?: string;
}
export interface ReleaseCheckResult {
canRelease: boolean;
issues: string[];
warnings: string[];
currentVersion: string;
suggestedVersion?: string;
}
export interface PublishResult {
success: boolean;
version: string;
registry?: string;
tarballUrl?: string;
shasum?: string;
error?: string;
}
export interface ProductionConfig {
environment: 'development' | 'staging' | 'production';
health?: HealthCheckConfig;
playground?: PlaygroundConfig;
docs?: ApiDocConfig;
release?: ReleaseConfig;
monitoring?: MonitoringConfig;
deployment?: DeploymentConfig;
}
export interface MonitoringConfig {
enabled?: boolean;
metrics?: boolean;
tracing?: boolean;
logging?: {
level: 'debug' | 'info' | 'warn' | 'error';
format: 'json' | 'text';
};
apm?: {
serviceName?: string;
serverUrl?: string;
secretToken?: string;
};
}
export interface DeploymentConfig {
strategy: 'rolling' | 'blue-green' | 'canary';
replicas?: number;
maxSurge?: number;
maxUnavailable?: number;
healthCheckPath?: string;
readinessPath?: string;
gracefulShutdownTimeout?: number;
}
export interface ProductionStatus {
environment: string;
version: string;
uptime: number;
health: SystemHealth;
metrics?: HealthMetrics;
deployment?: {
timestamp: Date;
commit: string;
branch: string;
};
}
export interface ProductionReport {
timestamp: Date;
status: ProductionStatus;
health?: SystemHealth;
performance?: {
requestsPerSecond: number;
averageResponseTime: number;
errorRate: number;
};
resources?: HealthMetrics;
recommendations?: string[];
}
export interface ValidationResult {
valid: boolean;
errors: string[];
warnings?: string[];
}
export interface ProductionChecklist {
items: ChecklistItem[];
completedCount: number;
totalCount: number;
readiness: number;
}
export interface ChecklistItem {
id: string;
category: string;
description: string;
required: boolean;
completed: boolean;
automatable: boolean;
documentation?: string;
}
export type ProductionEventType = 'health.check.complete' | 'docs.generated' | 'playground.started' | 'release.created' | 'checklist.generated' | 'error' | 'warning';
export interface ProductionEvent {
type: ProductionEventType;
timestamp: Date;
data: Record<string, unknown>;
severity?: 'low' | 'medium' | 'high' | 'critical';
}
export interface ProductionResult<T = unknown> {
success: boolean;
data?: T;
error?: {
code: string;
message: string;
};
}
export type HealthStatus = 'healthy' | 'degraded' | 'unhealthy';
export interface DeploymentChecklistItem {
category: 'pre-deployment' | 'deployment' | 'post-deployment';
item: string;
required: boolean;
checked: boolean;
}
export interface ReleaseInfo {
version: string;
date: Date;
notes: string;
changelog: string;
artifacts: string[];
}
export interface ProductionError extends Error {
code: string;
component: string;
timestamp: Date;
context?: Record<string, unknown>;
suggestion?: string;
}
//# sourceMappingURL=types.d.ts.map