Class: PeripheralDeviceService
Defined in: server/peripherals/peripheral-device-service.ts:102
Constructors
Constructor
new PeripheralDeviceService(deps: PeripheralsFeatureDeps): PeripheralDeviceService;Defined in: server/peripherals/peripheral-device-service.ts:103
Parameters
| Parameter | Type |
|---|---|
deps | PeripheralsFeatureDeps |
Returns
PeripheralDeviceService
Methods
deactivate()
deactivate(id: string): Promise<{
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;
}>;Defined in: server/peripherals/peripheral-device-service.ts:229
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
Promise<{
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;
}>
getById()
getById(id: string): Promise<{
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;
}>;Defined in: server/peripherals/peripheral-device-service.ts:158
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
Promise<{
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;
}>
listForOrg()
listForOrg(organizationId: string, filter?: {
deviceType?: "receipt_printer" | "cash_drawer" | "barcode_scanner";
stationId?: string;
status?: "active" | "inactive";
storeId?: string;
}): Promise<{
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;
}[]>;Defined in: server/peripherals/peripheral-device-service.ts:169
Rows that fail device validation (written before the rules existed, or edited out-of-band) are OMITTED rather than failing the whole list — one corrupt row must not take down a station's device enumeration. Use listInvalidForOrg to surface the omitted rows for repair.
Parameters
| Parameter | Type |
|---|---|
organizationId | string |
filter | { deviceType?: "receipt_printer" | "cash_drawer" | "barcode_scanner"; stationId?: string; status?: "active" | "inactive"; storeId?: string; } |
filter.deviceType? | "receipt_printer" | "cash_drawer" | "barcode_scanner" |
filter.stationId? | string |
filter.status? | "active" | "inactive" |
filter.storeId? | string |
Returns
Promise<{
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;
}[]>
listForStation()
listForStation(organizationId: string, scope?: {
deviceType?: "receipt_printer" | "cash_drawer" | "barcode_scanner";
stationId?: string;
storeId?: string;
}): Promise<{
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;
}[]>;Defined in: server/peripherals/peripheral-device-service.ts:190
Active devices a station should offer: rows pinned to the station plus org-wide rows (no store/station pin). Rows pinned elsewhere are excluded; rows failing validation are omitted (see listForOrg).
Parameters
| Parameter | Type |
|---|---|
organizationId | string |
scope | { deviceType?: "receipt_printer" | "cash_drawer" | "barcode_scanner"; stationId?: string; storeId?: string; } |
scope.deviceType? | "receipt_printer" | "cash_drawer" | "barcode_scanner" |
scope.stationId? | string |
scope.storeId? | string |
Returns
Promise<{
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;
}[]>
listInvalidForOrg()
listInvalidForOrg(organizationId: string): Promise<{
id: string;
name: string;
reason: string;
}[]>;Defined in: server/peripherals/peripheral-device-service.ts:210
The rows the list methods omit, with why — the admin recovery surface.
Each entry's id can be fed to update (a repairing patch is accepted:
the merged shape just has to validate) or softDelete.
Parameters
| Parameter | Type |
|---|---|
organizationId | string |
Returns
Promise<{
id: string;
name: string;
reason: string;
}[]>
register()
register(input: {
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;
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;
storeId?: string | null;
}): Promise<{
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;
}>;Defined in: server/peripherals/peripheral-device-service.ts:109
Parameters
| Parameter | Type | Description |
|---|---|---|
input | { 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; 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; storeId?: string | null; } | - |
input.connection | | { kind: "webusb"; usbProductId: number; usbSerialNumber?: string | null; usbVendorId: number; } | { host: string; kind: "network"; port: number; } | { kind: "qz"; printerName: string; } | - |
input.deviceType | "receipt_printer" | "cash_drawer" | "barcode_scanner" | - |
input.drawerPin? | 2 | 5 | null | Drawer-kick pin — on printer rows (drawer wired to the printer) or standalone cash_drawer rows. |
input.make? | string | null | - |
input.metadata? | Record<string, unknown> | null | - |
input.model? | string | null | - |
input.name | string | - |
input.organizationId | string | - |
input.paperWidthChars? | 32 | 35 | 42 | 44 | 48 | null | Character columns at the printer's default font. |
input.printerLanguage? | "esc-pos" | "star-prnt" | "star-line" | null | Required for receipt printers; meaningless for scanners. |
input.stationId? | string | null | - |
input.storeId? | string | null | - |
Returns
Promise<{
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;
}>
softDelete()
softDelete(id: string): Promise<void>;Defined in: server/peripherals/peripheral-device-service.ts:233
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
Promise<void>
update()
update(id: string, input: {
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;
make?: string | null;
metadata?: Record<string, unknown> | null;
model?: string | null;
name?: 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<{
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;
}>;Defined in: server/peripherals/peripheral-device-service.ts:124
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | - |
input | { 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; make?: string | null; metadata?: Record<string, unknown> | null; model?: string | null; name?: 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; } | - |
input.connection? | | { kind: "webusb"; usbProductId: number; usbSerialNumber?: string | null; usbVendorId: number; } | { host: string; kind: "network"; port: number; } | { kind: "qz"; printerName: string; } | - |
input.deviceType? | "receipt_printer" | "cash_drawer" | "barcode_scanner" | - |
input.drawerPin? | 2 | 5 | null | Drawer-kick pin — on printer rows (drawer wired to the printer) or standalone cash_drawer rows. |
input.make? | string | null | - |
input.metadata? | Record<string, unknown> | null | - |
input.model? | string | null | - |
input.name? | string | - |
input.paperWidthChars? | 32 | 35 | 42 | 44 | 48 | null | Character columns at the printer's default font. |
input.printerLanguage? | "esc-pos" | "star-prnt" | "star-line" | null | Required for receipt printers; meaningless for scanners. |
input.stationId? | string | null | - |
input.status? | "active" | "inactive" | - |
input.storeId? | string | null | - |
Returns
Promise<{
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;
}>