Saltar al contenido

Tipos y valores del protocolo ​

Definiciones de opciones, cargas útiles y valores. Consulta la API de tipos públicos para las importaciones admitidas desde la raíz del paquete.

jsd.types.ts ​

MachineStatusName ​

ts
export type MachineStatusName = 'NO-CONNECTED' | 'CONNECTED' | 'LOST';

MachineStatusKey ​

ts
export type MachineStatusKey = 0 | 1 | 2;

MachineStatusMap ​

ts
export type MachineStatusMap = 'NO-CONNECTED' | 'AVAILABLE' | 'SOLD-OUT' | 'FAULT';

MachineAvailableStatus ​

ts
export type MachineAvailableStatus =
  | 'AVAILABLE-TO-DISPENSE'
  | 'NOT-AVAILABLE-TO-DISPENSE'
  | 'ALREADY-DISPENSING'
  | 'WAITING-COLLECTION'
  | 'ELEVATOR-COLLECTION-POSITION'
  | 'UNCOLLECTED';

MachineStatus ​

ts
export interface MachineStatus {
  status: MachineStatusName;
  machineInService: boolean;
  doorOpen: boolean;
  availabilityToDispense: MachineAvailableStatus;
  hasLightsOn: boolean;
  temperature: string;
}

GeneralMachine ​

ts
export interface GeneralMachine {
  machine: MachineValid;
}

RequestStatusOptions ​

ts
export interface RequestStatusOptions {
  machine: MachineValid;
  tray: ValidTray;
  channel: ValidChannel;
}

AddChannelToSelectionOptions ​

ts
export interface AddChannelToSelectionOptions {
  selection: OneTo240;
  machine: MachineValid;
  tray: ValidTray;
  channel: ValidChannel;
}

ProgramWorkingTemperatureOptions ​

ts
export interface ProgramWorkingTemperatureOptions {
  machine: MachineValid;
  temperature: number;
  enable: boolean;
}

RequestFaultMachineOptions ​

ts
export interface RequestFaultMachineOptions {
  machine: MachineValid;
  type: 'report-active' | 'report-inactive' | 'clear-inactive';
}

ConfigurePerishableProductsOptions ​

ts
export interface ConfigurePerishableProductsOptions {
  machine: MachineValid;
  enable: boolean;
  temperatureLimit: number;
  minutesToExpiry: number;
}

DispenseFromChannelOptions ​

ts
export interface DispenseFromChannelOptions {
  machine: MachineValid;
  tray: ValidTray;
  channel: ValidChannel;
  speed: SpeedOption;
  timePostRun: TimePostRunOption;
  cart?: boolean;
}

ControlLightsOptions ​

ts
export interface ControlLightsOptions {
  machine: MachineValid;
  turnOn: boolean;
  alias: string;
}

DispenseFromChannelExtendedOptions ​

ts
export interface DispenseFromChannelExtendedOptions extends DispenseFromChannelOptions {
  fragileOrHeavy: boolean;
  typeAdjustElevator: 'lower' | 'upper';
  timeAdjustElevator: number;
  cart?: boolean;
}

SelectionStatus ​

ts
export interface SelectionStatus {
  selection: number;
  active: boolean;
  machine: MachineValid;
}

PerformingChannelAssignment ​

ts
export interface PerformingChannelAssignment {
  enabled: boolean;
  selections: SelectionStatus[];
  currentSelection: Range<0, 81>;
}

Range0To81 ​

ts
export type Range0To81 = Range<0, 81>;

BuildPacketResult ​

ts
export interface BuildPacketResult {
  bytes: number[];
  packetId: number;
}

DispenseOptions ​

ts
export interface DispenseOptions {
  machine: MachineValid;
  selection: Range0To81;
  speed?: SpeedOption;
  timePostRun?: TimePostRunOption;
  cart?: boolean;
}

visionClient.types.ts ​

Enumerate ​

ts
type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc['length']]>;

Range ​

ts
export type Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>> | F;

ValidTray ​

ts
export type ValidTray = Range<11, 19>;

ValidChannel ​

ts
export type ValidChannel = Range<0, 10>;

OneTo240 ​

ts
export type OneTo240 = Range<1, 241>;

SpeedOption ​

ts
export type SpeedOption = Range<0, 22>;

TimePostRunOption ​

ts
export type TimePostRunOption = Range<0, 256>;

MachineValid ​

ts
export type MachineValid = Range<1, 5>;

GeneralMachine ​

ts
export interface GeneralMachine {
  machine: ValidMachineIndex;
}

RequestStatusOptions ​

ts
export interface RequestStatusOptions {
  machine: ValidMachineIndex;
  tray: ValidTray;
  channel: ValidChannel;
}

