This commit is contained in:
seb
2026-09-27 16:47:37 +02:00
parent cd57f21af8
commit 516feb51d4
6 changed files with 115 additions and 10 deletions

View File

@@ -9,7 +9,7 @@ import {
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
import makeRunner from '../runner.js';
const VALID_TYPES = new Set(['esc/pos', 'zpl']);
const VALID_TYPES = new Set(['esc/pos', 'zpl', 'ipp']);
function shape(row) {
return {
@@ -42,7 +42,7 @@ export default function create(provider) {
* @param {number} googleAuthId - The id of the Google auth user.
* @param {object} input - Printer input.
* @param {string} input.address - Printer address (network IP/host/path).
* @param {string} input.type - Printer type ("esc/pos" or "zpl").
* @param {string} input.type - Printer type ("esc/pos", "zpl", or "ipp").
* @param {string} [input.model] - Optional printer model name.
* @param {string} [input.serial] - Optional printer serial number.
* @param {number} [input.sort] - Optional sort order (auto-increments if omitted).
@@ -67,7 +67,7 @@ export default function create(provider) {
const type = typeof input.type === 'string' ? input.type.trim() : '';
if (!type || !VALID_TYPES.has(type)) {
throw new Error('Invalid printer type: must be "esc/pos" or "zpl"');
throw new Error('Invalid printer type: must be "esc/pos", "zpl", or "ipp"');
}
const runner = makeRunner(provider, tx);

View File

@@ -9,7 +9,7 @@ import {
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
import makeRunner from '../runner.js';
const VALID_TYPES = new Set(['esc/pos', 'zpl']);
const VALID_TYPES = new Set(['esc/pos', 'zpl', 'ipp']);
function shape(row) {
return {
@@ -43,7 +43,7 @@ export default function update(provider) {
* @param {number} id - The printer ID to update.
* @param {object} input - Update payload.
* @param {string} [input.address] - The printer address.
* @param {string} [input.type] - The printer type ("esc/pos" or "zpl").
* @param {string} [input.type] - The printer type ("esc/pos", "zpl", or "ipp").
* @param {string|null} [input.model] - The printer model.
* @param {string|null} [input.serial] - The printer serial.
* @param {number} [input.sort] - The sort order.
@@ -80,7 +80,7 @@ export default function update(provider) {
if (input.type !== undefined) {
const cleaned = typeof input.type === 'string' ? input.type.trim() : '';
if (!cleaned || !VALID_TYPES.has(cleaned)) {
throw new Error('Invalid printer type: must be "esc/pos" or "zpl"');
throw new Error('Invalid printer type: must be "esc/pos", "zpl", or "ipp"');
}
type = cleaned;
}