Kaizen
Browse modulesPeripheralsperipherals/serverFunctions

Function: createServerTransport()

function createServerTransport(device: {
  connection:   | {
     kind: "webusb";
     usbProductId: number;
     usbSerialNumber?: string | null;
     usbVendorId: number;
   }
     | {
     host: string;
     kind: "network";
     port: number;
   }
     | {
     kind: "qz";
     printerName: string;
   };
  deviceType: "receipt_printer" | "cash_drawer" | "barcode_scanner";
  drawerPin?: 2 | 5 | null;
  id: string;
  make?: string | null;
  metadata?: Record<string, unknown> | null;
  model?: string | null;
  name: string;
  organizationId: string;
  paperWidthChars?: 32 | 35 | 42 | 44 | 48 | null;
  printerLanguage?: "esc-pos" | "star-prnt" | "star-line" | null;
  stationId?: string | null;
  status: "active" | "inactive";
  storeId?: string | null;
}): Promise<PrinterTransport>;

Defined in: server/peripherals/create-server-transport.ts:11

Build a connected transport for a registry device, server-side. Only network devices are reachable from Node — WebUSB lives in the browser and QZ Tray's adapter is a planned follow-up.

Parameters

ParameterTypeDescription
device{ connection: | { kind: "webusb"; usbProductId: number; usbSerialNumber?: string | null; usbVendorId: number; } | { host: string; kind: "network"; port: number; } | { kind: "qz"; printerName: string; }; deviceType: "receipt_printer" | "cash_drawer" | "barcode_scanner"; drawerPin?: 2 | 5 | null; id: string; make?: string | null; metadata?: Record<string, unknown> | null; model?: string | null; name: string; organizationId: string; paperWidthChars?: 32 | 35 | 42 | 44 | 48 | null; printerLanguage?: "esc-pos" | "star-prnt" | "star-line" | null; stationId?: string | null; status: "active" | "inactive"; storeId?: string | null; }-
device.connection| { kind: "webusb"; usbProductId: number; usbSerialNumber?: string | null; usbVendorId: number; } | { host: string; kind: "network"; port: number; } | { kind: "qz"; printerName: string; }-
device.deviceType"receipt_printer" | "cash_drawer" | "barcode_scanner"-
device.drawerPin?2 | 5 | nullDrawer-kick pin — on printer rows (drawer wired to the printer) or standalone cash_drawer rows.
device.idstring-
device.make?string | null-
device.metadata?Record<string, unknown> | null-
device.model?string | null-
device.namestring-
device.organizationIdstring-
device.paperWidthChars?32 | 35 | 42 | 44 | 48 | nullCharacter columns at the printer's default font.
device.printerLanguage?"esc-pos" | "star-prnt" | "star-line" | nullRequired for receipt printers; meaningless for scanners.
device.stationId?string | null-
device.status"active" | "inactive"-
device.storeId?string | null-

Returns

Promise<PrinterTransport>

On this page