@thermal-label/brother-ql-core 0.5.0 → 0.6.0

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 (46) hide show
  1. package/README.md +83 -12
  2. package/data/devices.json +442 -24
  3. package/data/media.json +56 -56
  4. package/dist/__tests__/devices.test.js +1 -0
  5. package/dist/__tests__/devices.test.js.map +1 -1
  6. package/dist/__tests__/media.test.js +7 -7
  7. package/dist/__tests__/protocol.test.js +1 -1
  8. package/dist/__tests__/status.test.js +56 -15
  9. package/dist/__tests__/status.test.js.map +1 -1
  10. package/dist/devices.d.ts +711 -2
  11. package/dist/devices.d.ts.map +1 -1
  12. package/dist/devices.generated.d.ts +44 -11
  13. package/dist/devices.generated.d.ts.map +1 -1
  14. package/dist/devices.generated.js +77 -32
  15. package/dist/devices.generated.js.map +1 -1
  16. package/dist/devices.js +6 -2
  17. package/dist/devices.js.map +1 -1
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +1 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/media.d.ts +1 -1
  23. package/dist/media.generated.d.ts.map +1 -1
  24. package/dist/media.generated.js +114 -112
  25. package/dist/media.generated.js.map +1 -1
  26. package/dist/media.js +3 -3
  27. package/dist/protocol.js +4 -4
  28. package/dist/status.d.ts +8 -5
  29. package/dist/status.d.ts.map +1 -1
  30. package/dist/status.js +43 -7
  31. package/dist/status.js.map +1 -1
  32. package/dist/types.d.ts +7 -14
  33. package/dist/types.d.ts.map +1 -1
  34. package/package.json +3 -3
  35. package/src/__tests__/devices.test.ts +1 -0
  36. package/src/__tests__/media.test.ts +7 -7
  37. package/src/__tests__/protocol.test.ts +1 -1
  38. package/src/__tests__/status.test.ts +66 -16
  39. package/src/devices.generated.ts +98 -40
  40. package/src/devices.ts +7 -2
  41. package/src/index.ts +2 -0
  42. package/src/media.generated.ts +115 -114
  43. package/src/media.ts +3 -3
  44. package/src/protocol.ts +4 -4
  45. package/src/status.ts +47 -8
  46. package/src/types.ts +7 -14
@@ -1,9 +1,26 @@
1
- // AUTO-GENERATED by scripts/compile-data.mjs do not edit by hand.
2
- // Regenerate with `pnpm --filter @thermal-label/brother-ql-core compile-data`.
3
- import type { DeviceRegistry } from '@thermal-label/contracts';
4
- import type { BrotherQLDevice } from './types.js';
1
+ // AUTO-GENERATED by scripts/compile-data.mjs from packages/core/data/devices/*.json5.
2
+ // Edit those files, not this one. Run `pnpm --filter @thermal-label/brother-ql-core compile-data`.
5
3
 
