UNPKG

@geoapify/route-planner-sdk

Version:

TypeScript SDK for the Geoapify Route Planner API. Supports route optimization, delivery planning, and timeline visualization in browser and Node.js

137 lines (136 loc) 4.15 kB
export class Violation { constructor(message, agentIndex) { this.agentIndex = agentIndex; this.message = message; this.name = 'Violation'; } toString() { return this.message; } } export class AgentPickupCapacityExceeded extends Violation { constructor(message, agentIndex, totalAmount, capacity) { super(message, agentIndex); this.totalAmount = totalAmount; this.capacity = capacity; this.name = 'AgentPickupCapacityExceeded'; } } export class AgentDeliveryCapacityExceeded extends Violation { constructor(message, agentIndex, totalAmount, capacity) { super(message, agentIndex); this.totalAmount = totalAmount; this.capacity = capacity; this.name = 'AgentDeliveryCapacityExceeded'; } } export class AgentMissingCapability extends Violation { constructor(message, agentIndex, missingCapabilities) { super(message, agentIndex); this.missingCapabilities = missingCapabilities; this.name = 'AgentMissingCapability'; } } export class TimeWindowViolation extends Violation { constructor(message, agentIndex) { super(message, agentIndex); this.name = 'TimeWindowViolation'; } } export class BreakViolation extends Violation { constructor(message, agentIndex) { super(message, agentIndex); this.name = 'BreakViolation'; } } export class InvalidParameter extends Error { constructor(message, parameterName) { super(message); this.parameterName = parameterName; this.name = 'InvalidParameter'; } } export class AgentNotFound extends Error { constructor(message, agentIdOrIndex) { super(message); this.agentIdOrIndex = agentIdOrIndex; this.name = 'AgentNotFound'; } } export class JobNotFound extends Error { constructor(message, jobIdOrIndex) { super(message); this.jobIdOrIndex = jobIdOrIndex; this.name = 'JobNotFound'; } } export class ShipmentNotFound extends Error { constructor(message, shipmentIdOrIndex) { super(message); this.shipmentIdOrIndex = shipmentIdOrIndex; this.name = 'ShipmentNotFound'; } } export class AgentHasNoPlan extends Error { constructor(message, agentIndex) { super(message); this.agentIndex = agentIndex; this.name = 'AgentHasNoPlan'; } } export class ItemsNotUnique extends Error { constructor(message, itemType) { super(message); this.itemType = itemType; this.name = 'ItemsNotUnique'; } } export class NoItemsProvided extends Error { constructor(message, itemType) { super(message); this.itemType = itemType; this.name = 'NoItemsProvided'; } } export class ItemAlreadyAssigned extends Error { constructor(message, itemType, itemIndex, agentIndex) { super(message); this.itemType = itemType; this.itemIndex = itemIndex; this.agentIndex = agentIndex; this.name = 'ItemAlreadyAssigned'; } } export class InvalidInsertionPosition extends Error { constructor(message, agentIndex, waypointIndex, actionId) { super(message); this.agentIndex = agentIndex; this.waypointIndex = waypointIndex; this.actionId = actionId; this.name = 'InvalidInsertionPosition'; } } export class UnknownStrategy extends Error { constructor(message, strategy, operationType) { super(message); this.strategy = strategy; this.operationType = operationType; this.name = 'UnknownStrategy'; } } export class RouteMatrixApiError extends Error { constructor(message, statusCode, statusText) { super(message); this.statusCode = statusCode; this.statusText = statusText; this.name = 'RouteMatrixApiError'; } } export class RoutingApiError extends Error { constructor(message, statusCode, statusText) { super(message); this.statusCode = statusCode; this.statusText = statusText; this.name = 'RoutingApiError'; } }