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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vulog/aima-unavailability

v1.2.48

Published

Vehicle unavailability management — CRUD operations and cron expression generation.

Readme

@vulog/aima-unavailability

Vehicle unavailability management — CRUD operations and cron expression generation.

Installation

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

Usage

import { getUnavailabilities, createUnavailability, generateCronExpression } from '@vulog/aima-unavailability';
import { getClient } from '@vulog/aima-client';

const client = getClient({ ... });

const cron = generateCronExpression('2024-06-01T09:00:00', 'Europe/Paris');

const unavailability = await createUnavailability(client, {
    cronExpression: cron,
    duration: 3600,
    maintenanceTitle: 'Scheduled service',
    vehicleId: 'vehicle-uuid',
});

API Reference

getUnavailabilitiesByVehicle

getUnavailabilitiesByVehicle(client: Client, vehicleId: string): Promise<Unavailability[]>

Returns all unavailabilities for a specific vehicle.

| Param | Type | Description | | ----------- | -------- | ------------------------- | | client | Client | Authenticated AIMA client | | vehicleId | string | Vehicle identifier |


getUnavailabilities

getUnavailabilities(client: Client, options: UnavailabilityOptions): Promise<Unavailability[]>

Returns all unavailabilities in a time range. Auto-paginates up to 50 pages; throws if that limit is exceeded.

| Param | Type | Description | | --------- | ---------------------- | ------------------------- | | client | Client | Authenticated AIMA client | | options | UnavailabilityOptions| Date range and page |


createUnavailability

createUnavailability(client: Client, body: CreateUnavailabilityBody): Promise<Unavailability>

Creates a new unavailability entry.

| Param | Type | Description | | -------- | ------------------------- | ------------------------- | | client | Client | Authenticated AIMA client | | body | CreateUnavailabilityBody| Creation payload |


updateUnavailability

updateUnavailability(client: Client, id: number, body: UpdateUnavailabilityBody): Promise<Unavailability>

Updates an existing unavailability entry.

| Param | Type | Description | | -------- | ------------------------- | ------------------------- | | client | Client | Authenticated AIMA client | | id | number | Unavailability ID | | body | UpdateUnavailabilityBody| Update payload |


deleteUnavailability

deleteUnavailability(client: Client, id: number): Promise<void>

Deletes an unavailability by ID. Idempotent — 404 responses are silently ignored.

| Param | Type | Description | | -------- | -------- | ------------------------- | | client | Client | Authenticated AIMA client | | id | number | Unavailability ID |


deleteUnavailabilitiesByVehicle

deleteUnavailabilitiesByVehicle(client: Client, vehicleId: string): Promise<void>

Deletes all unavailabilities for a vehicle. Idempotent — 404 responses are silently ignored.

| Param | Type | Description | | ----------- | -------- | ------------------------- | | client | Client | Authenticated AIMA client | | vehicleId | string | Vehicle identifier |


generateCronExpression

generateCronExpression(date: Date | string, timezone?: string): string

Pure utility — no Client required. Generates a Quartz cron expression in the format "second minute hour day month ? year". Without a timezone, local time is used. With a timezone (e.g. 'Europe/Paris'), the date is converted via Intl.DateTimeFormat.

| Param | Type | Description | | ---------- | ----------------- | ------------------------------------- | | date | Date \| string | The target date/time | | timezone | string | IANA timezone name (optional) |

Returns a Quartz cron string.

Types

Unavailability

{
    id: number;
    cronExpression: string;
    duration: number;
    maintenanceTitle: string;
    vehicleId: string;
}

CreateUnavailabilityBody

{
    cronExpression: string;
    duration: number;
    maintenanceTitle: string;
    vehicleId: string;
}

UpdateUnavailabilityBody

Alias for CreateUnavailabilityBody.

UnavailabilityOptions

{
    from: string;   // ISO datetime without timezone offset, e.g. '2024-01-01T00:00:00'
    to: string;     // ISO datetime without timezone offset
    page?: number;
}