6
- export const DEVICE_REGISTRY = {
4
+ import type { DeviceEntry, DeviceRegistry } from '@thermal-label/contracts';
5
+
6
+ /**
7
+ * Render-time effective status — superset of the contracts' stored
8
+ * verification rungs that includes `'expected'` (propagated lift)
9
+ * and `'unverified'` (no claim). Mirrors `EffectiveStatus` in
10
+ * @thermal-label/contracts ≥ 0.6; literal here so codegen does not
11
+ * require the matching contracts version on consumers' machines.
12
+ */
13
+ export type EffectiveStatus = 'verified' | 'partial' | 'unsupported' | 'expected' | 'unverified';
14
+
15
+ /** Each entry carries a rolled-up `supportStatus` from the verification grid. */
16
+ export type RegistryDeviceEntry = DeviceEntry & { supportStatus: EffectiveStatus };
17
+
18
+ /** Registry shape with `supportStatus` stamped on each device. */
19
+ export type RegistryWithStatus = Omit<DeviceRegistry, 'devices'> & {
20
+ devices: readonly RegistryDeviceEntry[];
21
+ };
22
+
23
+ export const REGISTRY = {
7
24
  "schemaVersion": 1,
8
25
  "driver": "brother-ql",
9
26
  "devices": [
@@ -41,7 +58,8 @@ export const DEVICE_REGISTRY = {
41
58
  "hardwareQuirks": "Cutter requires compression to be enabled — encoder enforces this when (autocut: true && compress: false). Source: nbuchwitz/ptouch:PTE550W (\"E550W requires compression ON for cutting to work\"). Pin configurations from Brother spec cv_pte550wp750wp710bt_eng_raster_102.pdf p.20 §2.3, transcribed into media.json5 via nbuchwitz/ptouch.",
42
59
  "support": {
43
60
  "status": "untested"
44
- }
61
+ },
62
+ "supportStatus": "unverified"
45
63
  },
46
64
  {
47
65
  "key": "PT_P750W",
@@ -80,7 +98,8 @@ export const DEVICE_REGISTRY = {
80
98
  "hardwareQuirks": "PID disagreement between driver projects on which mode 0x2062 vs 0x2065 represents: libptouch.c says 0x2062 is the printer PID and 0x2065 is PLite mass-storage; nbuchwitz/ptouch says 0x2065 is the printer PID. We treat libptouch.c as authoritative; flip via a contributor report if discovery fails on real hardware. Pin configurations from Brother spec cv_pte550wp750wp710bt_eng_raster_102.pdf p.20 §2.3.",
81
99
  "support": {
82
100
  "status": "untested"
83
- }
101
+ },
102
+ "supportStatus": "unverified"
84
103
  },
85
104
  {
86
105
  "key": "PT_P900",
@@ -113,7 +132,8 @@ export const DEVICE_REGISTRY = {
113
132
  "hardwareQuirks": "Pin configurations from Brother spec cv_ptp900_eng_raster_102.pdf pp.23-24 §2.3.5, transcribed into media.json5 via nbuchwitz/ptouch:PTP900Series. Note nbuchwitz/ptouch:PTP900Series.DEFAULT_USE_COMPRESSION = False — unlike PT-E550W, P900 does NOT require compression for the cutter.",
114
133
  "support": {
115
134
  "status": "untested"
116
- }
135
+ },
136
+ "supportStatus": "unverified"
117
137
  },
118
138
  {
119
139
  "key": "PT_P900W",
@@ -149,7 +169,8 @@ export const DEVICE_REGISTRY = {
149
169
  "hardwareQuirks": "PID 0x2085 sourced from nbuchwitz/ptouch:PTP900W; not in most public USB-ID databases — phase 4 hardware verification should confirm.",
150
170
  "support": {
151
171
  "status": "untested"
152
- }
172
+ },
173
+ "supportStatus": "unverified"
153
174
  },
154
175
  {
155
176
  "key": "PT_P910BT",
@@ -183,7 +204,8 @@ export const DEVICE_REGISTRY = {
183
204
  "hardwareQuirks": "Bluetooth assumed classic SPP per nbuchwitz/ptouch — phase 4 hardware verification should confirm classic vs BLE GATT before users rely on it. HSe heat-shrink unsupported (TZe-only); engine.mediaCompatibility excludes hse-2to1 and hse-3to1 so the lookup never returns those entries.",
184
205
  "support": {
185
206
  "status": "untested"
186
- }
207
+ },
208
+ "supportStatus": "unverified"
187
209
  },
188
210
  {
189
211
  "key": "PT_P950NW",
@@ -219,7 +241,8 @@ export const DEVICE_REGISTRY = {
219
241
  "hardwareQuirks": "PID 0x2086 sourced from nbuchwitz/ptouch:PTP950NW. Pin configurations from Brother spec cv_ptp900_eng_raster_102.pdf via nbuchwitz/ptouch.",
220
242
  "support": {
221
243
  "status": "untested"
222
- }
244
+ },
245
+ "supportStatus": "unverified"
223
246
  },
224
247
  {
225
248
  "key": "QL_1050",
@@ -249,7 +272,8 @@ export const DEVICE_REGISTRY = {
249
272
  ],
250
273
  "support": {
251
274
  "status": "untested"
252
- }
275
+ },
276
+ "supportStatus": "expected"
253
277
  },
254
278
  {
255
279
  "key": "QL_1060N",
@@ -282,7 +306,8 @@ export const DEVICE_REGISTRY = {
282
306
  ],
283
307
  "support": {
284
308
  "status": "untested"
285
- }
309
+ },
310
+ "supportStatus": "expected"
286
311
  },
287
312
  {
288
313
  "key": "QL_1100",
@@ -316,7 +341,8 @@ export const DEVICE_REGISTRY = {
316
341
  },
317
342
  "support": {
318
343
  "status": "untested"
319
- }
344
+ },
345
+ "supportStatus": "expected"
320
346
  },
321
347
  {
322
348
  "key": "QL_1110NWB",
@@ -353,7 +379,8 @@ export const DEVICE_REGISTRY = {
353
379
  },
354
380
  "support": {
355
381
  "status": "untested"
356
- }
382
+ },
383
+ "supportStatus": "expected"
357
384
  },
