A comprehensive TypeScript library for managing infrastructure assets, cloud resources, and their dependencies. This package provides tools for asset tracking, dependency management, maintenance scheduling, and cloud provider integration.
- Asset Management: Track and manage infrastructure components and cloud resources
- Dependency Tracking: Map and manage relationships between assets
- Maintenance Scheduling: Schedule and track maintenance activities
- Cloud Provider Integration: Connect with AWS and Azure
- Rich TypeScript Support: Full type definitions and IDE support
- Express Integration: Optional Express routes and middleware
npm install asset-utility
import {
AssetService,
DependencyService,
MaintenanceService,
CloudIntegrationService
} from 'asset-utility';
// Initialize services
const assetService = new AssetService();
const dependencyService = new DependencyService();
const maintenanceService = new MaintenanceService();
const cloudService = new CloudIntegrationService();
// Create assets
const database = await assetService.createAsset({
name: 'Production Database',
type: 'RDS',
status: 'active',
location: 'us-east-1',
provider: 'aws',
configuration: {
instanceType: 'db.r5.large',
engine: 'postgres'
}
});
const cache = await assetService.createAsset({
name: 'Redis Cache',
type: 'ElastiCache',
status: 'active',
location: 'us-east-1',
provider: 'aws',
configuration: {
instanceType: 'cache.t3.medium',
engine: 'redis'
}
});
// Create dependency relationship
const dependency = await dependencyService.addDependency({
sourceAssetId: database.id,
targetAssetId: cache.id,
type: 'requires',
impact: 'high',
description: 'Database uses Redis for query caching'
});
// Schedule maintenance
const maintenance = maintenanceService.scheduleMaintenance(
database.id,
new Date('2025-05-01'),
new Date('2025-05-02'),
{
title: 'Database Upgrade',
description: 'Upgrade PostgreSQL version',
type: 'preventive',
assignedTo: 'dba-team',
priority: 'high'
}
);
// Set up cloud provider
const awsIntegration = await cloudService.integrateAWS({
region: 'us-east-1',
credentials: {
accessKey: process.env.AWS_ACCESS_KEY_ID,
secretKey: process.env.AWS_SECRET_ACCESS_KEY
}
});
The package provides specific error types for better error handling:
import {
AssetNotFoundError,
CloudIntegrationError,
ConfigurationError
} from 'asset-utility';
try {
const asset = await assetService.getAssetById('non-existent');
} catch (error) {
if (error instanceof AssetNotFoundError) {
console.error('Asset not found:', error.message);
} else if (error instanceof CloudIntegrationError) {
console.error('Cloud integration failed:', error.message);
} else {
console.error('Unexpected error:', error);
}
}
If you're using Express, you can utilize the provided route handlers:
import express from 'express';
import {
assetsRoutes,
maintenanceRoutes,
dependenciesRoutes,
cloudIntegrationsRoutes
} from 'asset-utility';
const app = express();
app.use('/assets', assetsRoutes);
app.use('/maintenance', maintenanceRoutes);
app.use('/dependencies', dependenciesRoutes);
app.use('/integrations', cloudIntegrationsRoutes);
For detailed API documentation, see our API Reference.
The package includes comprehensive TypeScript definitions. Enable strict mode in your tsconfig.json for the best development experience:
{
"compilerOptions": {
"strict": true,
"esModuleInterop": true,
"moduleResolution": "node"
}
}
-
Asset Management
- Use consistent naming conventions for assets
- Keep asset configurations up to date
- Document asset relationships through dependencies
-
Dependency Tracking
- Document the impact level of dependencies
- Keep dependency descriptions clear and meaningful
- Regularly review and update dependency relationships
-
Maintenance
- Schedule regular preventive maintenance
- Document maintenance procedures in descriptions
- Set appropriate priority levels
-
Cloud Integration
- Use environment variables for credentials
- Validate cloud provider settings before deployment
- Monitor integration status regularly
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.