RequestStatusSelectionOptions ​

ts
export interface RequestStatusSelectionOptions {
  selection: OneTo240;
}

ConfigureSelectionDispenseOptions ​

ts
export interface ConfigureSelectionDispenseOptions {
  selection: OneTo240;
  speed: SpeedOption;
  timePostRun: TimePostRunOption;
}

AddChannelToSelectionOptions ​

ts
export interface AddChannelToSelectionOptions {
  selection: OneTo240;
  machine: ValidMachineIndex;
  tray: ValidTray;
  channel: ValidChannel;
}

ChannelLinkedToSelectionOptions ​

ts
export interface ChannelLinkedToSelectionOptions {
  selection: OneTo240;
}

ProgramWorkingTemperatureOptions ​

ts
export interface ProgramWorkingTemperatureOptions {
  machine: ValidMachineIndex;
  temperature: number;
  enable: boolean;
}

ProgramWaitingTimingsOptions ​

ts
export interface ProgramWaitingTimingsOptions {
  collectPosition: Range<1, 11>;
  dispenseManoeuvres: Range<0, 66>;
  afterPickup: Range<1, 256>;
}

ProgramTimeWaitingAfterPickupOptions ​

ts
export interface ProgramTimeWaitingAfterPickupOptions {
  time: Range<15, 121>;
}

RequestFaultMachineOptions ​

ts
export interface RequestFaultMachineOptions {
  machine: ValidMachineIndex;
  type: 'report-active' | 'report-inactive' | 'clear-inactive';
}

ManageJSDDispensingQueueOptions ​

ts
export interface ManageJSDDispensingQueueOptions {
  type: Range<0, 2>; // 0-1
}

DefineSpecialCharacteristicsSelectionOptions ​

ts
export interface DefineSpecialCharacteristicsSelectionOptions {
  selection: OneTo240;
  perishable: boolean;
  fragileOrHeavy: boolean;
  typeAdjustElevator: 'lower' | 'upper';
  timeAdjustElevator: number;
}

SpecialCharacteristicsSelectionOptions ​

ts
export interface SpecialCharacteristicsSelectionOptions {
  selection: OneTo240;
}

ConfigurePerishableProductsOptions ​

ts
export interface ConfigurePerishableProductsOptions {
  machine: ValidMachineIndex;
  enable: boolean;
  temperatureLimit: number;
  minutesToExpiry: number;
}

ConfigureExtendedDispenseStatusDataOptions ​

ts
export interface ConfigureExtendedDispenseStatusDataOptions {
  enable: boolean;
}

DispenseToken ​

ts
export type DispenseToken = string & { readonly __brand: 'DispenseToken' };

DispenseFromChannelOptions ​

ts
export interface DispenseFromChannelOptions {
  token: DispenseToken;
  machine: ValidMachineIndex;
  tray: ValidTray;
  channel: ValidChannel;
  speed: SpeedOption;
  timePostRun: TimePostRunOption;
}

DispenseStatusOptions ​

ts
export interface DispenseStatusOptions {
  token: DispenseToken;
}

DispenseFromSelectionOptions ​

ts
export interface DispenseFromSelectionOptions {
  token?: DispenseToken;
  selection: OneTo240;
  cart?: boolean;
}

ControlLightsOptions ​

ts
export interface ControlLightsOptions {
  machine: ValidMachineIndex;
  turnOn: boolean;
}

DispenseFromChannelExtendedOptions ​

ts
export interface DispenseFromChannelExtendedOptions extends DispenseFromChannelOptions {
  fragileOrHeavy: boolean;
  typeAdjustElevator: 'lower' | 'upper';
  timeAdjustElevator: number;
}

StatusSelectionName ​

ts
export type StatusSelectionName = 'NO-CONFIGURED' | 'ASSOCIATED' | 'NO-ASSOCIATED' | 'NO-VISION-OWNED' | 'EXPIRED' | 'NO-CONFIGURED';

StatusChannelsLinkedToSelection ​

ts
export type StatusChannelsLinkedToSelection = 'OK' | 'ALREADY-DEFINED' | 'OUT-OF-RANGE' | null | 'UNKNOWN';

JsdResetStatus ​

ts
export type JsdResetStatus = 'RESETED' | 'RECEIVED' | 'UNKNOWN';

VisionDispensingToken ​

ts
export interface VisionDispensingToken {
  cart: boolean;
  resolve: (dispensed: boolean) => void;
  reject: (error: Error) => void;
}

VisionDispensingTokens ​

ts
export type VisionDispensingTokens = Record<string, VisionDispensingToken>;

LicensingClient.ts ​