358
385
  {
359
386
  "key": "QL_1115NWB",
@@ -390,7 +417,8 @@ export const DEVICE_REGISTRY = {
390
417
  },
391
418
  "support": {
392
419
  "status": "untested"
393
- }
420
+ },
421
+ "supportStatus": "expected"
394
422
  },
395
423
  {
396
424
  "key": "QL_500",
@@ -418,7 +446,8 @@ export const DEVICE_REGISTRY = {
418
446
  ],
419
447
  "support": {
420
448
  "status": "untested"
421
- }
449
+ },
450
+ "supportStatus": "expected"
422
451
  },
423
452
  {
424
453
  "key": "QL_550",
@@ -446,7 +475,8 @@ export const DEVICE_REGISTRY = {
446
475
  ],
447
476
  "support": {
448
477
  "status": "untested"
449
- }
478
+ },
479
+ "supportStatus": "expected"
450
480
  },
451
481
  {
452
482
  "key": "QL_560",
@@ -475,7 +505,8 @@ export const DEVICE_REGISTRY = {
475
505
  ],
476
506
  "support": {
477
507
  "status": "untested"
478
- }
508
+ },
509
+ "supportStatus": "expected"
479
510
  },
480
511
  {
481
512
  "key": "QL_570",
@@ -504,7 +535,8 @@ export const DEVICE_REGISTRY = {
504
535
  ],
505
536
  "support": {
506
537
  "status": "untested"
507
- }
538
+ },
539
+ "supportStatus": "expected"
508
540
  },
509
541
  {
510
542
  "key": "QL_580N",
@@ -536,7 +568,8 @@ export const DEVICE_REGISTRY = {
536
568
  ],
537
569
  "support": {
538
570
  "status": "untested"
539
- }
571
+ },
572
+ "supportStatus": "expected"
540
573
  },
541
574
  {
542
575
  "key": "QL_600",
@@ -565,7 +598,8 @@ export const DEVICE_REGISTRY = {
565
598
  ],
566
599
  "support": {
567
600
  "status": "untested"
568
- }
601
+ },
602
+ "supportStatus": "expected"
569
603
  },
570
604
  {
571
605
  "key": "QL_650TD",
@@ -594,7 +628,8 @@ export const DEVICE_REGISTRY = {
594
628
  ],
595
629
  "support": {
596
630
  "status": "untested"
597
- }
631
+ },
632
+ "supportStatus": "expected"
598
633
  },
599
634
  {
600
635
  "key": "QL_700",
@@ -627,7 +662,8 @@ export const DEVICE_REGISTRY = {
627
662
  "hardwareQuirks": "Cassette-based media detection. Printer hard-rejects with an error code if the host job dimensions do not match the loaded DK cassette. Apps that compare detected vs selected media should switch to the matching cassette before sending.",
628
663
  "support": {
629
664
  "status": "untested"
630
- }
665
+ },
666
+ "supportStatus": "expected"
631
667
  },
632
668
  {
633
669
  "key": "QL_710W",
@@ -662,7 +698,8 @@ export const DEVICE_REGISTRY = {
662
698
  },
663
699
  "support": {
664
700
  "status": "untested"
665
- }
701
+ },
702
+ "supportStatus": "expected"
666
703
  },
667
704
  {
668
705
  "key": "QL_720NW",
@@ -694,7 +731,8 @@ export const DEVICE_REGISTRY = {
694
731
  ],
695
732
  "support": {
696
733
  "status": "untested"
697
- }
734
+ },
735
+ "supportStatus": "expected"
698
736
  },
699
737
  {
700
738
  "key": "QL_800",
@@ -727,7 +765,8 @@ export const DEVICE_REGISTRY = {
727
765
  },
728
766
  "support": {
729
767
  "status": "untested"
730
- }
768
+ },
769
+ "supportStatus": "expected"
731
770
  },
732
771
  {
733
772
  "key": "QL_810W",
@@ -763,7 +802,8 @@ export const DEVICE_REGISTRY = {
763
802
  },
764
803
  "support": {
765
804
  "status": "untested"
766
- }
805
+ },
806
+ "supportStatus": "expected"
767
807
  },
768
808
  {
769
809
  "key": "QL_820NWBc",
@@ -822,19 +862,37 @@ export const DEVICE_REGISTRY = {
822
862
  "notes": "Bench verification by the maintainer at the time of seeding this entry. Issue #0 is a placeholder — replace with the real issue number when a public verification report is filed."
823
863
  }
824
864
  ]
