@printers/printers-linux-arm64-gnu 0.7.4 → 0.8.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.
package/index.d.ts CHANGED
@@ -49,6 +49,15 @@ export declare function getJobStatus(jobId: number): JobStatus | null
49
49
  /** Get the status of a print job (new format) */
50
50
  export declare function getPrinterJob(jobId: number): PrinterJob | null
51
51
 
52
+ /**
53
+ * Get a snapshot of current printer states
54
+ * Returns a map of printer names to their current state and state reasons
55
+ */
56
+ export declare function getPrinterStateSnapshot(): Record<string, [string, Array<string>]>
57
+
58
+ /** Check if state monitoring is active */
59
+ export declare function isStateMonitoringActive(): boolean
60
+
52
61
  /** Legacy job status interface for backward compatibility */
53
62
  export interface JobStatus {
54
63
  id: number
@@ -123,8 +132,27 @@ export declare const enum PrintErrorCode {
123
132
  FileNotFound = 7
124
133
  }
125
134
 
135
+ /** Printer state change event for JavaScript */
136
+ export interface PrinterStateChangeEvent {
137
+ eventType: string
138
+ printerName: string
139
+ oldState?: string
140
+ newState?: string
141
+ oldReasons?: Array<string>
142
+ newReasons?: Array<string>
143
+ }
144
+
126
145
  /** Print a file using printer name (async) */
127
146
  export declare function printFile(printerName: string, filePath: string, jobProperties?: Record<string, string> | undefined | null, waitForCompletion?: boolean | undefined | null): Promise<unknown>
128
147
 
148
+ /** Set the polling interval for state monitoring (in seconds) */
149
+ export declare function setStateMonitoringInterval(seconds: number): void
150
+
129
151
  /** Shutdown the library and cleanup all background threads */
130
152
  export declare function shutdown(): void
153
+
154
+ /** Start global printer state monitoring */
155
+ export declare function startStateMonitoring(): void
156
+
157
+ /** Stop global printer state monitoring */
158
+ export declare function stopStateMonitoring(): void
package/index.js CHANGED
@@ -1,507 +1,27 @@
1
1
  // prettier-ignore
2
2
  /* eslint-disable */
3
- /* auto-generated by NAPI-RS */
3
+ /* Minimal secure loader - generated by remove-env-check.js */
4
4
 
5
5
  import { createRequire } from 'node:module'
6
6
  const require = createRequire(import.meta.url)
7
- const __dirname = new URL('.', import.meta.url).pathname
8
7
 
9
- const { readFileSync } = require('node:fs')
10
8
  let nativeBinding = null
11
- const loadErrors = []
12
9
 
13
- const isMusl = () => {
14
- let musl = false
15
- if (process.platform === 'linux') {
16
- musl = isMuslFromFilesystem()
17
- if (musl === null) {
18
- musl = isMuslFromReport()
19
- }
20
- if (musl === null) {
21
- musl = isMuslFromChildProcess()
22
- }
23
- }
24
- return musl
25
- }
26
-
27
- const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
28
-
29
- const isMuslFromFilesystem = () => {
30
- try {
31
- return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
32
- } catch {
33
- return null
34
- }
35
- }
36
-
37
- const isMuslFromReport = () => {
38
- let report = null
39
- if (typeof process.report?.getReport === 'function') {
40
- process.report.excludeNetwork = true
41
- report = process.report.getReport()
42
- }
43
- if (!report) {
44
- return null
45
- }
46
- if (report.header && report.header.glibcVersionRuntime) {
47
- return false
48
- }
49
- if (Array.isArray(report.sharedObjects)) {
50
- if (report.sharedObjects.some(isFileMusl)) {
51
- return true
52
- }
53
- }
54
- return false
55
- }
56
-
57
- const isMuslFromChildProcess = () => {
10
+ try {
11
+ nativeBinding = require('./printers.linux-arm64-gnu.node')
12
+ } catch (localErr) {
58
13
  try {
59
- return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
60
- } catch (e) {
61
- // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
62
- return false
63
- }
64
- }
65
-
66
- function requireNative() {
67
- if (process.platform === 'android') {
68
- if (process.arch === 'arm64') {
69
- try {
70
- return require('./printers.android-arm64.node')
71
- } catch (e) {
72
- loadErrors.push(e)
73
- }
74
- try {
75
- const binding = require('@printers/printers-android-arm64')
76
- const bindingPackageVersion = require('@printers/printers-android-arm64/package.json').version
77
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
78
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
79
- }
80
- return binding
81
- } catch (e) {
82
- loadErrors.push(e)
83
- }
84
- } else if (process.arch === 'arm') {
85
- try {
86
- return require('./printers.android-arm-eabi.node')
87
- } catch (e) {
88
- loadErrors.push(e)
89
- }
90
- try {
91
- const binding = require('@printers/printers-android-arm-eabi')
92
- const bindingPackageVersion = require('@printers/printers-android-arm-eabi/package.json').version
93
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
94
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
95
- }
96
- return binding
97
- } catch (e) {
98
- loadErrors.push(e)
99
- }
100
- } else {
101
- loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
102
- }
103
- } else if (process.platform === 'win32') {
104
- if (process.arch === 'x64') {
105
- try {
106
- return require('./printers.win32-x64-msvc.node')
107
- } catch (e) {
108
- loadErrors.push(e)
109
- }
110
- try {
111
- const binding = require('@printers/printers-win32-x64-msvc')
112
- const bindingPackageVersion = require('@printers/printers-win32-x64-msvc/package.json').version
113
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
114
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
115
- }
116
- return binding
117
- } catch (e) {
118
- loadErrors.push(e)
119
- }
120
- } else if (process.arch === 'ia32') {
121
- try {
122
- return require('./printers.win32-ia32-msvc.node')
123
- } catch (e) {
124
- loadErrors.push(e)
125
- }
126
- try {
127
- const binding = require('@printers/printers-win32-ia32-msvc')
128
- const bindingPackageVersion = require('@printers/printers-win32-ia32-msvc/package.json').version
129
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
130
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
131
- }
132
- return binding
133
- } catch (e) {
134
- loadErrors.push(e)
135
- }
136
- } else if (process.arch === 'arm64') {
137
- try {
138
- return require('./printers.win32-arm64-msvc.node')
139
- } catch (e) {
140
- loadErrors.push(e)
141
- }
142
- try {
143
- const binding = require('@printers/printers-win32-arm64-msvc')
144
- const bindingPackageVersion = require('@printers/printers-win32-arm64-msvc/package.json').version
145
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
146
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
147
- }
148
- return binding
149
- } catch (e) {
150
- loadErrors.push(e)
151
- }
152
- } else {
153
- loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
154
- }
155
- } else if (process.platform === 'darwin') {
156
- try {
157
- return require('./printers.darwin-universal.node')
158
- } catch (e) {
159
- loadErrors.push(e)
160
- }
161
- try {
162
- const binding = require('@printers/printers-darwin-universal')
163
- const bindingPackageVersion = require('@printers/printers-darwin-universal/package.json').version
164
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
165
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
- }
167
- return binding
168
- } catch (e) {
169
- loadErrors.push(e)
170
- }
171
- if (process.arch === 'x64') {
172
- try {
173
- return require('./printers.darwin-x64.node')
174
- } catch (e) {
175
- loadErrors.push(e)
176
- }
177
- try {
178
- const binding = require('@printers/printers-darwin-x64')
179
- const bindingPackageVersion = require('@printers/printers-darwin-x64/package.json').version
180
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
181
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
182
- }
183
- return binding
184
- } catch (e) {
185
- loadErrors.push(e)
186
- }
187
- } else if (process.arch === 'arm64') {
188
- try {
189
- return require('./printers.darwin-arm64.node')
190
- } catch (e) {
191
- loadErrors.push(e)
192
- }
193
- try {
194
- const binding = require('@printers/printers-darwin-arm64')
195
- const bindingPackageVersion = require('@printers/printers-darwin-arm64/package.json').version
196
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
197
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
198
- }
199
- return binding
200
- } catch (e) {
201
- loadErrors.push(e)
202
- }
203
- } else {
204
- loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
205
- }
206
- } else if (process.platform === 'freebsd') {
207
- if (process.arch === 'x64') {
208
- try {
209
- return require('./printers.freebsd-x64.node')
210
- } catch (e) {
211
- loadErrors.push(e)
212
- }
213
- try {
214
- const binding = require('@printers/printers-freebsd-x64')
215
- const bindingPackageVersion = require('@printers/printers-freebsd-x64/package.json').version
216
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
217
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
218
- }
219
- return binding
220
- } catch (e) {
221
- loadErrors.push(e)
222
- }
223
- } else if (process.arch === 'arm64') {
224
- try {
225
- return require('./printers.freebsd-arm64.node')
226
- } catch (e) {
227
- loadErrors.push(e)
228
- }
229
- try {
230
- const binding = require('@printers/printers-freebsd-arm64')
231
- const bindingPackageVersion = require('@printers/printers-freebsd-arm64/package.json').version
232
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
233
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
234
- }
235
- return binding
236
- } catch (e) {
237
- loadErrors.push(e)
238
- }
239
- } else {
240
- loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
241
- }
242
- } else if (process.platform === 'linux') {
243
- if (process.arch === 'x64') {
244
- if (isMusl()) {
245
- try {
246
- return require('./printers.linux-x64-musl.node')
247
- } catch (e) {
248
- loadErrors.push(e)
249
- }
250
- try {
251
- const binding = require('@printers/printers-linux-x64-musl')
252
- const bindingPackageVersion = require('@printers/printers-linux-x64-musl/package.json').version
253
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
- }
256
- return binding
257
- } catch (e) {
258
- loadErrors.push(e)
259
- }
260
- } else {
261
- try {
262
- return require('./printers.linux-x64-gnu.node')
263
- } catch (e) {
264
- loadErrors.push(e)
265
- }
266
- try {
267
- const binding = require('@printers/printers-linux-x64-gnu')
268
- const bindingPackageVersion = require('@printers/printers-linux-x64-gnu/package.json').version
269
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
270
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
271
- }
272
- return binding
273
- } catch (e) {
274
- loadErrors.push(e)
275
- }
276
- }
277
- } else if (process.arch === 'arm64') {
278
- if (isMusl()) {
279
- try {
280
- return require('./printers.linux-arm64-musl.node')
281
- } catch (e) {
282
- loadErrors.push(e)
283
- }
284
- try {
285
- const binding = require('@printers/printers-linux-arm64-musl')
286
- const bindingPackageVersion = require('@printers/printers-linux-arm64-musl/package.json').version
287
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
288
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
289
- }
290
- return binding
291
- } catch (e) {
292
- loadErrors.push(e)
293
- }
294
- } else {
295
- try {
296
- return require('./printers.linux-arm64-gnu.node')
297
- } catch (e) {
298
- loadErrors.push(e)
299
- }
300
- try {
301
- const binding = require('@printers/printers-linux-arm64-gnu')
302
- const bindingPackageVersion = require('@printers/printers-linux-arm64-gnu/package.json').version
303
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
304
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
305
- }
306
- return binding
307
- } catch (e) {
308
- loadErrors.push(e)
309
- }
310
- }
311
- } else if (process.arch === 'arm') {
312
- if (isMusl()) {
313
- try {
314
- return require('./printers.linux-arm-musleabihf.node')
315
- } catch (e) {
316
- loadErrors.push(e)
317
- }
318
- try {
319
- const binding = require('@printers/printers-linux-arm-musleabihf')
320
- const bindingPackageVersion = require('@printers/printers-linux-arm-musleabihf/package.json').version
321
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
322
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
323
- }
324
- return binding
325
- } catch (e) {
326
- loadErrors.push(e)
327
- }
328
- } else {
329
- try {
330
- return require('./printers.linux-arm-gnueabihf.node')
331
- } catch (e) {
332
- loadErrors.push(e)
333
- }
334
- try {
335
- const binding = require('@printers/printers-linux-arm-gnueabihf')
336
- const bindingPackageVersion = require('@printers/printers-linux-arm-gnueabihf/package.json').version
337
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
338
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
339
- }
340
- return binding
341
- } catch (e) {
342
- loadErrors.push(e)
343
- }
344
- }
345
- } else if (process.arch === 'riscv64') {
346
- if (isMusl()) {
347
- try {
348
- return require('./printers.linux-riscv64-musl.node')
349
- } catch (e) {
350
- loadErrors.push(e)
351
- }
352
- try {
353
- const binding = require('@printers/printers-linux-riscv64-musl')
354
- const bindingPackageVersion = require('@printers/printers-linux-riscv64-musl/package.json').version
355
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
356
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
357
- }
358
- return binding
359
- } catch (e) {
360
- loadErrors.push(e)
361
- }
362
- } else {
363
- try {
364
- return require('./printers.linux-riscv64-gnu.node')
365
- } catch (e) {
366
- loadErrors.push(e)
367
- }
368
- try {
369
- const binding = require('@printers/printers-linux-riscv64-gnu')
370
- const bindingPackageVersion = require('@printers/printers-linux-riscv64-gnu/package.json').version
371
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
372
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
373
- }
374
- return binding
375
- } catch (e) {
376
- loadErrors.push(e)
377
- }
378
- }
379
- } else if (process.arch === 'ppc64') {
380
- try {
381
- return require('./printers.linux-ppc64-gnu.node')
382
- } catch (e) {
383
- loadErrors.push(e)
384
- }
385
- try {
386
- const binding = require('@printers/printers-linux-ppc64-gnu')
387
- const bindingPackageVersion = require('@printers/printers-linux-ppc64-gnu/package.json').version
388
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
389
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
390
- }
391
- return binding
392
- } catch (e) {
393
- loadErrors.push(e)
394
- }
395
- } else if (process.arch === 's390x') {
396
- try {
397
- return require('./printers.linux-s390x-gnu.node')
398
- } catch (e) {
399
- loadErrors.push(e)
400
- }
401
- try {
402
- const binding = require('@printers/printers-linux-s390x-gnu')
403
- const bindingPackageVersion = require('@printers/printers-linux-s390x-gnu/package.json').version
404
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
405
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
406
- }
407
- return binding
408
- } catch (e) {
409
- loadErrors.push(e)
410
- }
411
- } else {
412
- loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
413
- }
414
- } else if (process.platform === 'openharmony') {
415
- if (process.arch === 'arm64') {
416
- try {
417
- return require('./printers.openharmony-arm64.node')
418
- } catch (e) {
419
- loadErrors.push(e)
420
- }
421
- try {
422
- const binding = require('@printers/printers-openharmony-arm64')
423
- const bindingPackageVersion = require('@printers/printers-openharmony-arm64/package.json').version
424
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
425
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
- }
427
- return binding
428
- } catch (e) {
429
- loadErrors.push(e)
430
- }
431
- } else if (process.arch === 'x64') {
432
- try {
433
- return require('./printers.openharmony-x64.node')
434
- } catch (e) {
435
- loadErrors.push(e)
436
- }
437
- try {
438
- const binding = require('@printers/printers-openharmony-x64')
439
- const bindingPackageVersion = require('@printers/printers-openharmony-x64/package.json').version
440
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
441
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
442
- }
443
- return binding
444
- } catch (e) {
445
- loadErrors.push(e)
446
- }
447
- } else if (process.arch === 'arm') {
448
- try {
449
- return require('./printers.openharmony-arm.node')
450
- } catch (e) {
451
- loadErrors.push(e)
452
- }
453
- try {
454
- const binding = require('@printers/printers-openharmony-arm')
455
- const bindingPackageVersion = require('@printers/printers-openharmony-arm/package.json').version
456
- if (bindingPackageVersion !== '0.7.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
457
- throw new Error(`Native binding package version mismatch, expected 0.7.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
458
- }
459
- return binding
460
- } catch (e) {
461
- loadErrors.push(e)
462
- }
463
- } else {
464
- loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
465
- }
466
- } else {
467
- loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
468
- }
469
- }
470
-
471
- nativeBinding = requireNative()
472
-
473
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
474
- try {
475
- nativeBinding = require('./printers.wasi.cjs')
476
- } catch (err) {
477
- if (process.env.NAPI_RS_FORCE_WASI) {
478
- loadErrors.push(err)
479
- }
480
- }
481
- if (!nativeBinding) {
482
- try {
483
- nativeBinding = require('@printers/printers-wasm32-wasi')
484
- } catch (err) {
485
- if (process.env.NAPI_RS_FORCE_WASI) {
486
- loadErrors.push(err)
487
- }
488
- }
489
- }
490
- }
491
-
492
- if (!nativeBinding) {
493
- if (loadErrors.length > 0) {
14
+ nativeBinding = require('@printers/printers-linux-arm64-gnu')
15
+ } catch (packageErr) {
494
16
  throw new Error(
495
- `Cannot find native binding. ` +
496
- `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
497
- 'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
498
- { cause: loadErrors }
17
+ `Failed to load native binding for linux-arm64-gnu. ` +
18
+ `Please try reinstalling the package.`,
19
+ { cause: [localErr, packageErr] }
499
20
  )
500
21
  }
501
- throw new Error(`Failed to load native binding`)
502
22
  }
503
23
 
504
- const { Printer, cleanupOldJobs, findPrinterByName, getActiveJobs, getActiveJobsForPrinter, getAllJobsForPrinter, getAllPrinterNames, getAllPrinters, getJobHistory, getJobHistoryForPrinter, getJobStatus, getPrinterJob, printBytes, printerCleanupOldJobs, printerExists, printerGetActiveJobs, printerGetAllJobs, printerGetJob, printerGetJobHistory, PrintErrorCode, printFile, shutdown } = nativeBinding
24
+ const { Printer, cleanupOldJobs, findPrinterByName, getActiveJobs, getActiveJobsForPrinter, getAllJobsForPrinter, getAllPrinterNames, getAllPrinters, getJobHistory, getJobHistoryForPrinter, getJobStatus, getPrinterJob, getPrinterStateSnapshot, isStateMonitoringActive, printBytes, printerCleanupOldJobs, printerExists, printerGetActiveJobs, printerGetAllJobs, printerGetJob, printerGetJobHistory, PrintErrorCode, printFile, setStateMonitoringInterval, shutdown, startStateMonitoring, stopStateMonitoring } = nativeBinding
505
25
  export { Printer }
506
26
  export { cleanupOldJobs }
507
27
  export { findPrinterByName }
@@ -514,6 +34,8 @@ export { getJobHistory }
514
34
  export { getJobHistoryForPrinter }
515
35
  export { getJobStatus }
516
36
  export { getPrinterJob }
37
+ export { getPrinterStateSnapshot }
38
+ export { isStateMonitoringActive }
517
39
  export { printBytes }
518
40
  export { printerCleanupOldJobs }
519
41
  export { printerExists }
@@ -523,4 +45,7 @@ export { printerGetJob }
523
45
  export { printerGetJobHistory }
524
46
  export { PrintErrorCode }
525
47
  export { printFile }
48
+ export { setStateMonitoringInterval }
526
49
  export { shutdown }
50
+ export { startStateMonitoring }
51
+ export { stopStateMonitoring }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@printers/printers-linux-arm64-gnu",
3
- "version": "0.7.4",
3
+ "version": "0.8.1",
4
4
  "cpu": [
5
5
  "arm64"
6
6
  ],
Binary file