npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@vulog/aima-config

v1.2.14

Published

Configuration management module for the AIMA platform. This module provides functionality to retrieve fleet configuration, cities, services, payment parameters, and manage labels.

Downloads

1,221

Readme

@vulog/aima-config

Configuration management module for the AIMA platform. This module provides functionality to retrieve fleet configuration, cities, services, payment parameters, and manage labels.

Installation

npm install @vulog/aima-client @vulog/aima-core @vulog/aima-config

Usage

Initialize Client

import { getClient } from '@vulog/aima-client';
import { 
    getCities, 
    getServices, 
    getFleetConf, 
    getPaymentParameters,
    createLabel,
    updateLabel,
    deleteLabel,
    getLabels
} from '@vulog/aima-config';

const client = getClient({
    apiKey: 'your-api-key',
    baseUrl: 'https://your-api-base-url',
    clientId: 'your-client-id',
    clientSecret: 'your-client-secret',
    fleetId: 'your-fleet-id',
});

API Reference

Configuration Data

getCities

Retrieve all cities available in the fleet.

const cities = await getCities(client);

Parameters:

  • client: AIMA client instance

Returns: Array of city objects

getServices

Get all services available in the fleet.

const services = await getServices(client);

Parameters:

  • client: AIMA client instance

Returns: Array of service objects

getFleetConf

Retrieve fleet configuration settings.

const fleetConfig = await getFleetConf(client);

Parameters:

  • client: AIMA client instance

Returns: Fleet configuration object

getPaymentParameters

Get payment configuration parameters.

const paymentParams = await getPaymentParameters(client);

Parameters:

  • client: AIMA client instance

Returns: Payment parameters object

Label Management

createLabel

Create a new label.

const label = await createLabel(client, {
    name: 'Premium User',
    color: '#FF5733',
    description: 'High-value customers'
});

Parameters:

  • client: AIMA client instance
  • labelData: Label creation data
    • name: Label name
    • color: Label color (hex code)
    • description: Label description

updateLabel

Update an existing label.

const updatedLabel = await updateLabel(client, 'label-id-here', {
    name: 'Updated Label Name',
    color: '#33FF57',
    description: 'Updated description'
});

deleteLabel

Delete a label.

const result = await deleteLabel(client, 'label-id-here');

getLabels

Retrieve all labels.

const labels = await getLabels(client);

Types

City

interface City {
    id: string;
    name: string;
    country: string;
    countryCode: string;
    coordinates: {
        latitude: number;
        longitude: number;
    };
    timezone: string;
    isActive: boolean;
}

Service

interface Service {
    id: string;
    name: string;
    description: string;
    type: 'CAR_SHARING' | 'BIKE_SHARING' | 'SCOOTER_SHARING' | 'MULTIMODAL';
    isActive: boolean;
    features: string[];
    pricing: any;
}

FleetConfiguration

interface FleetConfiguration {
    id: string;
    name: string;
    settings: {
        timezone: string;
        currency: string;
        language: string;
        features: string[];
        limits: {
            maxVehicles: number;
            maxUsers: number;
            maxStations: number;
        };
    };
    createdAt: string;
    updatedAt: string;
}

Label

interface Label {
    id: string;
    name: string;
    color: string;
    description: string;
    createdAt: string;
    updatedAt: string;
}

Error Handling

All functions include validation and will throw appropriate errors if:

  • Required parameters are missing
  • Invalid label IDs are provided
  • Network errors occur

Examples

Complete Configuration Management

import { getClient } from '@vulog/aima-client';
import { 
    getCities, 
    getServices, 
    getFleetConf, 
    getPaymentParameters,
    createLabel,
    getLabels
} from '@vulog/aima-config';

const client = getClient({
    apiKey: 'your-api-key',
    baseUrl: 'https://your-api-base-url',
    clientId: 'your-client-id',
    clientSecret: 'your-client-secret',
    fleetId: 'your-fleet-id',
});

async function configurationWorkflow() {
    try {
        // Get fleet configuration
        const fleetConfig = await getFleetConf(client);
        console.log('Fleet configuration:', fleetConfig);
        
        // Get available cities
        const cities = await getCities(client);
        console.log(`Found ${cities.length} cities`);
        
        // Get available services
        const services = await getServices(client);
        console.log(`Found ${services.length} services`);
        
        // Get payment parameters
        const paymentParams = await getPaymentParameters(client);
        console.log('Payment parameters:', paymentParams);
        
        // Create a new label
        const label = await createLabel(client, {
            name: 'VIP Customer',
            color: '#FFD700',
            description: 'Very Important Customer'
        });
        console.log('Created label:', label);
        
        // Get all labels
        const labels = await getLabels(client);
        console.log(`Found ${labels.length} labels`);
        
        return { fleetConfig, cities, services, paymentParams, labels };
    } catch (error) {
        console.error('Configuration workflow error:', error);
        throw error;
    }
}

Service Analysis

async function analyzeServices(client) {
    try {
        const services = await getServices(client);
        
        const analysis = {
            totalServices: services.length,
            activeServices: services.filter(s => s.isActive).length,
            servicesByType: services.reduce((acc, service) => {
                acc[service.type] = (acc[service.type] || 0) + 1;
                return acc;
            }, {}),
            servicesWithFeatures: services.filter(s => s.features && s.features.length > 0).length,
            averageFeaturesPerService: services.reduce((sum, s) => sum + (s.features?.length || 0), 0) / services.length
        };
        
        console.log('Service Analysis:');
        console.log(`Total Services: ${analysis.totalServices}`);
        console.log(`Active Services: ${analysis.activeServices}`);
        console.log('Services by Type:', analysis.servicesByType);
        console.log(`Services with Features: ${analysis.servicesWithFeatures}`);
        console.log(`Average Features per Service: ${analysis.averageFeaturesPerService.toFixed(2)}`);
        
        return analysis;
    } catch (error) {
        console.error('Service analysis error:', error);
        throw error;
    }
}

City Management

async function manageCities(client) {
    try {
        const cities = await getCities(client);
        
        // Group cities by country
        const citiesByCountry = cities.reduce((acc, city) => {
            if (!acc[city.country]) {
                acc[city.country] = [];
            }
            acc[city.country].push(city);
            return acc;
        }, {});
        
        // Find cities in specific timezone
        const timezoneGroups = cities.reduce((acc, city) => {
            if (!acc[city.timezone]) {
                acc[city.timezone] = [];
            }
            acc[city.timezone].push(city);
            return acc;
        }, {});
        
        console.log('City Management:');
        console.log(`Total Cities: ${cities.length}`);
        console.log(`Active Cities: ${cities.filter(c => c.isActive).length}`);
        console.log('Cities by Country:', Object.keys(citiesByCountry).map(country => 
            `${country}: ${citiesByCountry[country].length}`
        ));
        console.log('Cities by Timezone:', Object.keys(timezoneGroups).map(tz => 
            `${tz}: ${timezoneGroups[tz].length}`
        ));
        
        return { cities, citiesByCountry, timezoneGroups };
    } catch (error) {
        console.error('City management error:', error);
        throw error;
    }
}