@thermal-label/brother-ql-node 0.0.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/__tests__/discovery.test.js +141 -68
  2. package/dist/__tests__/discovery.test.js.map +1 -1
  3. package/dist/__tests__/integration/print.test.d.ts +2 -0
  4. package/dist/__tests__/integration/print.test.d.ts.map +1 -0
  5. package/dist/__tests__/integration/print.test.js +71 -0
  6. package/dist/__tests__/integration/print.test.js.map +1 -0
  7. package/dist/__tests__/printer.test.js +137 -208
  8. package/dist/__tests__/printer.test.js.map +1 -1
  9. package/dist/discovery.d.ts +39 -4
  10. package/dist/discovery.d.ts.map +1 -1
  11. package/dist/discovery.js +88 -15
  12. package/dist/discovery.js.map +1 -1
  13. package/dist/index.d.ts +2 -8
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +2 -6
  16. package/dist/index.js.map +1 -1
  17. package/dist/printer.d.ts +32 -15
  18. package/dist/printer.d.ts.map +1 -1
  19. package/dist/printer.js +70 -149
  20. package/dist/printer.js.map +1 -1
  21. package/package.json +6 -4
  22. package/dist/__tests__/errors.test.d.ts +0 -2
  23. package/dist/__tests__/errors.test.d.ts.map +0 -1
  24. package/dist/__tests__/errors.test.js +0 -20
  25. package/dist/__tests__/errors.test.js.map +0 -1
  26. package/dist/__tests__/integration/print-image.test.d.ts +0 -2
  27. package/dist/__tests__/integration/print-image.test.d.ts.map +0 -1
  28. package/dist/__tests__/integration/print-image.test.js +0 -22
  29. package/dist/__tests__/integration/print-image.test.js.map +0 -1
  30. package/dist/__tests__/integration/print-text.test.d.ts +0 -2
  31. package/dist/__tests__/integration/print-text.test.d.ts.map +0 -1
  32. package/dist/__tests__/integration/print-text.test.js +0 -25
  33. package/dist/__tests__/integration/print-text.test.js.map +0 -1
  34. package/dist/__tests__/integration/print-two-color.test.d.ts +0 -2
  35. package/dist/__tests__/integration/print-two-color.test.d.ts.map +0 -1
  36. package/dist/__tests__/integration/print-two-color.test.js +0 -28
  37. package/dist/__tests__/integration/print-two-color.test.js.map +0 -1
  38. package/dist/__tests__/integration/tcp.test.d.ts +0 -2
  39. package/dist/__tests__/integration/tcp.test.d.ts.map +0 -1
  40. package/dist/__tests__/integration/tcp.test.js +0 -20
  41. package/dist/__tests__/integration/tcp.test.js.map +0 -1
  42. package/dist/__tests__/tcp-transport.test.d.ts +0 -2
  43. package/dist/__tests__/tcp-transport.test.d.ts.map +0 -1
  44. package/dist/__tests__/tcp-transport.test.js +0 -115
  45. package/dist/__tests__/tcp-transport.test.js.map +0 -1
  46. package/dist/__tests__/usb-transport.test.d.ts +0 -2
  47. package/dist/__tests__/usb-transport.test.d.ts.map +0 -1
  48. package/dist/__tests__/usb-transport.test.js +0 -99
  49. package/dist/__tests__/usb-transport.test.js.map +0 -1
  50. package/dist/errors.d.ts +0 -8
  51. package/dist/errors.d.ts.map +0 -1
  52. package/dist/errors.js +0 -15
  53. package/dist/errors.js.map +0 -1
  54. package/dist/status.d.ts +0 -2
  55. package/dist/status.d.ts.map +0 -1
  56. package/dist/status.js +0 -2
  57. package/dist/status.js.map +0 -1
  58. package/dist/transport.d.ts +0 -32
  59. package/dist/transport.d.ts.map +0 -1
  60. package/dist/transport.js +0 -120
  61. package/dist/transport.js.map +0 -1
  62. package/dist/types.d.ts +0 -13
  63. package/dist/types.d.ts.map +0 -1
  64. package/dist/types.js +0 -2
  65. package/dist/types.js.map +0 -1