manifestClient.ts ​

Month ​

ts
type Month = `0${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}` | `1${0 | 1 | 2}`;

Day ​

ts
type Day = `0${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}` | `${1 | 2}${number}` | `3${0 | 1}`;

Hour ​

ts
type Hour = `0${number}` | `1${number}` | `2${0 | 1 | 2 | 3}`;

Minute ​

ts
type Minute = `${0 | 1 | 2 | 3 | 4 | 5}${number}`;

Second ​

ts
type Second = Minute;

DateMMDDhhmmss ​

ts
export type DateMMDDhhmmss = `${Month}/${Day}/${Hour}/${Minute}/${Second}`;

mdbCardHolder.types.ts ​

DEVICE_NUMBER ​

ts
export type DEVICE_NUMBER = 1 | 2;

MdbCardHolderStatus ​

ts
export type MdbCardHolderStatus = 'inactive' | 'disabled' | 'enabled' | 'on hold' | 'selling' | 'reevaluate';

MdbConnectionStatus ​

ts
export type MdbConnectionStatus = 'disconnected' | 'connected' | 'loss of communication';

MdbCardEndSession ​

ts
export type MdbCardEndSession = 'unable to execute' | 'petition initiated';

MdbCardSaleApprovalStatus ​

ts
export type MdbCardSaleApprovalStatus = MdbCardEndSession | 'sale denied' | 'sale approved';

MdbCardSaleSuccessStatus ​

ts
export type MdbCardSaleSuccessStatus = MdbCardEndSession | 'the card has been updated';

MdbCardSaleFailureStatus ​

ts
export type MdbCardSaleFailureStatus = MdbCardEndSession | 'refund error' | 'refund made';

MdbCardProductOptions ​

ts
export type MdbCardProductOptions = 'default' | 'sugar-free' | 'intermediate' | 'sugar-max';

MdbCardRevalueStatus ​

ts
export type MdbCardRevalueStatus = MdbCardEndSession | 'revalue denied' | 'revalue approved';

SelectionRequestDeniedReasonCode ​

ts
export type SelectionRequestDeniedReasonCode =
  | 'unknown'
  | 'product-not-available'
  | 'out-of-stock'
  | 'faulty-selection'
  | 'no-ingredients'
  | 'selection-locked'
  | 'inhibited-selection'
  | 'expired-product'
  | 'temperature'
  | 'occupied-machine'
  | 'insufficient-credit'
  | 'temporarily-occupied-machine';

MdbCardConfiguration ​

ts
export type MdbCardConfiguration = {
  connectionStatus: MdbConnectionStatus;
  status: MdbCardHolderStatus;
  alwaysIdle: {
    available: boolean;
    enabled: boolean;
  };
  remoteVend: {
    available: boolean;
    enabled: boolean;
  };
  info: {
    manufacturerCode: string | null;
    serialNumber: string | null;
    model: string | null;
    softwareVersion: string | null;
  };
  countryCurrencyCode: string | null;
  abilities: {
    reloadFunds: boolean;
    restoreFunds: boolean;
    multipleSales: boolean;
    hasDisplay: boolean;
    recordCashSales: boolean;
  };
  balance: {
    tokenStatus: null | 'active' | 'idle';
    customer: number;
    maxCardRecharge: number;
    paymentMethod: {
      isKnown: boolean;
      id: string | null;
    };
    userGroup: null | string;
  };
};

MdbCardConfigDevices ​

ts
export type MdbCardConfigDevices = {
  no1: MdbCardConfiguration;
  no2: MdbCardConfiguration;
};

public.types.ts ​

JSDTransport ​

ts
export type JSDTransport = 'rs232' | 'tcpip';

JSDOptions ​

ts
export interface JSDOptions {
  /** JSD framing strategy. Defaults to `rs232`. */
  transport?: JSDTransport;
  /** Reserved machine selection for consumers that keep a preferred machine. */
  machine?: MachineValid;
}

JSDConfig ​

ts
export type JSDConfig = SerialConfig;

JSDParser ​

ts
export type JSDParser = NonNullable<SerialConfig['parser']>;

JSDParserFactory ​

ts
export type JSDParserFactory = NonNullable<SerialConfig['parserFactory']>;

JSDHandshake ​

ts
export type JSDHandshake = NonNullable<SerialConfig['handshake']>;

responseHandler.ts ​

VisionResponse ​

ts
export interface VisionResponse {
  type: 'ACK' | 'NACK' | 'DATA';
  id: number;
  opcode?: number;
  appId?: number;
  noBytes?: number;
  params?: string[];
  rawAscii?: string;
}

Protocolo explícito, eventos tipados y transporte aislado.