825
- }
865
+ },
866
+ "supportStatus": "verified"
826
867
  }
827
868
  ]
828
- } as const satisfies DeviceRegistry;
869
+ } as const satisfies RegistryWithStatus;
829
870
 
830
- type DeviceKey = (typeof DEVICE_REGISTRY)['devices'][number]['key'];
871
+ export type DeviceKey = 'PT_E550W' | 'PT_P750W' | 'PT_P900' | 'PT_P900W' | 'PT_P910BT' | 'PT_P950NW' | 'QL_1050' | 'QL_1060N' | 'QL_1100' | 'QL_1110NWB' | 'QL_1115NWB' | 'QL_500' | 'QL_550' | 'QL_560' | 'QL_570' | 'QL_580N' | 'QL_600' | 'QL_650TD' | 'QL_700' | 'QL_710W' | 'QL_720NW' | 'QL_800' | 'QL_810W' | 'QL_820NWBc';
831
872
 
832
- /**
833
- * Per-key map of device entries. Built from the registry array via
834
- * `Object.fromEntries`, but typed as `Record<DeviceKey, BrotherQLDevice>`
835
- * so consumers can write `DEVICES.QL_820NWBc` and get a precise type
836
- * back without literal narrowing leaking into engine capability access.
837
- */
838
- export const DEVICES = Object.fromEntries(
839
- DEVICE_REGISTRY.devices.map(d => [d.key, d]),
840
- ) as unknown as Record<DeviceKey, BrotherQLDevice>;
873
+ export const DEVICES: Record<DeviceKey, RegistryDeviceEntry> = {
874
+ PT_E550W: REGISTRY.devices[0],
875
+ PT_P750W: REGISTRY.devices[1],
876
+ PT_P900: REGISTRY.devices[2],
877
+ PT_P900W: REGISTRY.devices[3],
878
+ PT_P910BT: REGISTRY.devices[4],
879
+ PT_P950NW: REGISTRY.devices[5],
880
+ QL_1050: REGISTRY.devices[6],
881
+ QL_1060N: REGISTRY.devices[7],
882
+ QL_1100: REGISTRY.devices[8],
883
+ QL_1110NWB: REGISTRY.devices[9],
884
+ QL_1115NWB: REGISTRY.devices[10],
885
+ QL_500: REGISTRY.devices[11],
886
+ QL_550: REGISTRY.devices[12],
887
+ QL_560: REGISTRY.devices[13],
888
+ QL_570: REGISTRY.devices[14],
889
+ QL_580N: REGISTRY.devices[15],
890
+ QL_600: REGISTRY.devices[16],
891
+ QL_650TD: REGISTRY.devices[17],
892
+ QL_700: REGISTRY.devices[18],
893
+ QL_710W: REGISTRY.devices[19],
894
+ QL_720NW: REGISTRY.devices[20],
895
+ QL_800: REGISTRY.devices[21],
896
+ QL_810W: REGISTRY.devices[22],
897
+ QL_820NWBc: REGISTRY.devices[23],
898
+ };
package/src/devices.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  import type { BrotherQLDevice } from './types.js';
2
- import { DEVICES, DEVICE_REGISTRY } from './devices.generated.js';
2
+ import { DEVICES, REGISTRY } from './devices.generated.js';
3
+
4
+ // Re-exported under the historical name so external consumers keep
5
+ // importing `DEVICE_REGISTRY` while the generated module exports the
6
+ // labelwriter-aligned `REGISTRY` symbol.
7
+ export const DEVICE_REGISTRY = REGISTRY;
3
8
 
4
9
  // Mass-storage PIDs aligned to Linux usb-ids (gowdy.us / linux-usb.org).
5
10
  // Each large-format printer with Editor Lite enumerates as USB Mass
@@ -13,7 +18,7 @@ const MASS_STORAGE_PIDS = new Set<number>(
13
18
  }),
14
19
  );
15
20
 
16
- export { DEVICE_REGISTRY, DEVICES };
21
+ export { DEVICES };
17
22
 
18
23
  /**
19
24
  * Numeric VID/PID extracted from a device's USB transport.
package/src/index.ts CHANGED
@@ -54,6 +54,8 @@ export {
54
54
  } from './media.js';
55
55
  export { ROTATE_DIRECTION } from './orientation.js';
56
56
  export {
57
+ buildInitialize,
58
+ buildInvalidate,
57
59
  encodeJob,
58
60
  encodeJobForEngine,
59
61
  PT_PROTOCOL_CONFIG,