govee-toolkit 0.4.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.
- package/README.md +2 -2
- package/binding.cjs +119 -56
- package/binding.d.cts +201 -89
- package/dist/index.d.ts +7 -3
- package/dist/index.js +6 -2
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ wire.
|
|
|
10
10
|
|
|
11
11
|
[](https://github.com/damient/govee-toolkit/blob/main/docs/roadmap.md)
|
|
12
12
|
[](https://github.com/damient/govee-toolkit/blob/main/LICENSE)
|
|
13
|
-
[](https://github.com/damient/govee-toolkit/actions/workflows/ci.yml)
|
|
13
|
+
[](https://github.com/damient/govee-toolkit/actions/workflows/ci.yml?query=branch%3Amain)
|
|
14
14
|
|
|
15
15
|
[](https://crates.io/crates/govee-toolkit)
|
|
16
16
|
[](https://crates.io/crates/govee-toolkit-cli)
|
|
@@ -41,7 +41,7 @@ than taking a slower path in silence.
|
|
|
41
41
|
<a href="https://gvetk.com/docs/start/"><img alt="Get started" src="https://img.shields.io/badge/Get%20started-0b7285?style=for-the-badge"></a>
|
|
42
42
|
<a href="https://gvetk.com/devices/"><img alt="Devices" src="https://img.shields.io/badge/Devices-3b444b?style=for-the-badge"></a>
|
|
43
43
|
<a href="https://gvetk.com/docs/modes/"><img alt="Modes" src="https://img.shields.io/badge/Modes-3b444b?style=for-the-badge"></a>
|
|
44
|
-
<a href="https://gvetk.com/reference/"><img alt="API reference" src="https://img.shields.io/badge/API%20reference-3b444b?style=for-the-badge"></a>
|
|
44
|
+
<a href="https://gvetk.com/docs/reference/"><img alt="API reference" src="https://img.shields.io/badge/API%20reference-3b444b?style=for-the-badge"></a>
|
|
45
45
|
<a href="https://github.com/damient/govee-toolkit/blob/main/devices/README.md"><img alt="Add a device" src="https://img.shields.io/badge/Add%20a%20device-3b444b?style=for-the-badge"></a>
|
|
46
46
|
</p>
|
|
47
47
|
|
package/binding.cjs
CHANGED
|
@@ -6,8 +6,13 @@ const { readFileSync } = require('fs')
|
|
|
6
6
|
let nativeBinding = null
|
|
7
7
|
// Which artifact actually loaded. The WASI fallback chain overwrites it with
|
|
8
8
|
// the flavor it resolved; the late native retry below leaves it alone because
|
|
9
|
-
// it only runs while no WASI candidate has been loaded.
|
|
9
|
+
// it only runs while no WASI candidate has been loaded. The take-over check
|
|
10
|
+
// after the load-failure block can also set it.
|
|
10
11
|
let __napiLoadedBindingTarget = 'native'
|
|
12
|
+
// What this loader's own `requireNative()` calls returned. The check after
|
|
13
|
+
// the load-failure block compares it with `nativeBinding` to tell a binding
|
|
14
|
+
// this loader loaded from one that code outside it put in its place.
|
|
15
|
+
let __napiRequiredNativeBinding = null
|
|
11
16
|
const loadErrors = []
|
|
12
17
|
|
|
13
18
|
const isMusl = () => {
|
|
@@ -89,8 +94,8 @@ function requireNative() {
|
|
|
89
94
|
try {
|
|
90
95
|
const binding = require('govee-toolkit-android-arm64')
|
|
91
96
|
const bindingPackageVersion = require('govee-toolkit-android-arm64/package.json').version
|
|
92
|
-
if (bindingPackageVersion !== '0.
|
|
93
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
97
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
98
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
94
99
|
}
|
|
95
100
|
return binding
|
|
96
101
|
} catch (e) {
|
|
@@ -105,8 +110,8 @@ function requireNative() {
|
|
|
105
110
|
try {
|
|
106
111
|
const binding = require('govee-toolkit-android-arm-eabi')
|
|
107
112
|
const bindingPackageVersion = require('govee-toolkit-android-arm-eabi/package.json').version
|
|
108
|
-
if (bindingPackageVersion !== '0.
|
|
109
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
113
|
+
if (bindingPackageVersion !== '0.6.0' && 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.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
110
115
|
}
|
|
111
116
|
return binding
|
|
112
117
|
} catch (e) {
|
|
@@ -126,8 +131,8 @@ function requireNative() {
|
|
|
126
131
|
try {
|
|
127
132
|
const binding = require('govee-toolkit-win32-x64-gnu')
|
|
128
133
|
const bindingPackageVersion = require('govee-toolkit-win32-x64-gnu/package.json').version
|
|
129
|
-
if (bindingPackageVersion !== '0.
|
|
130
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
134
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
135
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
131
136
|
}
|
|
132
137
|
return binding
|
|
133
138
|
} catch (e) {
|
|
@@ -142,8 +147,8 @@ function requireNative() {
|
|
|
142
147
|
try {
|
|
143
148
|
const binding = require('govee-toolkit-win32-x64-msvc')
|
|
144
149
|
const bindingPackageVersion = require('govee-toolkit-win32-x64-msvc/package.json').version
|
|
145
|
-
if (bindingPackageVersion !== '0.
|
|
146
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
150
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
147
152
|
}
|
|
148
153
|
return binding
|
|
149
154
|
} catch (e) {
|
|
@@ -159,8 +164,8 @@ function requireNative() {
|
|
|
159
164
|
try {
|
|
160
165
|
const binding = require('govee-toolkit-win32-ia32-msvc')
|
|
161
166
|
const bindingPackageVersion = require('govee-toolkit-win32-ia32-msvc/package.json').version
|
|
162
|
-
if (bindingPackageVersion !== '0.
|
|
163
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
167
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
168
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
164
169
|
}
|
|
165
170
|
return binding
|
|
166
171
|
} catch (e) {
|
|
@@ -175,8 +180,8 @@ function requireNative() {
|
|
|
175
180
|
try {
|
|
176
181
|
const binding = require('govee-toolkit-win32-arm64-msvc')
|
|
177
182
|
const bindingPackageVersion = require('govee-toolkit-win32-arm64-msvc/package.json').version
|
|
178
|
-
if (bindingPackageVersion !== '0.
|
|
179
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
183
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
184
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
180
185
|
}
|
|
181
186
|
return binding
|
|
182
187
|
} catch (e) {
|
|
@@ -194,8 +199,8 @@ function requireNative() {
|
|
|
194
199
|
try {
|
|
195
200
|
const binding = require('govee-toolkit-darwin-universal')
|
|
196
201
|
const bindingPackageVersion = require('govee-toolkit-darwin-universal/package.json').version
|
|
197
|
-
if (bindingPackageVersion !== '0.
|
|
198
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
202
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
203
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
199
204
|
}
|
|
200
205
|
return binding
|
|
201
206
|
} catch (e) {
|
|
@@ -210,8 +215,8 @@ function requireNative() {
|
|
|
210
215
|
try {
|
|
211
216
|
const binding = require('govee-toolkit-darwin-x64')
|
|
212
217
|
const bindingPackageVersion = require('govee-toolkit-darwin-x64/package.json').version
|
|
213
|
-
if (bindingPackageVersion !== '0.
|
|
214
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
218
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
219
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
215
220
|
}
|
|
216
221
|
return binding
|
|
217
222
|
} catch (e) {
|
|
@@ -226,8 +231,8 @@ function requireNative() {
|
|
|
226
231
|
try {
|
|
227
232
|
const binding = require('govee-toolkit-darwin-arm64')
|
|
228
233
|
const bindingPackageVersion = require('govee-toolkit-darwin-arm64/package.json').version
|
|
229
|
-
if (bindingPackageVersion !== '0.
|
|
230
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
234
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
235
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
231
236
|
}
|
|
232
237
|
return binding
|
|
233
238
|
} catch (e) {
|
|
@@ -246,8 +251,8 @@ function requireNative() {
|
|
|
246
251
|
try {
|
|
247
252
|
const binding = require('govee-toolkit-freebsd-x64')
|
|
248
253
|
const bindingPackageVersion = require('govee-toolkit-freebsd-x64/package.json').version
|
|
249
|
-
if (bindingPackageVersion !== '0.
|
|
250
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
254
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
255
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
251
256
|
}
|
|
252
257
|
return binding
|
|
253
258
|
} catch (e) {
|
|
@@ -262,8 +267,24 @@ function requireNative() {
|
|
|
262
267
|
try {
|
|
263
268
|
const binding = require('govee-toolkit-freebsd-arm64')
|
|
264
269
|
const bindingPackageVersion = require('govee-toolkit-freebsd-arm64/package.json').version
|
|
265
|
-
if (bindingPackageVersion !== '0.
|
|
266
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
270
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
271
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
272
|
+
}
|
|
273
|
+
return binding
|
|
274
|
+
} catch (e) {
|
|
275
|
+
loadErrors.push(e)
|
|
276
|
+
}
|
|
277
|
+
} else if (process.arch === 'ppc64') {
|
|
278
|
+
try {
|
|
279
|
+
return require('./govee-toolkit.freebsd-ppc64.node')
|
|
280
|
+
} catch (e) {
|
|
281
|
+
loadErrors.push(e)
|
|
282
|
+
}
|
|
283
|
+
try {
|
|
284
|
+
const binding = require('govee-toolkit-freebsd-ppc64')
|
|
285
|
+
const bindingPackageVersion = require('govee-toolkit-freebsd-ppc64/package.json').version
|
|
286
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
287
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
267
288
|
}
|
|
268
289
|
return binding
|
|
269
290
|
} catch (e) {
|
|
@@ -283,8 +304,8 @@ function requireNative() {
|
|
|
283
304
|
try {
|
|
284
305
|
const binding = require('govee-toolkit-linux-x64-musl')
|
|
285
306
|
const bindingPackageVersion = require('govee-toolkit-linux-x64-musl/package.json').version
|
|
286
|
-
if (bindingPackageVersion !== '0.
|
|
287
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
307
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
308
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
288
309
|
}
|
|
289
310
|
return binding
|
|
290
311
|
} catch (e) {
|
|
@@ -299,8 +320,8 @@ function requireNative() {
|
|
|
299
320
|
try {
|
|
300
321
|
const binding = require('govee-toolkit-linux-x64-gnu')
|
|
301
322
|
const bindingPackageVersion = require('govee-toolkit-linux-x64-gnu/package.json').version
|
|
302
|
-
if (bindingPackageVersion !== '0.
|
|
303
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
323
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
324
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
304
325
|
}
|
|
305
326
|
return binding
|
|
306
327
|
} catch (e) {
|
|
@@ -317,8 +338,8 @@ function requireNative() {
|
|
|
317
338
|
try {
|
|
318
339
|
const binding = require('govee-toolkit-linux-arm64-musl')
|
|
319
340
|
const bindingPackageVersion = require('govee-toolkit-linux-arm64-musl/package.json').version
|
|
320
|
-
if (bindingPackageVersion !== '0.
|
|
321
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
341
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
342
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
322
343
|
}
|
|
323
344
|
return binding
|
|
324
345
|
} catch (e) {
|
|
@@ -333,8 +354,8 @@ function requireNative() {
|
|
|
333
354
|
try {
|
|
334
355
|
const binding = require('govee-toolkit-linux-arm64-gnu')
|
|
335
356
|
const bindingPackageVersion = require('govee-toolkit-linux-arm64-gnu/package.json').version
|
|
336
|
-
if (bindingPackageVersion !== '0.
|
|
337
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
357
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
358
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
338
359
|
}
|
|
339
360
|
return binding
|
|
340
361
|
} catch (e) {
|
|
@@ -351,8 +372,8 @@ function requireNative() {
|
|
|
351
372
|
try {
|
|
352
373
|
const binding = require('govee-toolkit-linux-arm-musleabihf')
|
|
353
374
|
const bindingPackageVersion = require('govee-toolkit-linux-arm-musleabihf/package.json').version
|
|
354
|
-
if (bindingPackageVersion !== '0.
|
|
355
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
375
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
376
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
356
377
|
}
|
|
357
378
|
return binding
|
|
358
379
|
} catch (e) {
|
|
@@ -367,8 +388,8 @@ function requireNative() {
|
|
|
367
388
|
try {
|
|
368
389
|
const binding = require('govee-toolkit-linux-arm-gnueabihf')
|
|
369
390
|
const bindingPackageVersion = require('govee-toolkit-linux-arm-gnueabihf/package.json').version
|
|
370
|
-
if (bindingPackageVersion !== '0.
|
|
371
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
391
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
392
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
372
393
|
}
|
|
373
394
|
return binding
|
|
374
395
|
} catch (e) {
|
|
@@ -385,8 +406,8 @@ function requireNative() {
|
|
|
385
406
|
try {
|
|
386
407
|
const binding = require('govee-toolkit-linux-loong64-musl')
|
|
387
408
|
const bindingPackageVersion = require('govee-toolkit-linux-loong64-musl/package.json').version
|
|
388
|
-
if (bindingPackageVersion !== '0.
|
|
389
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
409
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
410
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
390
411
|
}
|
|
391
412
|
return binding
|
|
392
413
|
} catch (e) {
|
|
@@ -401,8 +422,8 @@ function requireNative() {
|
|
|
401
422
|
try {
|
|
402
423
|
const binding = require('govee-toolkit-linux-loong64-gnu')
|
|
403
424
|
const bindingPackageVersion = require('govee-toolkit-linux-loong64-gnu/package.json').version
|
|
404
|
-
if (bindingPackageVersion !== '0.
|
|
405
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
425
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
426
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
406
427
|
}
|
|
407
428
|
return binding
|
|
408
429
|
} catch (e) {
|
|
@@ -419,8 +440,8 @@ function requireNative() {
|
|
|
419
440
|
try {
|
|
420
441
|
const binding = require('govee-toolkit-linux-riscv64-musl')
|
|
421
442
|
const bindingPackageVersion = require('govee-toolkit-linux-riscv64-musl/package.json').version
|
|
422
|
-
if (bindingPackageVersion !== '0.
|
|
423
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
443
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
424
445
|
}
|
|
425
446
|
return binding
|
|
426
447
|
} catch (e) {
|
|
@@ -435,8 +456,8 @@ function requireNative() {
|
|
|
435
456
|
try {
|
|
436
457
|
const binding = require('govee-toolkit-linux-riscv64-gnu')
|
|
437
458
|
const bindingPackageVersion = require('govee-toolkit-linux-riscv64-gnu/package.json').version
|
|
438
|
-
if (bindingPackageVersion !== '0.
|
|
439
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
459
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
440
461
|
}
|
|
441
462
|
return binding
|
|
442
463
|
} catch (e) {
|
|
@@ -452,8 +473,8 @@ function requireNative() {
|
|
|
452
473
|
try {
|
|
453
474
|
const binding = require('govee-toolkit-linux-ppc64-gnu')
|
|
454
475
|
const bindingPackageVersion = require('govee-toolkit-linux-ppc64-gnu/package.json').version
|
|
455
|
-
if (bindingPackageVersion !== '0.
|
|
456
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
476
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
477
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
457
478
|
}
|
|
458
479
|
return binding
|
|
459
480
|
} catch (e) {
|
|
@@ -468,8 +489,8 @@ function requireNative() {
|
|
|
468
489
|
try {
|
|
469
490
|
const binding = require('govee-toolkit-linux-s390x-gnu')
|
|
470
491
|
const bindingPackageVersion = require('govee-toolkit-linux-s390x-gnu/package.json').version
|
|
471
|
-
if (bindingPackageVersion !== '0.
|
|
472
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
492
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
493
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
473
494
|
}
|
|
474
495
|
return binding
|
|
475
496
|
} catch (e) {
|
|
@@ -488,8 +509,8 @@ function requireNative() {
|
|
|
488
509
|
try {
|
|
489
510
|
const binding = require('govee-toolkit-openharmony-arm64')
|
|
490
511
|
const bindingPackageVersion = require('govee-toolkit-openharmony-arm64/package.json').version
|
|
491
|
-
if (bindingPackageVersion !== '0.
|
|
492
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
512
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
513
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
493
514
|
}
|
|
494
515
|
return binding
|
|
495
516
|
} catch (e) {
|
|
@@ -504,8 +525,8 @@ function requireNative() {
|
|
|
504
525
|
try {
|
|
505
526
|
const binding = require('govee-toolkit-openharmony-x64')
|
|
506
527
|
const bindingPackageVersion = require('govee-toolkit-openharmony-x64/package.json').version
|
|
507
|
-
if (bindingPackageVersion !== '0.
|
|
508
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
528
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
529
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
509
530
|
}
|
|
510
531
|
return binding
|
|
511
532
|
} catch (e) {
|
|
@@ -520,8 +541,8 @@ function requireNative() {
|
|
|
520
541
|
try {
|
|
521
542
|
const binding = require('govee-toolkit-openharmony-arm')
|
|
522
543
|
const bindingPackageVersion = require('govee-toolkit-openharmony-arm/package.json').version
|
|
523
|
-
if (bindingPackageVersion !== '0.
|
|
524
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
544
|
+
if (bindingPackageVersion !== '0.6.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
545
|
+
throw new Error(`Native binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
525
546
|
}
|
|
526
547
|
return binding
|
|
527
548
|
} catch (e) {
|
|
@@ -585,6 +606,7 @@ const forceWasi =
|
|
|
585
606
|
|
|
586
607
|
if (!forceWasi) {
|
|
587
608
|
nativeBinding = requireNative()
|
|
609
|
+
__napiRequiredNativeBinding = nativeBinding
|
|
588
610
|
}
|
|
589
611
|
|
|
590
612
|
if (!nativeBinding || forceWasi) {
|
|
@@ -661,8 +683,8 @@ if (!nativeBinding || forceWasi) {
|
|
|
661
683
|
if (!candidateFailed) {
|
|
662
684
|
if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
663
685
|
const bindingPackageVersion = require('govee-toolkit-wasm32-wasi/package.json').version
|
|
664
|
-
if (bindingPackageVersion !== '0.
|
|
665
|
-
throw new Error(`WASI binding package version mismatch, expected 0.
|
|
686
|
+
if (bindingPackageVersion !== '0.6.0') {
|
|
687
|
+
throw new Error(`WASI binding package version mismatch, expected 0.6.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
666
688
|
}
|
|
667
689
|
}
|
|
668
690
|
wasiBinding = require('govee-toolkit-wasm32-wasi')
|
|
@@ -686,6 +708,7 @@ if (!nativeBinding || forceWasi) {
|
|
|
686
708
|
!__napiWasiFlavorRequested
|
|
687
709
|
) {
|
|
688
710
|
nativeBinding = requireNative()
|
|
711
|
+
__napiRequiredNativeBinding = nativeBinding
|
|
689
712
|
}
|
|
690
713
|
if ((forceWasiError || __napiWasiFlavorRequested) && !wasiBindingLoaded) {
|
|
691
714
|
const error = new Error(
|
|
@@ -713,6 +736,40 @@ if (!nativeBinding) {
|
|
|
713
736
|
throw new Error(`Failed to load native binding`)
|
|
714
737
|
}
|
|
715
738
|
|
|
739
|
+
// A package can patch its own fallback in front of the load-failure check
|
|
740
|
+
// above, e.g. a WebContainer download through `napi-postinstall/fallback`.
|
|
741
|
+
// That fallback swaps `nativeBinding` for a generated WASI loader, which has
|
|
742
|
+
// already stamped its own flavor, while the target above still says 'native'.
|
|
743
|
+
// Take that flavor over, or the CommonJS stamp throws a conflict and the ESM
|
|
744
|
+
// export reports the wrong artifact. Three limits keep the conflict check:
|
|
745
|
+
// - only a binding this loader did not load itself, so a native addon whose
|
|
746
|
+
// `#[napi(module_exports)]` hook claims the name is still rejected;
|
|
747
|
+
// - only an own data property, read through its descriptor, so no addon
|
|
748
|
+
// getter runs here, and it must read back the same, as the stamp reads it;
|
|
749
|
+
// - only a flavor in `__napiWasiFlavors`, the ones this loader's own WASI
|
|
750
|
+
// chain can report ('wasm32-wasi' for a package without a WASI target).
|
|
751
|
+
// This is metadata and never fails a load: a throwing Proxy trap keeps 'native'.
|
|
752
|
+
if (
|
|
753
|
+
__napiLoadedBindingTarget === 'native' &&
|
|
754
|
+
nativeBinding !== __napiRequiredNativeBinding
|
|
755
|
+
) {
|
|
756
|
+
try {
|
|
757
|
+
const __napiBindingTargetDescriptor = Object.getOwnPropertyDescriptor(
|
|
758
|
+
nativeBinding,
|
|
759
|
+
'__napiBindingTarget',
|
|
760
|
+
)
|
|
761
|
+
if (
|
|
762
|
+
__napiBindingTargetDescriptor &&
|
|
763
|
+
__napiWasiFlavors.indexOf(__napiBindingTargetDescriptor.value) !== -1 &&
|
|
764
|
+
nativeBinding.__napiBindingTarget === __napiBindingTargetDescriptor.value
|
|
765
|
+
) {
|
|
766
|
+
__napiLoadedBindingTarget = __napiBindingTargetDescriptor.value
|
|
767
|
+
}
|
|
768
|
+
} catch {
|
|
769
|
+
// keep 'native'
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
|
|
716
773
|
function __napiStampBindingTarget(exportsObject, target) {
|
|
717
774
|
if (
|
|
718
775
|
Object.prototype.hasOwnProperty.call(exportsObject, '__napiBindingTarget')
|
|
@@ -778,20 +835,26 @@ function __napiStampBindingTarget(exportsObject, target) {
|
|
|
778
835
|
// linked import resolves to `undefined`.
|
|
779
836
|
module.exports.__napiBindingTarget = __napiStampBindingTarget(nativeBinding, __napiLoadedBindingTarget)
|
|
780
837
|
module.exports = nativeBinding
|
|
838
|
+
module.exports.Applied = nativeBinding.Applied
|
|
839
|
+
module.exports.AppliedStep = nativeBinding.AppliedStep
|
|
781
840
|
module.exports.Catalog = nativeBinding.Catalog
|
|
782
841
|
module.exports.Config = nativeBinding.Config
|
|
783
842
|
module.exports.Device = nativeBinding.Device
|
|
784
843
|
module.exports.DeviceHandle = nativeBinding.DeviceHandle
|
|
844
|
+
module.exports.Devices = nativeBinding.Devices
|
|
785
845
|
module.exports.DeviceStatus = nativeBinding.DeviceStatus
|
|
786
846
|
module.exports.EventStream = nativeBinding.EventStream
|
|
787
847
|
module.exports.Govee = nativeBinding.Govee
|
|
788
|
-
module.exports.GroupHandle = nativeBinding.GroupHandle
|
|
789
848
|
module.exports.Health = nativeBinding.Health
|
|
849
|
+
module.exports.Invoked = nativeBinding.Invoked
|
|
790
850
|
module.exports.Outcome = nativeBinding.Outcome
|
|
791
851
|
module.exports.Reply = nativeBinding.Reply
|
|
792
852
|
module.exports.SegmentStream = nativeBinding.SegmentStream
|
|
793
853
|
module.exports.Served = nativeBinding.Served
|
|
794
854
|
module.exports.StatusStream = nativeBinding.StatusStream
|
|
855
|
+
module.exports.WalkReport = nativeBinding.WalkReport
|
|
795
856
|
module.exports.CORE_VERSION = nativeBinding.CORE_VERSION
|
|
796
857
|
module.exports.modes = nativeBinding.modes
|
|
858
|
+
module.exports.personalities = nativeBinding.personalities
|
|
859
|
+
module.exports.supportLevels = nativeBinding.supportLevels
|
|
797
860
|
module.exports.VERSION = nativeBinding.VERSION
|
package/binding.d.cts
CHANGED
|
@@ -9,6 +9,29 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
|
|
11
11
|
|
|
12
|
+
/** What `Devices.apply()` answered. */
|
|
13
|
+
export declare class Applied {
|
|
14
|
+
/** The scan of every member, run before the verbs. */
|
|
15
|
+
get reached(): Array<Outcome>
|
|
16
|
+
/** One per verb, in the order sent. */
|
|
17
|
+
get steps(): Array<AppliedStep>
|
|
18
|
+
/** Whether every member took every step. */
|
|
19
|
+
get ok(): boolean
|
|
20
|
+
/**
|
|
21
|
+
* `"N of M devices failed: ids"`, or the error's own message for a set
|
|
22
|
+
* of one member. `null` where every member took every step.
|
|
23
|
+
*/
|
|
24
|
+
get verdict(): string | null
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** What one verb of `Devices.apply()` answered. */
|
|
28
|
+
export declare class AppliedStep {
|
|
29
|
+
/** The verb, in snake case: `color_temp`. */
|
|
30
|
+
get step(): string
|
|
31
|
+
/** One per member that the step reached, in member order. */
|
|
32
|
+
get outcomes(): Array<Outcome>
|
|
33
|
+
}
|
|
34
|
+
|
|
12
35
|
/** Every device the build knows. Reads no hardware. */
|
|
13
36
|
export declare class Catalog {
|
|
14
37
|
/** The catalog compiled into this build. */
|
|
@@ -23,6 +46,24 @@ export declare class Catalog {
|
|
|
23
46
|
* Throws with the code `unknown_sku` when nothing declares it.
|
|
24
47
|
*/
|
|
25
48
|
device(sku: string): any
|
|
49
|
+
/**
|
|
50
|
+
* The record that `govee describe --json` prints for a SKU. Throws
|
|
51
|
+
* `unknown_sku` when nothing declares it.
|
|
52
|
+
*/
|
|
53
|
+
describe(sku: string): any
|
|
54
|
+
/**
|
|
55
|
+
* The DMX channel tables of a SKU, as `dist/catalog.json` carries them.
|
|
56
|
+
* Throws `unknown_sku` when nothing declares it.
|
|
57
|
+
*/
|
|
58
|
+
dmx(sku: string): any
|
|
59
|
+
/** Every capability name that a device of the catalog declares, sorted. */
|
|
60
|
+
capabilities(): Array<string>
|
|
61
|
+
/**
|
|
62
|
+
* Every SKU, verified aliases included, that matches every filter given.
|
|
63
|
+
* `capability` reads the capabilities of `mode`, else of the hardware.
|
|
64
|
+
* `support` needs `mode`. An unknown key is refused.
|
|
65
|
+
*/
|
|
66
|
+
query(filter?: { mode?: string | undefined; capability?: string | undefined; support?: string | undefined }): Array<string>
|
|
26
67
|
/** How many device files the build carries. */
|
|
27
68
|
get size(): number
|
|
28
69
|
toString(): string
|
|
@@ -75,6 +116,8 @@ export declare class Device {
|
|
|
75
116
|
* heard from it.
|
|
76
117
|
*/
|
|
77
118
|
get health(): Record<string, Health>
|
|
119
|
+
/** The record that every surface prints. */
|
|
120
|
+
toJSON(): { id: string; sku: string; name: string | null; modes: Array<{ mode: string; health: { state: string; failures: number; available: boolean } | null }> }
|
|
78
121
|
toString(): string
|
|
79
122
|
}
|
|
80
123
|
|
|
@@ -83,8 +126,17 @@ export declare class Device {
|
|
|
83
126
|
* from the SDK it was made by.
|
|
84
127
|
*/
|
|
85
128
|
export declare class DeviceHandle {
|
|
129
|
+
/**
|
|
130
|
+
* Read a command whose entry declares an answer, and send any other one.
|
|
131
|
+
* With `refuseSecrets`, a command that takes a secret throws `secret_arg`.
|
|
132
|
+
*
|
|
133
|
+
* @param [refuseSecrets=false]
|
|
134
|
+
*/
|
|
135
|
+
invoke(command: string, args?: Record<string, boolean | number | string | Uint8Array | Array<number> | Array<[number, number, number]>>, refuseSecrets?: boolean | undefined | null): Promise<Invoked>
|
|
86
136
|
/** The MAC the device reports, uppercased. */
|
|
87
137
|
get id(): string
|
|
138
|
+
/** The one mode that every call goes over, or `null`. */
|
|
139
|
+
get pinned(): string | null
|
|
88
140
|
/** The modes enabled for it, in preference order. */
|
|
89
141
|
get modes(): Array<string>
|
|
90
142
|
/**
|
|
@@ -116,7 +168,7 @@ export declare class DeviceHandle {
|
|
|
116
168
|
* Scan for the device if no mode knows it yet, then answer the mode a
|
|
117
169
|
* command would go over.
|
|
118
170
|
*
|
|
119
|
-
*
|
|
171
|
+
* Call it once before the first command: a command never scans.
|
|
120
172
|
*/
|
|
121
173
|
ensureKnown(): Promise<string>
|
|
122
174
|
/**
|
|
@@ -143,6 +195,9 @@ export declare class DeviceHandle {
|
|
|
143
195
|
*
|
|
144
196
|
* Answers `"accepted"` where the device acknowledged the transfer, and
|
|
145
197
|
* `"sent"` where its device file declares no acknowledgement.
|
|
198
|
+
*
|
|
199
|
+
* @param [utcOffsetHours=0]
|
|
200
|
+
* @param [utcOffsetMinutes=0]
|
|
146
201
|
*/
|
|
147
202
|
provisionWifi(network: string, password: string, utcOffsetHours?: number | undefined | null, utcOffsetMinutes?: number | undefined | null): Promise<string>
|
|
148
203
|
/**
|
|
@@ -152,8 +207,9 @@ export declare class DeviceHandle {
|
|
|
152
207
|
* channel holds the colors only while it is armed, and the device goes
|
|
153
208
|
* back to the color it showed before once the stream closes.
|
|
154
209
|
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
210
|
+
* @param [resolution='app']
|
|
211
|
+
* @param [rate='measured']
|
|
212
|
+
* @param [gradient=false]
|
|
157
213
|
*/
|
|
158
214
|
openStream(resolution?: number | 'app' | 'native' | 'groups', rate?: number | 'measured', gradient?: boolean | undefined | null): Promise<SegmentStream>
|
|
159
215
|
toString(): string
|
|
@@ -170,11 +226,13 @@ export declare class DeviceHandle {
|
|
|
170
226
|
* Power the device on and paint one color, so a person sees which
|
|
171
227
|
* fixture this identity drives.
|
|
172
228
|
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
229
|
+
* One pass: the device stays on and lit, and loses the look it held.
|
|
230
|
+
* `Govee.identify()` runs the whole walk.
|
|
231
|
+
*
|
|
232
|
+
* `fullBrightness` sets the top of the declared brightness range.
|
|
175
233
|
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
234
|
+
* @param [color=[0, 255, 0]]
|
|
235
|
+
* @param [fullBrightness=true]
|
|
178
236
|
*/
|
|
179
237
|
identify(color?: [number, number, number] | Uint8Array, fullBrightness?: boolean | undefined | null): Promise<undefined>
|
|
180
238
|
/** Set the white temperature, in kelvin. It ends color mode. */
|
|
@@ -186,7 +244,8 @@ export declare class DeviceHandle {
|
|
|
186
244
|
* the device renders. `color` imposes a color, and `null` leaves the
|
|
187
245
|
* colors to the firmware.
|
|
188
246
|
*
|
|
189
|
-
*
|
|
247
|
+
* @param [sensitivity=50]
|
|
248
|
+
* @param [soft=false]
|
|
190
249
|
*/
|
|
191
250
|
music(effect: number, sensitivity?: number | undefined | null, soft?: boolean | undefined | null, color?: [number, number, number] | Uint8Array): Promise<Served>
|
|
192
251
|
/**
|
|
@@ -194,7 +253,9 @@ export declare class DeviceHandle {
|
|
|
194
253
|
*
|
|
195
254
|
* One color fills every zone. An array of colors, or a `Uint8Array` of
|
|
196
255
|
* three bytes per zone, states them all. A zone list takes one color.
|
|
197
|
-
*
|
|
256
|
+
*
|
|
257
|
+
* @param [resolution='app']
|
|
258
|
+
* @param [gradient=false]
|
|
198
259
|
*/
|
|
199
260
|
segment(colors: [number, number, number] | Array<[number, number, number]> | Uint8Array, zones?: Array<number> | undefined | null, resolution?: number | 'app' | 'native' | 'groups', gradient?: boolean | undefined | null): Promise<Served>
|
|
200
261
|
/**
|
|
@@ -204,6 +265,57 @@ export declare class DeviceHandle {
|
|
|
204
265
|
gradient(on: boolean): Promise<Served>
|
|
205
266
|
}
|
|
206
267
|
|
|
268
|
+
/**
|
|
269
|
+
* The devices that `Govee.devices()` selects. A verb runs on every member at
|
|
270
|
+
* once, answers one `Outcome` per member, and rejects for nothing a member
|
|
271
|
+
* does.
|
|
272
|
+
*/
|
|
273
|
+
export declare class Devices {
|
|
274
|
+
/**
|
|
275
|
+
* Scan for the members, then send the verbs, power on first and power
|
|
276
|
+
* off last. A member that fails takes no later step.
|
|
277
|
+
*/
|
|
278
|
+
apply(verbs: { power?: boolean, brightness?: number, color?: [number, number, number] | Uint8Array, colorTemp?: number, segment?: { colors: [number, number, number] | Array<[number, number, number]> | Uint8Array, zones?: Array<number>, resolution?: number | 'app' | 'native' | 'groups', gradient?: boolean }, music?: { effect: number, sensitivity?: number, soft?: boolean, color?: [number, number, number] | Uint8Array }, gradient?: boolean }): Promise<Applied>
|
|
279
|
+
/**
|
|
280
|
+
* One handle per member, in outcome order, with the mode that
|
|
281
|
+
* `Govee.devices()` pins.
|
|
282
|
+
*/
|
|
283
|
+
get members(): Array<DeviceHandle>
|
|
284
|
+
get length(): number
|
|
285
|
+
/**
|
|
286
|
+
* What the SDK holds for each member. Reads no hardware. A member that no
|
|
287
|
+
* transport knows and that the configuration gives no SKU is left out.
|
|
288
|
+
*/
|
|
289
|
+
list(): Array<Device>
|
|
290
|
+
/** Scan for every member that no mode knows. */
|
|
291
|
+
ensureKnown(): Promise<Array<Outcome>>
|
|
292
|
+
/** Turn every member on or off. */
|
|
293
|
+
power(on: boolean): Promise<Array<Outcome>>
|
|
294
|
+
/** Set the level on every member, against its own range. */
|
|
295
|
+
brightness(level: number): Promise<Array<Outcome>>
|
|
296
|
+
/** Set one color on every member. */
|
|
297
|
+
color(rgb: [number, number, number] | Uint8Array): Promise<Array<Outcome>>
|
|
298
|
+
/** Set the white temperature on every member, in kelvin. */
|
|
299
|
+
colorTemp(kelvin: number): Promise<Array<Outcome>>
|
|
300
|
+
/**
|
|
301
|
+
* `DeviceHandle.music()` on every member.
|
|
302
|
+
*
|
|
303
|
+
* @param [sensitivity=50]
|
|
304
|
+
* @param [soft=false]
|
|
305
|
+
*/
|
|
306
|
+
music(effect: number, sensitivity?: number | undefined | null, soft?: boolean | undefined | null, color?: [number, number, number] | Uint8Array): Promise<Array<Outcome>>
|
|
307
|
+
/**
|
|
308
|
+
* `DeviceHandle.segment()` on every member, against its own zones.
|
|
309
|
+
*
|
|
310
|
+
* @param [resolution='app']
|
|
311
|
+
* @param [gradient=false]
|
|
312
|
+
*/
|
|
313
|
+
segment(colors: [number, number, number] | Array<[number, number, number]> | Uint8Array, zones?: Array<number> | undefined | null, resolution?: number | 'app' | 'native' | 'groups', gradient?: boolean | undefined | null): Promise<Array<Outcome>>
|
|
314
|
+
/** Set the interpolation between zones on every member. */
|
|
315
|
+
gradient(on: boolean): Promise<Array<Outcome>>
|
|
316
|
+
toString(): string
|
|
317
|
+
}
|
|
318
|
+
|
|
207
319
|
/** What a device reported about itself. No firmware fills every field. */
|
|
208
320
|
export declare class DeviceStatus {
|
|
209
321
|
/** Which device answered. */
|
|
@@ -223,6 +335,8 @@ export declare class DeviceStatus {
|
|
|
223
335
|
get raw(): any
|
|
224
336
|
/** Whether the device is in white mode. Mutually exclusive with color. */
|
|
225
337
|
get isWhite(): boolean
|
|
338
|
+
/** The record that every surface prints, with `color` as `"#RRGGBB"`. */
|
|
339
|
+
toJSON(): { id: string; on: boolean | null; brightness: number | null; color: string | null; color_temp_kelvin: number | null; raw: unknown }
|
|
226
340
|
toString(): string
|
|
227
341
|
}
|
|
228
342
|
|
|
@@ -246,42 +360,16 @@ export declare class EventStream {
|
|
|
246
360
|
export declare class Govee {
|
|
247
361
|
/**
|
|
248
362
|
* Start the SDK. Without a configuration, it reads the file. Without a
|
|
249
|
-
* catalog, it reads the one the package carries
|
|
363
|
+
* catalog, it reads the one the package carries, with the local device
|
|
364
|
+
* files over it where the configuration opts in.
|
|
250
365
|
*/
|
|
251
366
|
static start(config?: Config | undefined | null, catalog?: Catalog | undefined | null): Promise<Govee>
|
|
252
367
|
/**
|
|
253
|
-
* Run a discovery scan
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
* and not their sum. Nothing on the send path calls this.
|
|
257
|
-
*/
|
|
258
|
-
scan(): Promise<Array<Device>>
|
|
259
|
-
/**
|
|
260
|
-
* Run a discovery scan on the modes named.
|
|
261
|
-
*
|
|
262
|
-
* A mode this build carries no transport for contributes nothing and is
|
|
263
|
-
* not an error.
|
|
264
|
-
*/
|
|
265
|
-
scanOn(modes: Array<string>): Promise<Array<Device>>
|
|
266
|
-
/**
|
|
267
|
-
* Every device known, across every mode. One reachable over two modes
|
|
268
|
-
* appears once.
|
|
269
|
-
*/
|
|
270
|
-
devices(): Array<Device>
|
|
271
|
-
/**
|
|
272
|
-
* The devices the targets name, in the order they were written.
|
|
273
|
-
*
|
|
274
|
-
* A target is an identity (`1C:8B:…`), a SKU (`H6159`), a name the
|
|
275
|
-
* configuration gives a device (`name:kitchen`), or a group it gives
|
|
276
|
-
* (`group:ambient`). `id:`, `sku:`, `name:` and `group:` state the kind
|
|
277
|
-
* where the target alone does not. A SKU, a name and a group select
|
|
278
|
-
* among the devices the SDK knows, so scan first.
|
|
279
|
-
*
|
|
280
|
-
* `mode` is the one mode the caller will drive. A SKU, a name and a group
|
|
281
|
-
* then match among the devices that enable it. An identity selects itself
|
|
282
|
-
* either way.
|
|
368
|
+
* Run a discovery scan and return what answered. Without `modes`, it
|
|
369
|
+
* scans every mode. The modes scan at the same time. A mode that this
|
|
370
|
+
* build carries no transport for adds nothing and is not an error.
|
|
283
371
|
*/
|
|
284
|
-
|
|
372
|
+
scan(modes?: Array<string> | undefined | null): Promise<Array<Device>>
|
|
285
373
|
/**
|
|
286
374
|
* The modes this build carries a transport for. Not a preference order:
|
|
287
375
|
* that is each device's own configuration.
|
|
@@ -294,35 +382,41 @@ export declare class Govee {
|
|
|
294
382
|
/** The device catalog in force. */
|
|
295
383
|
get catalog(): Catalog
|
|
296
384
|
/**
|
|
297
|
-
* A handle for one device, by its identity or by
|
|
298
|
-
*
|
|
385
|
+
* A handle for one device, by its identity or by its configured name.
|
|
386
|
+
* `id:` and `name:` state the kind. It scans nothing. A SKU or a group
|
|
387
|
+
* throws `target_not_understood`: use `devices()` for them.
|
|
299
388
|
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
389
|
+
* `mode` pins every call on the handle to that mode. Without it, each
|
|
390
|
+
* call goes over the first enabled mode that answers.
|
|
302
391
|
*/
|
|
303
|
-
device(target: string): DeviceHandle
|
|
392
|
+
device(target: string, options?: { mode?: string }): DeviceHandle
|
|
304
393
|
/**
|
|
305
|
-
*
|
|
394
|
+
* The devices that the targets name, each once, in the order written. A
|
|
395
|
+
* target is an identity, a SKU, a configured name or a group: `id:`,
|
|
396
|
+
* `sku:`, `name:` and `group:` state the kind. `null` selects every device
|
|
397
|
+
* that a scan finds. A SKU or `null` runs one scan on the first call, and
|
|
398
|
+
* `scan()` counts as that scan.
|
|
306
399
|
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
* `target` reads as it does for `device()`.
|
|
313
|
-
*/
|
|
314
|
-
deviceOn(target: string, mode: string): DeviceHandle
|
|
315
|
-
/**
|
|
316
|
-
* The identities that one target names, from the configuration and with
|
|
317
|
-
* no scan: one device, or every member of a group in identity order.
|
|
400
|
+
* `enables` keeps the devices that enable that mode, and rejects with
|
|
401
|
+
* `no_such_target` where a SKU, a name or a group keeps none. `mode` pins
|
|
402
|
+
* every member as for `device()`: a member that does not enable it fails
|
|
403
|
+
* alone, in its outcome.
|
|
318
404
|
*/
|
|
319
|
-
targets
|
|
405
|
+
devices(targets?: Array<string> | null, options?: { enables?: string; mode?: string }): Promise<Devices>
|
|
320
406
|
/**
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
407
|
+
* Run the walk `govee identify` runs. `targets` reads as for `devices()`.
|
|
408
|
+
* `wait` and `hold` are in seconds. An unknown option is refused.
|
|
409
|
+
*
|
|
410
|
+
* Rejects with `mode_not_enabled` before it sends a command where a
|
|
411
|
+
* device does not enable the mode. A device that fails is in the report.
|
|
412
|
+
*
|
|
413
|
+
* @param [options.color=[0, 255, 0]]
|
|
414
|
+
* @param [options.wait=1]
|
|
415
|
+
* @param [options.hold=5]
|
|
416
|
+
* @param [options.keep=false]
|
|
417
|
+
* @param [options.mode='lan']
|
|
324
418
|
*/
|
|
325
|
-
|
|
419
|
+
identify(targets?: string | Array<string> | null, options?: { color?: [number, number, number] | Uint8Array; wait?: number; hold?: number; keep?: boolean; mode?: string }): Promise<WalkReport>
|
|
326
420
|
/** Subscribe to what the SDK reports. Iterate it with `for await`. */
|
|
327
421
|
events(): EventStream
|
|
328
422
|
/**
|
|
@@ -333,29 +427,6 @@ export declare class Govee {
|
|
|
333
427
|
toString(): string
|
|
334
428
|
}
|
|
335
429
|
|
|
336
|
-
/** A handle on the members of a group. It holds no state of its own. */
|
|
337
|
-
export declare class GroupHandle {
|
|
338
|
-
/** The identities of the members, in the order of every outcome list. */
|
|
339
|
-
get members(): Array<string>
|
|
340
|
-
/** Scan for every member that no mode knows. Each outcome carries its mode. */
|
|
341
|
-
ensureKnown(): Promise<Array<Outcome>>
|
|
342
|
-
/** Turn every member on or off. */
|
|
343
|
-
power(on: boolean): Promise<Array<Outcome>>
|
|
344
|
-
/** Set the level on every member, against its own range. */
|
|
345
|
-
brightness(level: number): Promise<Array<Outcome>>
|
|
346
|
-
/** Set one color on every member. */
|
|
347
|
-
color(rgb: [number, number, number] | Uint8Array): Promise<Array<Outcome>>
|
|
348
|
-
/** Set the white temperature on every member, in kelvin. */
|
|
349
|
-
colorTemp(kelvin: number): Promise<Array<Outcome>>
|
|
350
|
-
/** `DeviceHandle.music()` on every member. */
|
|
351
|
-
music(effect: number, sensitivity?: number | undefined | null, soft?: boolean | undefined | null, color?: [number, number, number] | Uint8Array): Promise<Array<Outcome>>
|
|
352
|
-
/** `DeviceHandle.segment()` on every member, against its own zones. */
|
|
353
|
-
segment(colors: [number, number, number] | Array<[number, number, number]> | Uint8Array, zones?: Array<number> | undefined | null, resolution?: number | 'app' | 'native' | 'groups', gradient?: boolean | undefined | null): Promise<Array<Outcome>>
|
|
354
|
-
/** Set the interpolation between zones on every member. */
|
|
355
|
-
gradient(on: boolean): Promise<Array<Outcome>>
|
|
356
|
-
toString(): string
|
|
357
|
-
}
|
|
358
|
-
|
|
359
430
|
/** A device's health in one mode. */
|
|
360
431
|
export declare class Health {
|
|
361
432
|
/** `"ok"`, `"degraded"` or `"down"`. */
|
|
@@ -364,9 +435,26 @@ export declare class Health {
|
|
|
364
435
|
get failures(): number
|
|
365
436
|
/** Whether a command would be sent right now. */
|
|
366
437
|
get available(): boolean
|
|
438
|
+
/** The record that every surface prints. */
|
|
439
|
+
toJSON(): { state: string; failures: number; available: boolean }
|
|
367
440
|
toString(): string
|
|
368
441
|
}
|
|
369
442
|
|
|
443
|
+
/** What `DeviceHandle.invoke()` did with a command. */
|
|
444
|
+
export declare class Invoked {
|
|
445
|
+
/** The device. */
|
|
446
|
+
get id(): string
|
|
447
|
+
/** The mode that served the command. */
|
|
448
|
+
get mode(): string
|
|
449
|
+
/** The command, as the device file names it. */
|
|
450
|
+
get command(): string
|
|
451
|
+
/**
|
|
452
|
+
* What the `reply:` layouts captured, or `null` for a command that was
|
|
453
|
+
* sent.
|
|
454
|
+
*/
|
|
455
|
+
get fields(): any | null
|
|
456
|
+
}
|
|
457
|
+
|
|
370
458
|
/** What one member answered. */
|
|
371
459
|
export declare class Outcome {
|
|
372
460
|
/** The member. */
|
|
@@ -377,8 +465,10 @@ export declare class Outcome {
|
|
|
377
465
|
get mode(): string | null
|
|
378
466
|
/** The command served. `null` on a failure and for `ensureKnown()`. */
|
|
379
467
|
get served(): Served | null
|
|
380
|
-
/** What the call on
|
|
468
|
+
/** What the call on this member throws. `null` where it succeeded. */
|
|
381
469
|
get error(): Error | null
|
|
470
|
+
/** The record that every surface prints. */
|
|
471
|
+
toJSON(): { id: string; ok: boolean; mode: string | null; command: string | null; error: { code: string; message: string } | null }
|
|
382
472
|
toString(): string
|
|
383
473
|
}
|
|
384
474
|
|
|
@@ -398,8 +488,9 @@ export declare class Reply {
|
|
|
398
488
|
* An open segment channel. The writers never block: each one replaces what
|
|
399
489
|
* the next frame carries.
|
|
400
490
|
*
|
|
401
|
-
* Close it, or leave it with `await using`.
|
|
402
|
-
*
|
|
491
|
+
* Close it, or leave it with `await using`. Garbage collection also disarms
|
|
492
|
+
* the channel, and reports no failure. A write after `close()` throws
|
|
493
|
+
* `stream_closed`.
|
|
403
494
|
*/
|
|
404
495
|
export declare class SegmentStream {
|
|
405
496
|
/**
|
|
@@ -452,6 +543,8 @@ export declare class Served {
|
|
|
452
543
|
get command(): string
|
|
453
544
|
/** The name the wire carries, where it carries one. */
|
|
454
545
|
get cmd(): string
|
|
546
|
+
/** The record that every surface prints. */
|
|
547
|
+
toJSON(): { id: string; mode: string; command: string }
|
|
455
548
|
toString(): string
|
|
456
549
|
}
|
|
457
550
|
|
|
@@ -469,6 +562,19 @@ export declare class StatusStream {
|
|
|
469
562
|
next(): Promise<DeviceStatus | undefined | null>
|
|
470
563
|
}
|
|
471
564
|
|
|
565
|
+
/** What one identify walk covered, and what it failed at. */
|
|
566
|
+
export declare class WalkReport {
|
|
567
|
+
/** The devices the walk covered, in the order it lit them. */
|
|
568
|
+
get lit(): Array<string>
|
|
569
|
+
/** The devices that refused the opening blackout or the pass. */
|
|
570
|
+
get failed(): Array<string>
|
|
571
|
+
/** The devices that refused the closing blackout, and hold the color. */
|
|
572
|
+
get stayed(): Array<string>
|
|
573
|
+
/** Whether every device took every step. */
|
|
574
|
+
get ok(): boolean
|
|
575
|
+
toString(): string
|
|
576
|
+
}
|
|
577
|
+
|
|
472
578
|
/** The version of the core this binding was built from. */
|
|
473
579
|
export declare const CORE_VERSION: string
|
|
474
580
|
|
|
@@ -478,5 +584,11 @@ export declare const CORE_VERSION: string
|
|
|
478
584
|
*/
|
|
479
585
|
export declare function modes(): Array<string>
|
|
480
586
|
|
|
587
|
+
/** Every DMX personality the bridge knows. */
|
|
588
|
+
export declare function personalities(): Array<string>
|
|
589
|
+
|
|
590
|
+
/** Every support level a device file gives a mode. */
|
|
591
|
+
export declare function supportLevels(): Array<string>
|
|
592
|
+
|
|
481
593
|
/** The version of this binding. */
|
|
482
594
|
export declare const VERSION: string
|
package/dist/index.d.ts
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* `govee-toolkit` core. What is added here is what an addon cannot declare:
|
|
6
6
|
* the asynchronous iterators, and the disposer a segment stream closes on.
|
|
7
7
|
*/
|
|
8
|
-
import { Catalog, Config, CORE_VERSION, Device, DeviceHandle, DeviceStatus, EventStream, Govee,
|
|
9
|
-
export { Catalog, Config, CORE_VERSION, Device, DeviceHandle, DeviceStatus, EventStream, Govee,
|
|
8
|
+
import { Applied, AppliedStep, Catalog, Config, CORE_VERSION, Device, DeviceHandle, Devices, DeviceStatus, EventStream, Govee, Health, Invoked, Outcome, Reply, SegmentStream, Served, StatusStream, VERSION, WalkReport } from "../binding.cjs";
|
|
9
|
+
export { Applied, AppliedStep, Catalog, Config, CORE_VERSION, Device, DeviceHandle, Devices, DeviceStatus, EventStream, Govee, Health, Invoked, Outcome, Reply, SegmentStream, Served, StatusStream, VERSION, WalkReport, };
|
|
10
10
|
/** One RGB triple, each channel 0-255. */
|
|
11
11
|
export type Color = [number, number, number];
|
|
12
12
|
/** A value a device file's command takes as an argument. */
|
|
13
13
|
export type Arg = boolean | number | string | Uint8Array | number[] | Color[];
|
|
14
14
|
/** A segment count, or the name of one the device file declares. */
|
|
15
|
-
export type Resolution = number | "app" | "native";
|
|
15
|
+
export type Resolution = number | "app" | "native" | "groups";
|
|
16
16
|
/** Frames per second, or the name of a rate the device file declares. */
|
|
17
17
|
export type Rate = number | "measured";
|
|
18
18
|
/**
|
|
@@ -25,6 +25,10 @@ export type GoveeEvent = {
|
|
|
25
25
|
};
|
|
26
26
|
/** Every mode name the core knows, in the order the core lists them. */
|
|
27
27
|
export declare const MODES: readonly string[];
|
|
28
|
+
/** Every support level a device file gives a mode, in the order the core lists them. */
|
|
29
|
+
export declare const SUPPORT: readonly string[];
|
|
30
|
+
/** Every DMX personality the bridge knows, in the order the core lists them. */
|
|
31
|
+
export declare const PERSONALITIES: readonly string[];
|
|
28
32
|
declare module "../binding.cjs" {
|
|
29
33
|
interface EventStream {
|
|
30
34
|
[Symbol.asyncIterator](): AsyncIterableIterator<GoveeEvent>;
|
package/dist/index.js
CHANGED
|
@@ -5,10 +5,14 @@
|
|
|
5
5
|
* `govee-toolkit` core. What is added here is what an addon cannot declare:
|
|
6
6
|
* the asynchronous iterators, and the disposer a segment stream closes on.
|
|
7
7
|
*/
|
|
8
|
-
import { Catalog, Config, CORE_VERSION, Device, DeviceHandle, DeviceStatus, EventStream, Govee,
|
|
9
|
-
export { Catalog, Config, CORE_VERSION, Device, DeviceHandle, DeviceStatus, EventStream, Govee,
|
|
8
|
+
import { Applied, AppliedStep, Catalog, Config, CORE_VERSION, Device, DeviceHandle, Devices, DeviceStatus, EventStream, Govee, Health, Invoked, modes, Outcome, personalities, Reply, SegmentStream, Served, StatusStream, supportLevels, VERSION, WalkReport, } from "../binding.cjs";
|
|
9
|
+
export { Applied, AppliedStep, Catalog, Config, CORE_VERSION, Device, DeviceHandle, Devices, DeviceStatus, EventStream, Govee, Health, Invoked, Outcome, Reply, SegmentStream, Served, StatusStream, VERSION, WalkReport, };
|
|
10
10
|
/** Every mode name the core knows, in the order the core lists them. */
|
|
11
11
|
export const MODES = Object.freeze(modes());
|
|
12
|
+
/** Every support level a device file gives a mode, in the order the core lists them. */
|
|
13
|
+
export const SUPPORT = Object.freeze(supportLevels());
|
|
14
|
+
/** Every DMX personality the bridge knows, in the order the core lists them. */
|
|
15
|
+
export const PERSONALITIES = Object.freeze(personalities());
|
|
12
16
|
/**
|
|
13
17
|
* `Symbol.asyncDispose` reached Node after the floor this package supports,
|
|
14
18
|
* so the well-known symbol is taken where the runtime declares it and made
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "govee-toolkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Control Govee devices from your own network: undocumented LAN features, with BLE and Cloud modes when you need them.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "damient",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"typescript": "^7.0.2"
|
|
53
53
|
},
|
|
54
54
|
"optionalDependencies": {
|
|
55
|
-
"govee-toolkit-linux-x64-gnu": "0.
|
|
56
|
-
"govee-toolkit-linux-arm64-gnu": "0.
|
|
57
|
-
"govee-toolkit-darwin-arm64": "0.
|
|
58
|
-
"govee-toolkit-win32-x64-msvc": "0.
|
|
59
|
-
"govee-toolkit-win32-arm64-msvc": "0.
|
|
55
|
+
"govee-toolkit-linux-x64-gnu": "0.6.0",
|
|
56
|
+
"govee-toolkit-linux-arm64-gnu": "0.6.0",
|
|
57
|
+
"govee-toolkit-darwin-arm64": "0.6.0",
|
|
58
|
+
"govee-toolkit-win32-x64-msvc": "0.6.0",
|
|
59
|
+
"govee-toolkit-win32-arm64-msvc": "0.6.0"
|
|
60
60
|
}
|
|
61
61
|
}
|