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-vehicle

v1.2.14

Published

Vehicle management module for AIMA platform.

Downloads

1,190

Readme

@vulog/aima-vehicle

Vehicle management module for AIMA platform.

Installation

npm i @vulog/aima-client @vulog/aima-core @vulog/aima-vehicle

Usage

Initialize Client

import { getClient } from '@vulog/aima-client';
import { getVehicles, getModelById, getModels, getVehicleById, getVehiclesRealTime } from '@vulog/aima-vehicle';

const client = getClient({
    apiKey: '...',
    baseUrl: '...',
    clientId: '...',
    clientSecret: '...',
    fleetId: '...',
});

Get All Vehicles

Fetches all vehicles with pagination (default page size: 500). The implementation uses an internal getVehiclesPage function to fetch individual pages of vehicles.

// Get all vehicles
const vehicles = await getVehicles(client);

// Get all vehicles with custom page size
const vehicles = await getVehicles(client, 1000);

The getVehicles function automatically handles pagination and will fetch all available vehicles up to a maximum of 50 pages. If you need to fetch a specific page of vehicles, you can use the internal getVehiclesPage function:

// Get a specific page of vehicles
const vehiclesPage = await getVehiclesPage(client, 0, 100); // First page, 100 vehicles per page

Note: getVehiclesPage is an internal function and is not exported from the package. It's used internally by getVehicles to handle the pagination logic.

Get Vehicle by ID

Fetches a specific vehicle by its ID.

const vehicle = await getVehicleById(client, 'dcb0c41e-4be3-11ea-83a5-024d0cba6da4');

Get All Models

Fetches all vehicle models.

const models = await getModels(client);

Get Model by ID

Fetches a specific model by its ID.

const model = await getModelById(client, 372);

Get Real-Time Vehicle Data

Fetches real-time data for all vehicles with pagination (default page size: 500). The implementation uses an internal getVehiclesRealTimePage function to fetch individual pages of real-time vehicle data.

// Get real-time data for all vehicles
const realTimeVehicles = await getVehiclesRealTime(client);

// Get real-time data with custom page size
const realTimeVehicles = await getVehiclesRealTime(client, 1000);

// Get only vehicles updated after a specific timestamp (in UTC milliseconds)
const lastSyncTime = Date.now() - 24 * 60 * 60 * 1000; // 24 hours ago
const updatedVehicles = await getVehiclesRealTime(client, 500, lastSyncTime);

The getVehiclesRealTime function automatically handles pagination and will fetch all available vehicles up to a maximum of 50 pages. If you need to fetch a specific page of real-time vehicle data, you can use the internal getVehiclesRealTimePage function:

// Get a specific page of real-time vehicle data
const realTimeVehiclesPage = await getVehiclesRealTimePage(client, 0, 100); // First page, 100 vehicles per page

// Get a specific page with lastUpdatedMillis filter
const updatedVehiclesPage = await getVehiclesRealTimePage(client, 0, 100, lastSyncTime);

Note: getVehiclesRealTimePage is an internal function and is not exported from the package. It's used internally by getVehiclesRealTime to handle the pagination logic.

Types

Vehicle

interface Vehicle {
    id: string;
    name: string;
    plate: string;
    vin: string;
    model: Model;
    options: Options[];
    createDate: string;
    updateDate: string;
    fleetId: string;
    externalId: string;
    wakeupProvider?: string;
    msisdn: string;
    iccid: string;
    imsi?: string;
    published: boolean;
    noBox: boolean;
    archived: boolean;
}

Model

interface Model {
    id: number;
    name: string;
    energyType: string;
    status: string;
    nbOfSeats: number;
    autonomy: number;
    creationDate: string;
    updateDate: string;
    description: string;
    fleetId: string;
    vehicleType: string;
    transmission: string;
    outOfServiceRange: string;
    recoveryRange: string;
    incentiveThresholds: any[];
    redistributeVehicleChargedEnoughRange: string;
    odometerReliable?: boolean;
}

Options

interface Options {
    id: number;
    fleetId: string;
    name: string;
    type: string;
    description: string;
}

VehicleRealTime

interface VehicleRealTime {
    id: string;
    name: string;
    plate: string;
    vin: string;
    fleetid: string;
    boxid: string;
    vehicle_status: number;
    zones: Zone[];
    releasable: boolean;
    box_status: number;
    autonomy: number;
    autonomy2: number;
    isCharging: boolean;
    battery: number;
    km: number;
    speed: number;
    location: {
        geohash: string;
        cap: number;
        latitude: number;
        longitude: number;
        gpsDate: string;
        lastMovingDate: string;
    };
    endTripLocation: {
        latitude: number;
        longitude: number;
    };
    endZoneIds: [];
    productIds: [];
    isDoorClosed: boolean;
    isDoorLocked: boolean;
    engineOn: boolean;
    immobilizerOn: boolean;
    secureOn: boolean;
    spareLockOn: boolean | null;
    pileLockOn: boolean | null;
    helmetPresent: boolean | null;
    helmet2Present: boolean | null;
    helmetBoxLockOn: boolean | null;
    helmet2LockOn: boolean | null;
    userId: string | null;
    user_locale: string | null;
    rfid: string | null;
    orderId: string | null;
    gatewayUrl: string | null;
    booking_status: number;
    booking_date: string | null;
    expiresOn: boolean | null;
    last_active_date: string;
    last_wakeUp_date: string;
    version: string;
    pricingId: string | null;
    start_date: string | null;
    theorStartDate: string | null;
    theorEndDate: string | null;
    startZones: Zone[];
    endZones: Zone[];
    disabled: boolean;
    outOfServiceReason: string;
    ignitionOffGeohash: string | null;
    geohashNeighbours: string[];
    cleanlinessStatus: boolean;
    needsRedistribution: boolean;
    batteryUnderThreshold: boolean;
    isBeingTowed: boolean;
    automaticallyEnableVehicleAfterRangeRecovery: boolean;
    key: {
        deviceName: string;
    };
    doNotTrack: boolean;
    energyLevel: number;
    lastOosDate: string;
    hasAlerts: boolean;
    firmwareModel: string;
    comeFromApp: string;
    doors: {
        frontLeftClosed: boolean;
        frontRightClosed: boolean;
        rearLeftClosed: boolean;
        rearRightClosed: boolean;
        trunkClosed: boolean;
        hoodClosed: boolean;
    };
    windows: {
        frontLeftClosed: boolean;
        frontRightClosed: boolean;
        rearLeftClosed: boolean;
        rearRightClosed: boolean;
        trunkClosed: boolean;
    };
    doorsAndWindowsClosed: boolean;
    vpChecksum: string;
    firmwareBuildDate: string;
}