package/dist/printer.d.ts CHANGED
@@ -1,18 +1,35 @@
1
- import { type DeviceDescriptor, type MediaDescriptor, type PageData, type PageOptions, type JobOptions, type PrinterStatus, type LabelBitmap, type TextPrintOptions, type ImagePrintOptions } from '@thermal-label/brother-ql-core';
2
- import { type Transport } from './transport.js';
3
- import { type OpenOptions } from './types.js';
4
- export declare class BrotherQLPrinter {
5
- readonly device: DeviceDescriptor;
6
- readonly transport: 'usb' | 'tcp';
7
- private readonly _transport;
8
- constructor(transport: Transport, device: DeviceDescriptor, transportType: 'usb' | 'tcp');
9
- getStatus(): Promise<PrinterStatus>;
10
- print(pages: PageData[], options?: JobOptions): Promise<void>;
11
- printText(text: string, media: MediaDescriptor, options?: TextPrintOptions): Promise<void>;
12
- printImage(image: Buffer | string, media: MediaDescriptor, options?: ImagePrintOptions): Promise<void>;
13
- printTwoColor(black: LabelBitmap, red: LabelBitmap, media: MediaDescriptor, options?: PageOptions): Promise<void>;
1
+ import { type BrotherQLDevice, type BrotherQLStatus, type MediaDescriptor, type PreviewOptions, type PreviewResult, type PrinterAdapter, type RawImageData, type Transport, type TransportType } from '@thermal-label/brother-ql-core';
2
+ /**
3
+ * Node.js driver for Brother QL label printers.
4
+ *
5
+ * Implements `PrinterAdapter`. Callers get a printer instance from
6
+ * `discovery.openPrinter()` (USB or TCP) and interact solely through
7
+ * the adapter surface: `print(rgba, media?)`, `createPreview`,
8
+ * `getStatus`, `close`.
9
+ *
10
+ * Two-colour media (DK-22251) is handled transparently — when
11
+ * `media.colorCapable` is true, the driver runs `splitTwoColor()`
12
+ * internally before encoding.
13
+ */
14
+ export declare class BrotherQLPrinter implements PrinterAdapter {
15
+ readonly family: "brother-ql";
16
+ readonly device: BrotherQLDevice;
17
+ readonly transportType: TransportType;
18
+ private readonly transport;
19
+ private lastStatus;
20
+ constructor(device: BrotherQLDevice, transport: Transport, transportType: TransportType);
21
+ get model(): string;
22
+ get connected(): boolean;
23
+ print(image: RawImageData, media?: MediaDescriptor): Promise<void>;
24
+ createPreview(image: RawImageData, options?: PreviewOptions): Promise<PreviewResult>;
25
+ /**
26
+ * Poll the status endpoint until 32 bytes are available.
27
+ *
28
+ * The USB `transferAsync()` call resolves immediately with 0 bytes if
29
+ * the printer hasn't queued a response yet, so retry with a short
30
+ * delay up to `STATUS_POLL_ATTEMPTS` times.
31
+ */
32
+ getStatus(): Promise<BrotherQLStatus>;
14
33
  close(): Promise<void>;
15
34
  }
16
- export declare function openPrinter(options?: OpenOptions): Promise<BrotherQLPrinter>;
17
- export declare function openPrinterTcp(host: string, port?: number): Promise<BrotherQLPrinter>;
18
35
  //# sourceMappingURL=printer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../src/printer.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,WAAW,EAEhB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAA8B,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAI5E,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAI9C,qBAAa,gBAAgB;IAC3B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;gBAE3B,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,KAAK,GAAG,KAAK;IAMlF,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC;IAYnC,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAK7D,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAyB1F,UAAU,CACd,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,KAAK,EAAE,eAAe,EACtB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,IAAI,CAAC;IAyBV,aAAa,CACjB,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,eAA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;IAcrC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
package/dist/printer.js CHANGED
@@ -1,167 +1,88 @@
1
- import { encodeJob, findDevice, renderText, renderImage, } from '@thermal-label/brother-ql-core';
2
- import { rotateBitmap } from '@mbtech-nl/bitmap';
3
- import { UsbTransport, TcpTransport } from './transport.js';
4
- import { parseStatus, STATUS_REQUEST } from './status.js';
5
- import { listPrinters } from './discovery.js';
6
- import { UnsupportedOperationError } from './errors.js';
7
- import {} from './types.js';
8
- const BROTHER_VID = 0x04f9;
1
+ import { DEFAULT_MEDIA, STATUS_REQUEST, createPreviewOffline, encodeJob, parseStatus, renderImage, splitTwoColor, } from '@thermal-label/brother-ql-core';
2
+ import { MediaNotSpecifiedError } from '@thermal-label/contracts';
3
+ const STATUS_BYTE_COUNT = 32;
4
+ const STATUS_POLL_INTERVAL_MS = 150;
5
+ const STATUS_POLL_ATTEMPTS = 10;
6
+ /**
7
+ * Node.js driver for Brother QL label printers.
8
+ *
9
+ * Implements `PrinterAdapter`. Callers get a printer instance from
10
+ * `discovery.openPrinter()` (USB or TCP) and interact solely through
11
+ * the adapter surface: `print(rgba, media?)`, `createPreview`,
12
+ * `getStatus`, `close`.
13
+ *
14
+ * Two-colour media (DK-22251) is handled transparently — when
15
+ * `media.colorCapable` is true, the driver runs `splitTwoColor()`
16
+ * internally before encoding.
17
+ */
9
18
  export class BrotherQLPrinter {
19
+ family = 'brother-ql';
10
20
  device;
21
+ transportType;
11
22
  transport;
12
- _transport;
13
- constructor(transport, device, transportType) {
14
- this._transport = transport;
23
+ lastStatus;
24
+ constructor(device, transport, transportType) {
15
25
  this.device = device;
16
- this.transport = transportType;
26
+ this.transport = transport;
27
+ this.transportType = transportType;
17
28
  }
18
- async getStatus() {
19
- await this._transport.write(STATUS_REQUEST);
20
- // The USB IN endpoint (transferAsync) resolves immediately with 0 bytes if
21
- // the printer hasn't queued its response yet. Retry until we have 32 bytes.
22
- for (let attempt = 0; attempt < 10; attempt++) {
23
- await new Promise(r => setTimeout(r, 150));
24
- const bytes = await this._transport.read(32);
25
- if (bytes.length >= 32)
26
- return parseStatus(bytes);
27
- }
28
- throw new Error('Printer did not respond to status request within 1.5s');
29
+ get model() {
30
+ return this.device.name;
29
31
  }
30
- async print(pages, options) {
31
- const data = encodeJob(pages, options);
32
- await this._transport.write(data);
33
- }
34
- async printText(text, media, options) {
35
- const { invert, scaleX, scaleY, ...pageOptions } = options ?? {};
36
- // Scale so the label is roughly square: largest integer scale where neither the tape
37
- // width (base.heightPx axis) nor the label length (base.widthPx axis) exceeds printAreaDots.
38
- const base = renderText(text, { scaleX: 1, scaleY: 1 });
39
- const autoScale = Math.max(1, Math.floor(media.printAreaDots / Math.max(base.widthPx, base.heightPx)));
40
- const effectiveScaleY = scaleY ?? autoScale;
41
- const effectiveScaleX = scaleX ?? autoScale;
42
- const rawBitmap = renderText(text, {
43
- ...(invert !== undefined ? { invert } : {}),
44
- scaleX: effectiveScaleX,
45
- scaleY: effectiveScaleY,
46
- });
47
- const bitmap = rotateBitmap(rawBitmap, 270);
48
- const page = {
49
- bitmap,
50
- media,
51
- ...(Object.keys(pageOptions).length > 0 ? { options: pageOptions } : {}),
52
- };
53
- await this.print([page]);
32
+ get connected() {
33
+ return this.transport.connected;
54
34
  }
55
- async printImage(image, media, options) {
56
- const { threshold, dither, invert, rotate, ...pageOptions } = options ?? {};
57
- let rawImageData;
58
- if (typeof image === 'string') {
59
- rawImageData = await loadImageFile(image);
35
+ async print(image, media) {
36
+ const resolvedMedia = (media ?? this.lastStatus?.detectedMedia);
37
+ if (!resolvedMedia) {
38
+ throw new MediaNotSpecifiedError();
39
+ }
40
+ let page;
41
+ if (resolvedMedia.colorCapable) {
42
+ const { black, red } = splitTwoColor(image);
43
+ page = { bitmap: black, redBitmap: red, media: resolvedMedia };
60
44
  }
61
45
  else {
62
- rawImageData = await decodeBuffer(image);
46
+ const bitmap = renderImage(image, { dither: true });
47
+ page = { bitmap, media: resolvedMedia };
63
48
  }
64
- const rawBitmap = renderImage(rawImageData, {
65
- ...(threshold !== undefined ? { threshold } : {}),
66
- ...(dither !== undefined ? { dither } : {}),
67
- ...(invert !== undefined ? { invert } : {}),
68
- ...(rotate !== undefined ? { rotate } : {}),
49
+ const bytes = encodeJob([page]);
50
+ await this.transport.write(bytes);
51
+ }
52
+ createPreview(image, options) {
53
+ const override = options?.media;
54
+ const detected = this.lastStatus?.detectedMedia;
55
+ if (override)
56
+ return Promise.resolve(createPreviewOffline(image, override));
57
+ if (detected)
58
+ return Promise.resolve(createPreviewOffline(image, detected));
59
+ return Promise.resolve({
60
+ ...createPreviewOffline(image, DEFAULT_MEDIA),
61
+ assumed: true,
69
62
  });
70
- const bitmap = rotateBitmap(rawBitmap, 270);
71
- const page = {
72
- bitmap,
73
- media,
74
- ...(Object.keys(pageOptions).length > 0 ? { options: pageOptions } : {}),
75
- };
76
- await this.print([page]);
77
63
  }
78
- async printTwoColor(black, red, media, options) {
79
- if (!this.device.twoColor) {
80
- throw new UnsupportedOperationError(`${this.device.name} does not support two-color printing. ` +
81
- 'Two-color printing requires a QL-800, QL-810W, or QL-820NWB with DK-22251 labels.');
64
+ /**
65
+ * Poll the status endpoint until 32 bytes are available.
66
+ *
67
+ * The USB `transferAsync()` call resolves immediately with 0 bytes if
68
+ * the printer hasn't queued a response yet, so retry with a short
69
+ * delay up to `STATUS_POLL_ATTEMPTS` times.
70
+ */
71
+ async getStatus() {
72
+ await this.transport.write(STATUS_REQUEST);
73
+ for (let attempt = 0; attempt < STATUS_POLL_ATTEMPTS; attempt++) {
74
+ await new Promise(r => setTimeout(r, STATUS_POLL_INTERVAL_MS));
75
+ const bytes = await this.transport.read(STATUS_BYTE_COUNT);
76
+ if (bytes.length >= STATUS_BYTE_COUNT) {
77
+ const status = parseStatus(bytes);
78
+ this.lastStatus = status;
79
+ return status;
80
+ }
82
81
  }
83
- const page = {
84
- bitmap: black,
85
- redBitmap: red,
86
- media,
87
- ...(options !== undefined ? { options } : {}),
88
- };
89
- await this.print([page]);
82
+ throw new Error('Printer did not respond to status request within 1.5s');
90
83
  }
91
84
  async close() {
92
- await this._transport.close();
93
- }
94
- }
95
- export async function openPrinter(options) {
96
- const { vid = BROTHER_VID, pid } = options ?? {};
97
- if (pid) {
98
- const device = findDevice(vid, pid);
99
- if (!device)
100
- throw new Error(`Unknown device: ${vid.toString(16)}:${pid.toString(16)}`);
101
- const transport = await UsbTransport.open(vid, pid);
102
- return new BrotherQLPrinter(transport, device, 'usb');
103
- }
104
- const printers = listPrinters();
105
- if (printers.length === 0)
106
- throw new Error('No Brother QL printers found');
107
- const info = printers[0];
108
- if (!info)
109
- throw new Error('No Brother QL printers found');
110
- const transport = await UsbTransport.open(info.device.vid, info.device.pid);
111
- return new BrotherQLPrinter(transport, info.device, 'usb');
112
- }
113
- export async function openPrinterTcp(host, port = 9100) {
114
- const transport = await TcpTransport.connect(host, port);
115
- // We can't know the device descriptor from TCP alone — request status and detect
116
- // Fall back to a generic QL-820NWB descriptor (most capable, verified by maintainer)
117
- const status = await (async () => {
118
- await transport.write(new Uint8Array([0x1b, 0x69, 0x53]));
119
- return transport.read(32);
120
- })();
121
- const mediaWidthMm = status[10] ?? 0;
122
- // Try to find a matching device by network capability
123
- const { DEVICES } = await import('@thermal-label/brother-ql-core');
124
- const networkDevice = Object.values(DEVICES).find(d => d.network !== 'none');
125
- const device = networkDevice ?? DEVICES.QL_820NWB;
126
- void mediaWidthMm; // may be used for smarter detection in future
127
- return new BrotherQLPrinter(transport, device, 'tcp');
128
- }
129
- async function loadImageFile(filePath) {
130
- try {
131
- const canvas = await import('@napi-rs/canvas');
132
- const img = await canvas.loadImage(filePath);
133
- const canvasEl = canvas.createCanvas(img.width, img.height);
134
- const ctx = canvasEl.getContext('2d');
135
- ctx.drawImage(img, 0, 0);
136
- const imageData = ctx.getImageData(0, 0, img.width, img.height);
137
- return {
138
- width: img.width,
139
- height: img.height,
140
- data: new Uint8Array(imageData.data.buffer),
141
- };
142
- }
143
- catch {
144
- throw new Error('Cannot load image file: install @napi-rs/canvas for image file support, ' +
145
- 'or pass a pre-decoded RawImageData to print().');
146
- }
147
- }
148
- async function decodeBuffer(buffer) {
149
- try {
150
- const canvas = await import('@napi-rs/canvas');
151
- const img = await canvas.loadImage(buffer);
152
- const canvasEl = canvas.createCanvas(img.width, img.height);
153
- const ctx = canvasEl.getContext('2d');
154
- ctx.drawImage(img, 0, 0);
155
- const imageData = ctx.getImageData(0, 0, img.width, img.height);
156
- return {
157
- width: img.width,
158
- height: img.height,
159
- data: new Uint8Array(imageData.data.buffer),
160
- };
161
- }
162
- catch {
163
- throw new Error('Cannot decode image buffer: install @napi-rs/canvas for PNG/JPEG decoding, ' +
164
- 'or pass a pre-decoded RawImageData to print().');
85
+ await this.transport.close();
165
86
  }
166
87
  }
167
88
  //# sourceMappingURL=printer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"printer.js","sourceRoot":"","sources":["../src/printer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,GAWZ,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAoB,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,GAAG,MAAM,CAAC;AAE3B,MAAM,OAAO,gBAAgB;IAClB,MAAM,CAAmB;IACzB,SAAS,CAAgB;IACjB,UAAU,CAAY;IAEvC,YAAY,SAAoB,EAAE,MAAwB,EAAE,aAA4B;QACtF,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,MA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CAAC,EAAE,OAAO,GAAG,oBAAoB,EAAE,OAAO,EAAE,EAAE,CAAC;YAChE,MAAM,IAAI,OAAO,CAAO,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC;YACrE,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAC3D,IAAI,KAAK,CAAC,MAAM,IAAI,iBAAiB,EAAE,CAAC;gBACtC,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;gBAClC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;gBACzB,OAAO,MAAM,CAAC;YAChB,CAAC;QACH,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thermal-label/brother-ql-node",
3
- "version": "0.0.1",
3
+ "version": "0.2.1",
4
4
  "description": "Node.js USB and TCP driver for Brother QL label printers",
5
5
  "keywords": [
6
6
  "brother",
@@ -45,17 +45,19 @@
45
45
  },
46
46
  "sideEffects": false,
47
47
  "main": "./dist/index.js",
48
- "types": "./src/index.ts",
48
+ "types": "./dist/index.d.ts",
49
49
  "exports": {
50
50
  ".": {
51
51
  "import": "./dist/index.js",
52
- "types": "./src/index.ts"
52
+ "types": "./dist/index.d.ts"
53
53
  }
54
54
  },
55
55
  "dependencies": {
56
56
  "@mbtech-nl/bitmap": "^0.1.0",
57
+ "@thermal-label/contracts": "^0.1.2",
58
+ "@thermal-label/transport": "^0.2.0",
57
59
  "usb": "^2.0.0",
58
- "@thermal-label/brother-ql-core": "0.0.1"
60
+ "@thermal-label/brother-ql-core": "0.2.1"
59
61
  },
60
62
  "optionalDependencies": {
61
63
  "@napi-rs/canvas": "^0.1.0"
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=errors.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/errors.test.ts"],"names":[],"mappings":""}
@@ -1,20 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { UnsupportedOperationError, PrinterError } from '../errors.js';
3
- describe('UnsupportedOperationError', () => {
4
- it('sets name and message', () => {
5
- const err = new UnsupportedOperationError('not supported');
6
- expect(err.name).toBe('UnsupportedOperationError');
7
- expect(err.message).toBe('not supported');
8
- expect(err).toBeInstanceOf(Error);
9
- });
10
- });
11
- describe('PrinterError', () => {
12
- it('sets name, message, and errors array', () => {
13
- const err = new PrinterError('printer failed', ['Cover open', 'No media']);
14
- expect(err.name).toBe('PrinterError');
15
- expect(err.message).toBe('printer failed');
16
- expect(err.errors).toEqual(['Cover open', 'No media']);
17
- expect(err).toBeInstanceOf(Error);
18
- });
19
- });
20
- //# sourceMappingURL=errors.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.test.js","sourceRoot":"","sources":["../../src/__tests__/errors.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEvE,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC/B,MAAM,GAAG,GAAG,IAAI,yBAAyB,CAAC,eAAe,CAAC,CAAC;QAC3D,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QACnD,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC1C,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,GAAG,GAAG,IAAI,YAAY,CAAC,gBAAgB,EAAE,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;QAC3E,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC3C,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;QACvD,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=print-image.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"print-image.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/print-image.test.ts"],"names":[],"mappings":""}
@@ -1,22 +0,0 @@
1
- import { describe, it } from 'vitest';
2
- import { join } from 'node:path';
3
- /*
4
- * Hardware verification checklist:
5
- * - Printer is powered on and connected via USB
6
- * - 62mm continuous label loaded
7
- * - Set BROTHER_INTEGRATION_IMAGE to a PNG/JPEG file path (optional)
8
- * - Run: BROTHER_INTEGRATION=1 pnpm test
9
- */
10
- describe('Integration: print image', () => {
11
- it.skipIf(!process.env.BROTHER_INTEGRATION)('prints an image label via USB', async () => {
12
- const { openPrinter, MEDIA } = await import('../../index.js');
13
- const imagePath = process.env.BROTHER_INTEGRATION_IMAGE ?? join(import.meta.dirname, 'test.png');
14
- const printer = await openPrinter();
15
- const media = MEDIA[259];
16
- if (!media)
17
- throw new Error('Media 259 not found');
18
- await printer.printImage(imagePath, media);
19
- await printer.close();
20
- });
21
- });
22
- //# sourceMappingURL=print-image.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"print-image.test.js","sourceRoot":"","sources":["../../../src/__tests__/integration/print-image.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;GAMG;AACH,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;QACtF,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAC9D,MAAM,SAAS,GACb,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QACjF,MAAM,OAAO,GAAG,MAAM,WAAW,EAAE,CAAC;QACpC,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACnD,MAAM,OAAO,CAAC,UAAU,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC3C,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=print-text.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"print-text.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/print-text.test.ts"],"names":[],"mappings":""}
@@ -1,25 +0,0 @@
1
- import { describe, it } from 'vitest';
2
- /*
3
- * Hardware verification checklist:
4
- * - Printer is powered on and connected via USB
5
- * - Label is loaded (any width)
6
- * - Editor Lite mode is disabled
7
- * - Run: BROTHER_INTEGRATION=1 pnpm test
8
- *
9
- * Expected result:
10
- * - Label prints with text "Hello QL Integration Test"
11
- * - Auto-cut fires after label
12
- * - No error thrown
13
- */
14
- describe('Integration: print text', () => {
15
- it.skipIf(!process.env.BROTHER_INTEGRATION)('prints a text label via USB', async () => {
16
- const { openPrinter, MEDIA } = await import('../../index.js');
17
- const printer = await openPrinter();
18
- const media = MEDIA[259];
19
- if (!media)
20
- throw new Error('Media 259 not found');
21
- await printer.printText('Hello QL Integration Test', media);
22
- await printer.close();
23
- });
24
- });
25
- //# sourceMappingURL=print-text.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"print-text.test.js","sourceRoot":"","sources":["../../../src/__tests__/integration/print-text.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QACpF,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,MAAM,WAAW,EAAE,CAAC;QACpC,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACnD,MAAM,OAAO,CAAC,SAAS,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;QAC5D,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=print-two-color.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"print-two-color.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/print-two-color.test.ts"],"names":[],"mappings":""}
@@ -1,28 +0,0 @@
1
- import { describe, it } from 'vitest';
2
- import { createBitmap } from '@mbtech-nl/bitmap';
3
- /*
4
- * Hardware verification checklist (QL-820NWB only):
5
- * - QL-820NWB powered on, connected via USB
6
- * - DK-22251 (black + red on white, 62mm continuous) label loaded
7
- * - Editor Lite mode disabled
8
- * - Run: BROTHER_INTEGRATION=1 pnpm test
9
- */
10
- describe('Integration: print two-color (QL-820NWB)', () => {
11
- it.skipIf(!process.env.BROTHER_INTEGRATION)('prints a two-color label via USB', async () => {
12
- const { openPrinter, MEDIA, renderText } = await import('../../index.js');
13
- const printer = await openPrinter();
14
- if (!printer.device.twoColor) {
15
- console.warn(`Skipping two-color test: ${printer.device.name} does not support two-color.`);
16
- await printer.close();
17
- return;
18
- }
19
- const media = MEDIA[259];
20
- if (!media)
21
- throw new Error('Media 259 not found');
22
- const black = renderText('Hello', { scaleX: 2, scaleY: 2 });
23
- const red = createBitmap(black.widthPx, black.heightPx);
24
- await printer.printTwoColor(black, red, media);
25
- await printer.close();
26
- });
27
- });
28
- //# sourceMappingURL=print-two-color.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"print-two-color.test.js","sourceRoot":"","sources":["../../../src/__tests__/integration/print-two-color.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;;;GAMG;AACH,QAAQ,CAAC,0CAA0C,EAAE,GAAG,EAAE;IACxD,EAAE,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QACzF,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAC1E,MAAM,OAAO,GAAG,MAAM,WAAW,EAAE,CAAC;QAEpC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC7B,OAAO,CAAC,IAAI,CAAC,4BAA4B,OAAO,CAAC,MAAM,CAAC,IAAI,8BAA8B,CAAC,CAAC;YAC5F,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;YACtB,OAAO;QACT,CAAC;QAED,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAEnD,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;QAC5D,MAAM,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QAExD,MAAM,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QAC/C,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=tcp.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tcp.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/tcp.test.ts"],"names":[],"mappings":""}
@@ -1,20 +0,0 @@
1
- import { describe, it } from 'vitest';
2
- /*
3
- * Hardware verification checklist:
4
- * - Network-capable Brother QL printer on the same network
5
- * - Set BROTHER_TCP_HOST to the printer's IP address
6
- * - Run: BROTHER_INTEGRATION=1 BROTHER_TCP_HOST=192.168.1.x pnpm test
7
- */
8
- describe('Integration: TCP transport', () => {
9
- it.skipIf(!process.env.BROTHER_INTEGRATION || !process.env.BROTHER_TCP_HOST)('prints a text label via TCP', async () => {
10
- const { openPrinterTcp, MEDIA } = await import('../../index.js');
11
- const host = process.env.BROTHER_TCP_HOST;
12
- const printer = await openPrinterTcp(host);
13
- const media = MEDIA[259];
14
- if (!media)
15
- throw new Error('Media 259 not found');
16
- await printer.printText('Hello TCP Integration Test', media);
17
- await printer.close();
18
- });
19
- });
20
- //# sourceMappingURL=tcp.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tcp.test.js","sourceRoot":"","sources":["../../../src/__tests__/integration/tcp.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAEtC;;;;;GAKG;AACH,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,EAAE,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAC1E,6BAA6B,EAC7B,KAAK,IAAI,EAAE;QACT,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;QACjE,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAiB,CAAC;QAC3C,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACnD,MAAM,OAAO,CAAC,SAAS,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QAC7D,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=tcp-transport.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tcp-transport.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/tcp-transport.test.ts"],"names":[],"mappings":""}