@busy-app/busy-lib 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.
- package/LICENSE +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +813 -252
- package/dist/index.js +311 -131
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var o = (e, t, i) =>
|
|
4
|
-
import
|
|
5
|
-
const
|
|
1
|
+
var T = Object.defineProperty;
|
|
2
|
+
var P = (e, t, i) => t in e ? T(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
|
|
3
|
+
var o = (e, t, i) => P(e, typeof t != "symbol" ? t + "" : t, i);
|
|
4
|
+
import v from "openapi-fetch";
|
|
5
|
+
const b = (e, t) => {
|
|
6
6
|
if (typeof FormData < "u" && e instanceof FormData || typeof Buffer < "u" && typeof Buffer.isBuffer == "function" && Buffer.isBuffer(e) || typeof File < "u" && e instanceof File || typeof Blob < "u" && e instanceof Blob || typeof ArrayBuffer < "u" && e instanceof ArrayBuffer || typeof ArrayBuffer < "u" && ArrayBuffer.isView && ArrayBuffer.isView(e))
|
|
7
7
|
return e;
|
|
8
8
|
let i;
|
|
@@ -39,7 +39,7 @@ function I(e) {
|
|
|
39
39
|
m = e;
|
|
40
40
|
}
|
|
41
41
|
let d;
|
|
42
|
-
const
|
|
42
|
+
const B = {
|
|
43
43
|
async onRequest({ request: e, schemaPath: t }) {
|
|
44
44
|
return d && e.headers.set("Authorization", `Bearer ${d}`), t !== "/version" && (await A(), w && e.headers.set("X-API-Sem-Ver", w), m && e.headers.set("X-API-Token", m)), e;
|
|
45
45
|
},
|
|
@@ -58,13 +58,37 @@ const L = {
|
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
let r = null;
|
|
61
|
-
function
|
|
62
|
-
y = t, d = i ?? void 0, r =
|
|
61
|
+
function z(e, t, i) {
|
|
62
|
+
y = t, d = i ?? void 0, r = v({
|
|
63
63
|
baseUrl: e,
|
|
64
|
-
bodySerializer:
|
|
65
|
-
}), r.use(
|
|
64
|
+
bodySerializer: b
|
|
65
|
+
}), r.use(B);
|
|
66
66
|
}
|
|
67
|
-
async function
|
|
67
|
+
async function L() {
|
|
68
|
+
if (!r)
|
|
69
|
+
throw new Error("API client is not initialized");
|
|
70
|
+
const { data: e, error: t } = await r.GET("/account");
|
|
71
|
+
if (t)
|
|
72
|
+
throw t;
|
|
73
|
+
return e;
|
|
74
|
+
}
|
|
75
|
+
async function D() {
|
|
76
|
+
if (!r)
|
|
77
|
+
throw new Error("API client is not initialized");
|
|
78
|
+
const { data: e, error: t } = await r.DELETE("/account");
|
|
79
|
+
if (t)
|
|
80
|
+
throw t;
|
|
81
|
+
return e;
|
|
82
|
+
}
|
|
83
|
+
async function O() {
|
|
84
|
+
if (!r)
|
|
85
|
+
throw new Error("API client is not initialized");
|
|
86
|
+
const { data: e, error: t } = await r.POST("/account/link");
|
|
87
|
+
if (t)
|
|
88
|
+
throw t;
|
|
89
|
+
return e;
|
|
90
|
+
}
|
|
91
|
+
async function W(e) {
|
|
68
92
|
const { appId: t, fileName: i, file: n } = e;
|
|
69
93
|
if (!r)
|
|
70
94
|
throw new Error("API client is not initialized");
|
|
@@ -84,7 +108,7 @@ async function z(e) {
|
|
|
84
108
|
throw a;
|
|
85
109
|
return s;
|
|
86
110
|
}
|
|
87
|
-
async function
|
|
111
|
+
async function C(e) {
|
|
88
112
|
const { appId: t } = e;
|
|
89
113
|
if (!r)
|
|
90
114
|
throw new Error("API client is not initialized");
|
|
@@ -99,25 +123,20 @@ async function D(e) {
|
|
|
99
123
|
throw n;
|
|
100
124
|
return i;
|
|
101
125
|
}
|
|
102
|
-
|
|
103
|
-
function U(e) {
|
|
104
|
-
return { ...O, ...e };
|
|
105
|
-
}
|
|
106
|
-
async function C(e) {
|
|
107
|
-
const { appId: t, elements: i } = e;
|
|
126
|
+
async function R(e) {
|
|
108
127
|
if (!r)
|
|
109
128
|
throw new Error("API client is not initialized");
|
|
110
|
-
const
|
|
129
|
+
const { appId: t, elements: i } = e, { data: n, error: s } = await r.POST("/display/draw", {
|
|
111
130
|
body: {
|
|
112
131
|
app_id: t,
|
|
113
|
-
elements:
|
|
132
|
+
elements: i
|
|
114
133
|
}
|
|
115
134
|
});
|
|
116
|
-
if (
|
|
117
|
-
throw
|
|
118
|
-
return
|
|
135
|
+
if (s)
|
|
136
|
+
throw s;
|
|
137
|
+
return n;
|
|
119
138
|
}
|
|
120
|
-
async function
|
|
139
|
+
async function U() {
|
|
121
140
|
if (!r)
|
|
122
141
|
throw new Error("API client is not initialized");
|
|
123
142
|
const { data: e, error: t } = await r.DELETE("/display/draw");
|
|
@@ -125,7 +144,7 @@ async function K() {
|
|
|
125
144
|
throw t;
|
|
126
145
|
return e;
|
|
127
146
|
}
|
|
128
|
-
async function
|
|
147
|
+
async function K(e) {
|
|
129
148
|
const { appId: t, path: i } = e;
|
|
130
149
|
if (!r)
|
|
131
150
|
throw new Error("API client is not initialized");
|
|
@@ -141,31 +160,15 @@ async function R(e) {
|
|
|
141
160
|
throw s;
|
|
142
161
|
return n;
|
|
143
162
|
}
|
|
144
|
-
async function W() {
|
|
145
|
-
if (!r)
|
|
146
|
-
throw new Error("API client is not initialized");
|
|
147
|
-
const { data: e, error: t } = await r.DELETE("/audio/play");
|
|
148
|
-
if (t)
|
|
149
|
-
throw t;
|
|
150
|
-
return e;
|
|
151
|
-
}
|
|
152
163
|
async function $() {
|
|
153
164
|
if (!r)
|
|
154
165
|
throw new Error("API client is not initialized");
|
|
155
|
-
const { data: e, error: t } = await r.
|
|
166
|
+
const { data: e, error: t } = await r.DELETE("/audio/play");
|
|
156
167
|
if (t)
|
|
157
168
|
throw t;
|
|
158
169
|
return e;
|
|
159
170
|
}
|
|
160
171
|
async function _() {
|
|
161
|
-
if (!r)
|
|
162
|
-
throw new Error("API client is not initialized");
|
|
163
|
-
const { data: e, error: t } = await r.POST("/wifi/disable");
|
|
164
|
-
if (t)
|
|
165
|
-
throw t;
|
|
166
|
-
return e;
|
|
167
|
-
}
|
|
168
|
-
async function F() {
|
|
169
172
|
if (!r)
|
|
170
173
|
throw new Error("API client is not initialized");
|
|
171
174
|
const { data: e, error: t } = await r.GET("/wifi/status");
|
|
@@ -173,7 +176,7 @@ async function F() {
|
|
|
173
176
|
throw t;
|
|
174
177
|
return e;
|
|
175
178
|
}
|
|
176
|
-
async function
|
|
179
|
+
async function F(e) {
|
|
177
180
|
if (!r)
|
|
178
181
|
throw new Error("API client is not initialized");
|
|
179
182
|
const { data: t, error: i } = await r.POST("/wifi/connect", {
|
|
@@ -183,7 +186,6 @@ async function V(e) {
|
|
|
183
186
|
security: e.security,
|
|
184
187
|
ip_config: {
|
|
185
188
|
ip_method: e.ipConfig.ipMethod,
|
|
186
|
-
ip_type: e.ipConfig.ipType,
|
|
187
189
|
address: e.ipConfig.address,
|
|
188
190
|
mask: e.ipConfig.mask,
|
|
189
191
|
gateway: e.ipConfig.gateway
|
|
@@ -194,18 +196,10 @@ async function V(e) {
|
|
|
194
196
|
throw i;
|
|
195
197
|
return t;
|
|
196
198
|
}
|
|
197
|
-
async function x() {
|
|
198
|
-
if (!r)
|
|
199
|
-
throw new Error("API client is not initialized");
|
|
200
|
-
const { data: e, error: t } = await r.POST("/wifi/disconnect");
|
|
201
|
-
if (t)
|
|
202
|
-
throw t;
|
|
203
|
-
return e;
|
|
204
|
-
}
|
|
205
199
|
async function G() {
|
|
206
200
|
if (!r)
|
|
207
201
|
throw new Error("API client is not initialized");
|
|
208
|
-
const { data: e, error: t } = await r.
|
|
202
|
+
const { data: e, error: t } = await r.POST("/wifi/disconnect");
|
|
209
203
|
if (t)
|
|
210
204
|
throw t;
|
|
211
205
|
return e;
|
|
@@ -213,12 +207,12 @@ async function G() {
|
|
|
213
207
|
async function N() {
|
|
214
208
|
if (!r)
|
|
215
209
|
throw new Error("API client is not initialized");
|
|
216
|
-
const { data: e, error: t } = await r.
|
|
210
|
+
const { data: e, error: t } = await r.GET("/wifi/networks");
|
|
217
211
|
if (t)
|
|
218
212
|
throw t;
|
|
219
213
|
return e;
|
|
220
214
|
}
|
|
221
|
-
async function
|
|
215
|
+
async function V(e) {
|
|
222
216
|
if (!r)
|
|
223
217
|
throw new Error("API client is not initialized");
|
|
224
218
|
const { path: t, file: i } = e, { data: n, error: s } = await r.POST("/storage/write", {
|
|
@@ -236,7 +230,7 @@ async function q(e) {
|
|
|
236
230
|
throw s;
|
|
237
231
|
return n;
|
|
238
232
|
}
|
|
239
|
-
async function
|
|
233
|
+
async function q(e) {
|
|
240
234
|
if (!r)
|
|
241
235
|
throw new Error("API client is not initialized");
|
|
242
236
|
const { path: t, asArrayBuffer: i } = e, { data: n, error: s } = await r.GET("/storage/read", {
|
|
@@ -251,7 +245,7 @@ async function j(e) {
|
|
|
251
245
|
throw s;
|
|
252
246
|
return n;
|
|
253
247
|
}
|
|
254
|
-
async function
|
|
248
|
+
async function x(e) {
|
|
255
249
|
if (!r)
|
|
256
250
|
throw new Error("API client is not initialized");
|
|
257
251
|
const { path: t } = e, { data: i, error: n } = await r.GET("/storage/list", {
|
|
@@ -265,7 +259,7 @@ async function H(e) {
|
|
|
265
259
|
throw n;
|
|
266
260
|
return i;
|
|
267
261
|
}
|
|
268
|
-
async function
|
|
262
|
+
async function j(e) {
|
|
269
263
|
if (!r)
|
|
270
264
|
throw new Error("API client is not initialized");
|
|
271
265
|
const { path: t } = e, { data: i, error: n } = await r.DELETE("/storage/remove", {
|
|
@@ -279,7 +273,7 @@ async function J(e) {
|
|
|
279
273
|
throw n;
|
|
280
274
|
return i;
|
|
281
275
|
}
|
|
282
|
-
async function
|
|
276
|
+
async function H(e) {
|
|
283
277
|
if (!r)
|
|
284
278
|
throw new Error("API client is not initialized");
|
|
285
279
|
const { path: t } = e, { data: i, error: n } = await r.POST("/storage/mkdir", {
|
|
@@ -293,7 +287,15 @@ async function X(e) {
|
|
|
293
287
|
throw n;
|
|
294
288
|
return i;
|
|
295
289
|
}
|
|
296
|
-
async function
|
|
290
|
+
async function J() {
|
|
291
|
+
if (!r)
|
|
292
|
+
throw new Error("API client is not initialized");
|
|
293
|
+
const { data: e, error: t } = await r.GET("/storage/status");
|
|
294
|
+
if (t)
|
|
295
|
+
throw t;
|
|
296
|
+
return e;
|
|
297
|
+
}
|
|
298
|
+
async function X() {
|
|
297
299
|
if (!r)
|
|
298
300
|
throw new Error("API client is not initialized");
|
|
299
301
|
const { data: e, error: t } = await r.GET("/version");
|
|
@@ -301,7 +303,7 @@ async function Q() {
|
|
|
301
303
|
throw t;
|
|
302
304
|
return e;
|
|
303
305
|
}
|
|
304
|
-
async function
|
|
306
|
+
async function M(e) {
|
|
305
307
|
if (!r)
|
|
306
308
|
throw new Error("API client is not initialized");
|
|
307
309
|
const { name: t, file: i } = e, { data: n, error: s } = await r.POST("/update", {
|
|
@@ -319,7 +321,7 @@ async function Y(e) {
|
|
|
319
321
|
throw s;
|
|
320
322
|
return n;
|
|
321
323
|
}
|
|
322
|
-
async function
|
|
324
|
+
async function Q() {
|
|
323
325
|
if (!r)
|
|
324
326
|
throw new Error("API client is not initialized");
|
|
325
327
|
const { data: e, error: t } = await r.GET("/status");
|
|
@@ -327,7 +329,7 @@ async function M() {
|
|
|
327
329
|
throw t;
|
|
328
330
|
return e;
|
|
329
331
|
}
|
|
330
|
-
async function
|
|
332
|
+
async function Y() {
|
|
331
333
|
if (!r)
|
|
332
334
|
throw new Error("API client is not initialized");
|
|
333
335
|
const { data: e, error: t } = await r.GET("/status/system");
|
|
@@ -335,7 +337,7 @@ async function Z() {
|
|
|
335
337
|
throw t;
|
|
336
338
|
return e;
|
|
337
339
|
}
|
|
338
|
-
async function
|
|
340
|
+
async function Z() {
|
|
339
341
|
if (!r)
|
|
340
342
|
throw new Error("API client is not initialized");
|
|
341
343
|
const { data: e, error: t } = await r.GET("/status/power");
|
|
@@ -343,15 +345,47 @@ async function tt() {
|
|
|
343
345
|
throw t;
|
|
344
346
|
return e;
|
|
345
347
|
}
|
|
346
|
-
async function
|
|
348
|
+
async function tt() {
|
|
347
349
|
if (!r)
|
|
348
350
|
throw new Error("API client is not initialized");
|
|
349
|
-
const { data: e, error: t } = await r.GET("/
|
|
351
|
+
const { data: e, error: t } = await r.GET("/time");
|
|
350
352
|
if (t)
|
|
351
353
|
throw t;
|
|
352
354
|
return e;
|
|
353
355
|
}
|
|
356
|
+
async function et(e) {
|
|
357
|
+
if (!r)
|
|
358
|
+
throw new Error("API client is not initialized");
|
|
359
|
+
const { data: t, error: i } = await r.POST("/time/timestamp", {
|
|
360
|
+
params: {
|
|
361
|
+
query: e
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
if (i)
|
|
365
|
+
throw i;
|
|
366
|
+
return t;
|
|
367
|
+
}
|
|
354
368
|
async function it(e) {
|
|
369
|
+
if (!r)
|
|
370
|
+
throw new Error("API client is not initialized");
|
|
371
|
+
const { data: t, error: i } = await r.POST("/time/timezone", {
|
|
372
|
+
params: {
|
|
373
|
+
query: e
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
if (i)
|
|
377
|
+
throw i;
|
|
378
|
+
return t;
|
|
379
|
+
}
|
|
380
|
+
async function rt() {
|
|
381
|
+
if (!r)
|
|
382
|
+
throw new Error("API client is not initialized");
|
|
383
|
+
const { data: e, error: t } = await r.GET("/display/brightness");
|
|
384
|
+
if (t)
|
|
385
|
+
throw t;
|
|
386
|
+
return e;
|
|
387
|
+
}
|
|
388
|
+
async function nt(e) {
|
|
355
389
|
if (!r)
|
|
356
390
|
throw new Error("API client is not initialized");
|
|
357
391
|
const { front: t, back: i } = e, n = (u) => {
|
|
@@ -374,7 +408,7 @@ async function it(e) {
|
|
|
374
408
|
throw f;
|
|
375
409
|
return c;
|
|
376
410
|
}
|
|
377
|
-
async function
|
|
411
|
+
async function st() {
|
|
378
412
|
if (!r)
|
|
379
413
|
throw new Error("API client is not initialized");
|
|
380
414
|
const { data: e, error: t } = await r.GET("/audio/volume");
|
|
@@ -382,7 +416,7 @@ async function rt() {
|
|
|
382
416
|
throw t;
|
|
383
417
|
return e;
|
|
384
418
|
}
|
|
385
|
-
async function
|
|
419
|
+
async function ot(e) {
|
|
386
420
|
if (!r)
|
|
387
421
|
throw new Error("API client is not initialized");
|
|
388
422
|
const { volume: t } = e;
|
|
@@ -399,7 +433,7 @@ async function nt(e) {
|
|
|
399
433
|
throw n;
|
|
400
434
|
return i;
|
|
401
435
|
}
|
|
402
|
-
async function
|
|
436
|
+
async function at() {
|
|
403
437
|
if (!r)
|
|
404
438
|
throw new Error("API client is not initialized");
|
|
405
439
|
const { data: e, error: t } = await r.GET("/access");
|
|
@@ -407,7 +441,7 @@ async function st() {
|
|
|
407
441
|
throw t;
|
|
408
442
|
return e;
|
|
409
443
|
}
|
|
410
|
-
async function
|
|
444
|
+
async function ct(e) {
|
|
411
445
|
if (!r)
|
|
412
446
|
throw new Error("API client is not initialized");
|
|
413
447
|
const { mode: t, key: i } = e;
|
|
@@ -425,7 +459,25 @@ async function ot(e) {
|
|
|
425
459
|
throw s;
|
|
426
460
|
return n;
|
|
427
461
|
}
|
|
428
|
-
async function
|
|
462
|
+
async function ft() {
|
|
463
|
+
if (!r)
|
|
464
|
+
throw new Error("API client is not initialized");
|
|
465
|
+
const { data: e, error: t } = await r.GET("/name");
|
|
466
|
+
if (t)
|
|
467
|
+
throw t;
|
|
468
|
+
return e;
|
|
469
|
+
}
|
|
470
|
+
async function ut(e) {
|
|
471
|
+
if (!r)
|
|
472
|
+
throw new Error("API client is not initialized");
|
|
473
|
+
const { data: t, error: i } = await r.POST("/name", {
|
|
474
|
+
body: e
|
|
475
|
+
});
|
|
476
|
+
if (i)
|
|
477
|
+
throw i;
|
|
478
|
+
return t;
|
|
479
|
+
}
|
|
480
|
+
async function wt() {
|
|
429
481
|
if (!r)
|
|
430
482
|
throw new Error("API client is not initialized");
|
|
431
483
|
const { data: e, error: t } = await r.POST("/ble/enable");
|
|
@@ -433,7 +485,7 @@ async function at() {
|
|
|
433
485
|
throw t;
|
|
434
486
|
return e;
|
|
435
487
|
}
|
|
436
|
-
async function
|
|
488
|
+
async function dt() {
|
|
437
489
|
if (!r)
|
|
438
490
|
throw new Error("API client is not initialized");
|
|
439
491
|
const { data: e, error: t } = await r.POST("/ble/disable");
|
|
@@ -441,7 +493,23 @@ async function ct() {
|
|
|
441
493
|
throw t;
|
|
442
494
|
return e;
|
|
443
495
|
}
|
|
444
|
-
async function
|
|
496
|
+
async function ht() {
|
|
497
|
+
if (!r)
|
|
498
|
+
throw new Error("API client is not initialized");
|
|
499
|
+
const { data: e, error: t } = await r.DELETE("/ble/pairing");
|
|
500
|
+
if (t)
|
|
501
|
+
throw t;
|
|
502
|
+
return e;
|
|
503
|
+
}
|
|
504
|
+
async function lt() {
|
|
505
|
+
if (!r)
|
|
506
|
+
throw new Error("API client is not initialized");
|
|
507
|
+
const { data: e, error: t } = await r.GET("/ble/status");
|
|
508
|
+
if (t)
|
|
509
|
+
throw t;
|
|
510
|
+
return e;
|
|
511
|
+
}
|
|
512
|
+
async function pt(e) {
|
|
445
513
|
if (!r)
|
|
446
514
|
throw new Error("API client is not initialized");
|
|
447
515
|
const { keyName: t } = e, { data: i, error: n } = await r.POST("/input", {
|
|
@@ -455,8 +523,8 @@ async function ft(e) {
|
|
|
455
523
|
throw n;
|
|
456
524
|
return i;
|
|
457
525
|
}
|
|
458
|
-
const
|
|
459
|
-
class
|
|
526
|
+
const yt = "http://10.0.4.20", mt = "https://proxy.busy.app", Et = /^https?:\/\/proxy(?:\.(?:dev|test|stage))?\.busy\.app$/i;
|
|
527
|
+
class Tt {
|
|
460
528
|
/**
|
|
461
529
|
* Creates an instance of BUSY Bar.
|
|
462
530
|
* Initializes the API client with the provided host address.
|
|
@@ -492,16 +560,16 @@ class mt {
|
|
|
492
560
|
*/
|
|
493
561
|
o(this, "apiSemver");
|
|
494
562
|
if (!t || !t.addr && !t.token)
|
|
495
|
-
this.addr =
|
|
563
|
+
this.addr = yt;
|
|
496
564
|
else if (!t.addr)
|
|
497
|
-
this.addr =
|
|
565
|
+
this.addr = mt;
|
|
498
566
|
else {
|
|
499
567
|
let i = t.addr.trim();
|
|
500
|
-
if (/^https?:\/\//i.test(i) || (i = `http://${i}`),
|
|
568
|
+
if (/^https?:\/\//i.test(i) || (i = `http://${i}`), Et.test(i) && !t.token)
|
|
501
569
|
throw new Error("Token is required. Please provide it.");
|
|
502
570
|
this.addr = i;
|
|
503
571
|
}
|
|
504
|
-
this.apiSemver = "",
|
|
572
|
+
this.apiSemver = "", z(
|
|
505
573
|
`${this.addr}/api/`,
|
|
506
574
|
this.getApiVersion.bind(this),
|
|
507
575
|
t == null ? void 0 : t.token
|
|
@@ -513,7 +581,7 @@ class mt {
|
|
|
513
581
|
* @returns {Promise<VersionInfo>} A promise that resolves to an object containing the `api_semver` string.
|
|
514
582
|
*/
|
|
515
583
|
async getApiVersion() {
|
|
516
|
-
const t = await
|
|
584
|
+
const t = await X();
|
|
517
585
|
return this.apiSemver = t.api_semver, t;
|
|
518
586
|
}
|
|
519
587
|
/**
|
|
@@ -525,7 +593,7 @@ class mt {
|
|
|
525
593
|
* @returns {Promise<SuccessResponse>} Result of the update operation.
|
|
526
594
|
*/
|
|
527
595
|
async updateFirmware(t) {
|
|
528
|
-
return await
|
|
596
|
+
return await M(t);
|
|
529
597
|
}
|
|
530
598
|
/**
|
|
531
599
|
* Gets the current status of the device, including system and power information.
|
|
@@ -533,7 +601,7 @@ class mt {
|
|
|
533
601
|
* @returns {Promise<Status>} Current status of the device.
|
|
534
602
|
*/
|
|
535
603
|
async deviceStatus() {
|
|
536
|
-
return await
|
|
604
|
+
return await Q();
|
|
537
605
|
}
|
|
538
606
|
/**
|
|
539
607
|
* Gets the current system status.
|
|
@@ -541,7 +609,7 @@ class mt {
|
|
|
541
609
|
* @returns {Promise<StatusSystem>} Current system status.
|
|
542
610
|
*/
|
|
543
611
|
async systemStatus() {
|
|
544
|
-
return await
|
|
612
|
+
return await Y();
|
|
545
613
|
}
|
|
546
614
|
/**
|
|
547
615
|
* Gets the current power status.
|
|
@@ -549,8 +617,60 @@ class mt {
|
|
|
549
617
|
* @returns {Promise<StatusPower>} Current power status.
|
|
550
618
|
*/
|
|
551
619
|
async powerStatus() {
|
|
620
|
+
return await Z();
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Gets current device timestamp with timezone.
|
|
624
|
+
*
|
|
625
|
+
* @returns {Promise<TimestampInfo>} Current device timestamp as an ISO 8601 string.
|
|
626
|
+
*/
|
|
627
|
+
async getTime() {
|
|
552
628
|
return await tt();
|
|
553
629
|
}
|
|
630
|
+
/**
|
|
631
|
+
* Sets the current device timestamp.
|
|
632
|
+
*
|
|
633
|
+
* @param {SetTimestampParams} params - The parameters for setting the timestamp.
|
|
634
|
+
* @param {SetTimestampParams['timestamp']} params.timestamp - The new timestamp (ISO 8601 string).
|
|
635
|
+
* @returns {Promise<SuccessResponse>} A success response if the timestamp was set.
|
|
636
|
+
*/
|
|
637
|
+
async setTimestamp(t) {
|
|
638
|
+
return await et(t);
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Sets the device timezone.
|
|
642
|
+
*
|
|
643
|
+
* @param {SetTimezoneParams} params - The parameters for setting the timezone.
|
|
644
|
+
* @param {SetTimezoneParams['timezone']} params.timezone - The new timezone identifier (IANA TZ string).
|
|
645
|
+
* @returns {Promise<SuccessResponse>} A success response if the timezone was set.
|
|
646
|
+
*/
|
|
647
|
+
async setTimezone(t) {
|
|
648
|
+
return await it(t);
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Gets the status of the MQTT account linked to the device.
|
|
652
|
+
*
|
|
653
|
+
* @returns {Promise<AccountInfo>} Information about the current MQTT account status.
|
|
654
|
+
*/
|
|
655
|
+
async getMqttStatus() {
|
|
656
|
+
return await L();
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Unlinks the current account from the device.
|
|
660
|
+
*
|
|
661
|
+
* @returns {Promise<SuccessResponse>} Result of the account unlink operation.
|
|
662
|
+
*/
|
|
663
|
+
async unlinkAccount() {
|
|
664
|
+
return await D();
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Links an account to the device.
|
|
668
|
+
*
|
|
669
|
+
* @returns {Promise<AccountLink>} Information about the account link operation.
|
|
670
|
+
*/
|
|
671
|
+
async linkAccount() {
|
|
672
|
+
return await O();
|
|
673
|
+
}
|
|
554
674
|
/**
|
|
555
675
|
* Uploads an asset to the device.
|
|
556
676
|
*
|
|
@@ -561,7 +681,7 @@ class mt {
|
|
|
561
681
|
* @returns {Promise<SuccessResponse>} Result of the upload operation.
|
|
562
682
|
*/
|
|
563
683
|
async uploadAsset(t) {
|
|
564
|
-
return await
|
|
684
|
+
return await W(t);
|
|
565
685
|
}
|
|
566
686
|
/**
|
|
567
687
|
* Deletes all assets for a specific application from the device.
|
|
@@ -571,7 +691,7 @@ class mt {
|
|
|
571
691
|
* @returns {Promise<SuccessResponse>} Result of the delete operation.
|
|
572
692
|
*/
|
|
573
693
|
async deleteAssets(t) {
|
|
574
|
-
return await
|
|
694
|
+
return await C(t);
|
|
575
695
|
}
|
|
576
696
|
/**
|
|
577
697
|
* Draws elements on the device display.
|
|
@@ -582,7 +702,7 @@ class mt {
|
|
|
582
702
|
* @returns {Promise<SuccessResponse>} Result of the draw operation.
|
|
583
703
|
*/
|
|
584
704
|
async drawDisplay(t) {
|
|
585
|
-
return await
|
|
705
|
+
return await R(t);
|
|
586
706
|
}
|
|
587
707
|
/**
|
|
588
708
|
* Clears the device display and stops the Canvas application if running.
|
|
@@ -590,7 +710,7 @@ class mt {
|
|
|
590
710
|
* @returns {Promise<SuccessResponse>} Result of the clear operation.
|
|
591
711
|
*/
|
|
592
712
|
async clearDisplay() {
|
|
593
|
-
return await
|
|
713
|
+
return await U();
|
|
594
714
|
}
|
|
595
715
|
/**
|
|
596
716
|
* Plays an audio file from the assets directory.
|
|
@@ -601,7 +721,7 @@ class mt {
|
|
|
601
721
|
* @returns {Promise<SuccessResponse>} Result of the play operation.
|
|
602
722
|
*/
|
|
603
723
|
async playSound(t) {
|
|
604
|
-
return await
|
|
724
|
+
return await K(t);
|
|
605
725
|
}
|
|
606
726
|
/**
|
|
607
727
|
* Stops any currently playing audio on the device.
|
|
@@ -609,23 +729,35 @@ class mt {
|
|
|
609
729
|
* @returns {Promise<SuccessResponse>} Result of the stop operation.
|
|
610
730
|
*/
|
|
611
731
|
async stopSound() {
|
|
612
|
-
return await
|
|
732
|
+
return await $();
|
|
613
733
|
}
|
|
614
734
|
/**
|
|
615
|
-
*
|
|
735
|
+
* @deprecated since 0.5.0 — will be removed in 0.7.0.
|
|
616
736
|
*
|
|
617
|
-
*
|
|
737
|
+
* This method is no longer supported and does nothing.
|
|
738
|
+
*
|
|
739
|
+
* Works only with BusyLib v0.5.0 and device firmware v0.3.0.
|
|
740
|
+
*
|
|
741
|
+
* Always throws an error.
|
|
618
742
|
*/
|
|
619
743
|
async enableWifi() {
|
|
620
|
-
|
|
744
|
+
throw new Error(
|
|
745
|
+
"[DEPRECATED] BusyBar.enableWifi: This method is deprecated since v0.5.0 and will be removed in v0.7.0. It is no longer supported and does nothing. Works only with BusyLib v0.5.0 and device firmware v0.3.0."
|
|
746
|
+
);
|
|
621
747
|
}
|
|
622
748
|
/**
|
|
623
|
-
*
|
|
749
|
+
* @deprecated since 0.5.0 — will be removed in 0.7.0.
|
|
624
750
|
*
|
|
625
|
-
*
|
|
751
|
+
* This method is no longer supported and does nothing.
|
|
752
|
+
*
|
|
753
|
+
* Works only with BusyLib v0.5.0 and device firmware v0.3.0.
|
|
754
|
+
*
|
|
755
|
+
* Always throws an error.
|
|
626
756
|
*/
|
|
627
757
|
async disableWifi() {
|
|
628
|
-
|
|
758
|
+
throw new Error(
|
|
759
|
+
"[DEPRECATED] BusyBar.disableWifi: This method is deprecated since v0.5.0 and will be removed in v0.7.0. It is no longer supported and does nothing. Works only with BusyLib v0.5.0 and device firmware v0.3.0."
|
|
760
|
+
);
|
|
629
761
|
}
|
|
630
762
|
/**
|
|
631
763
|
* Gets the current status of the Wi-Fi module.
|
|
@@ -633,7 +765,7 @@ class mt {
|
|
|
633
765
|
* @returns {Promise<WifiStatusResponse>} Current Wi-Fi status.
|
|
634
766
|
*/
|
|
635
767
|
async statusWifi() {
|
|
636
|
-
return await
|
|
768
|
+
return await _();
|
|
637
769
|
}
|
|
638
770
|
/**
|
|
639
771
|
* Connects the device to a Wi-Fi network with the specified parameters.
|
|
@@ -651,7 +783,7 @@ class mt {
|
|
|
651
783
|
* @returns {Promise<SuccessResponse>} Result of the connect operation.
|
|
652
784
|
*/
|
|
653
785
|
async connectWifi(t) {
|
|
654
|
-
return await
|
|
786
|
+
return await F(t);
|
|
655
787
|
}
|
|
656
788
|
/**
|
|
657
789
|
* Disconnects the device from the current Wi-Fi network.
|
|
@@ -659,7 +791,7 @@ class mt {
|
|
|
659
791
|
* @returns {Promise<SuccessResponse>} Result of the disconnect operation.
|
|
660
792
|
*/
|
|
661
793
|
async disconnectWifi() {
|
|
662
|
-
return await
|
|
794
|
+
return await G();
|
|
663
795
|
}
|
|
664
796
|
/**
|
|
665
797
|
* Scans for available Wi-Fi networks near your device.
|
|
@@ -667,15 +799,21 @@ class mt {
|
|
|
667
799
|
* @returns {Promise<WifiNetworkResponse>} List of discovered networks.
|
|
668
800
|
*/
|
|
669
801
|
async networksWifi() {
|
|
670
|
-
return await
|
|
802
|
+
return await N();
|
|
671
803
|
}
|
|
672
804
|
/**
|
|
673
|
-
*
|
|
805
|
+
* @deprecated since 0.5.0 — will be removed in 0.7.0.
|
|
806
|
+
*
|
|
807
|
+
* This method is no longer supported and does nothing.
|
|
674
808
|
*
|
|
675
|
-
*
|
|
809
|
+
* Works only with BusyLib v0.5.0 and device firmware v0.3.0.
|
|
810
|
+
*
|
|
811
|
+
* Always throws an error.
|
|
676
812
|
*/
|
|
677
813
|
async forgetWifi() {
|
|
678
|
-
|
|
814
|
+
throw new Error(
|
|
815
|
+
"[DEPRECATED] BusyBar.forgetWifi: This method is deprecated since v0.5.0 and will be removed in v0.7.0. It is no longer supported and does nothing. Works only with BusyLib v0.5.0 and device firmware v0.3.0."
|
|
816
|
+
);
|
|
679
817
|
}
|
|
680
818
|
/**
|
|
681
819
|
* Uploads a file to the device's internal storage.
|
|
@@ -686,7 +824,7 @@ class mt {
|
|
|
686
824
|
* @returns {Promise<SuccessResponse>} Result of the upload operation.
|
|
687
825
|
*/
|
|
688
826
|
async uploadFile(t) {
|
|
689
|
-
return await
|
|
827
|
+
return await V(t);
|
|
690
828
|
}
|
|
691
829
|
/**
|
|
692
830
|
* Downloads a file from the device's internal storage.
|
|
@@ -697,7 +835,7 @@ class mt {
|
|
|
697
835
|
* @returns {Promise<StorageReadResponse>} The file data.
|
|
698
836
|
*/
|
|
699
837
|
async downloadFile(t) {
|
|
700
|
-
return await
|
|
838
|
+
return await q(t);
|
|
701
839
|
}
|
|
702
840
|
/**
|
|
703
841
|
* Reads the contents of a directory (files and subdirectories) at the specified path.
|
|
@@ -707,7 +845,7 @@ class mt {
|
|
|
707
845
|
* @returns {Promise<StorageList>} List of files and directories.
|
|
708
846
|
*/
|
|
709
847
|
async readDirectory(t) {
|
|
710
|
-
return await
|
|
848
|
+
return await x(t);
|
|
711
849
|
}
|
|
712
850
|
/**
|
|
713
851
|
* Removes a file or a directory from the device's internal storage.
|
|
@@ -717,7 +855,7 @@ class mt {
|
|
|
717
855
|
* @returns {Promise<SuccessResponse>} Result of the remove operation.
|
|
718
856
|
*/
|
|
719
857
|
async removeResource(t) {
|
|
720
|
-
return await
|
|
858
|
+
return await j(t);
|
|
721
859
|
}
|
|
722
860
|
/**
|
|
723
861
|
* Creates a new directory in the device's internal storage.
|
|
@@ -727,7 +865,15 @@ class mt {
|
|
|
727
865
|
* @returns {Promise<SuccessResponse>} Result of the create operation.
|
|
728
866
|
*/
|
|
729
867
|
async createDirectory(t) {
|
|
730
|
-
return await
|
|
868
|
+
return await H(t);
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* Gets the current status of the device's internal storage.
|
|
872
|
+
*
|
|
873
|
+
* @returns {Promise<StorageStatus>} Current storage status information.
|
|
874
|
+
*/
|
|
875
|
+
async statusStorage() {
|
|
876
|
+
return await J();
|
|
731
877
|
}
|
|
732
878
|
/**
|
|
733
879
|
* Gets the current display brightness settings for the device.
|
|
@@ -735,7 +881,7 @@ class mt {
|
|
|
735
881
|
* @returns {Promise<DisplayBrightnessInfo>} Current brightness information for front and back panels.
|
|
736
882
|
*/
|
|
737
883
|
async getDisplayBrightness() {
|
|
738
|
-
return await
|
|
884
|
+
return await rt();
|
|
739
885
|
}
|
|
740
886
|
/**
|
|
741
887
|
* Sets the display brightness for the device.
|
|
@@ -747,7 +893,7 @@ class mt {
|
|
|
747
893
|
* @throws {Error} If brightness value is outside the range 0-100 or not "auto".
|
|
748
894
|
*/
|
|
749
895
|
async setDisplayBrightness(t) {
|
|
750
|
-
return await
|
|
896
|
+
return await nt(t);
|
|
751
897
|
}
|
|
752
898
|
/**
|
|
753
899
|
* Gets the current audio volume value.
|
|
@@ -755,7 +901,7 @@ class mt {
|
|
|
755
901
|
* @returns {Promise<AudioVolumeInfo>} Current audio volume (0-100).
|
|
756
902
|
*/
|
|
757
903
|
async getAudioVolume() {
|
|
758
|
-
return await
|
|
904
|
+
return await st();
|
|
759
905
|
}
|
|
760
906
|
/**
|
|
761
907
|
* Sets the audio volume value.
|
|
@@ -766,7 +912,7 @@ class mt {
|
|
|
766
912
|
* @throws {Error} If volume is outside the range 0-100 or request fails.
|
|
767
913
|
*/
|
|
768
914
|
async setAudioVolume(t) {
|
|
769
|
-
return await
|
|
915
|
+
return await ot(t);
|
|
770
916
|
}
|
|
771
917
|
/**
|
|
772
918
|
* Gets the current HTTP API access configuration.
|
|
@@ -774,7 +920,7 @@ class mt {
|
|
|
774
920
|
* @returns {Promise<HttpAccessInfo>} Current HTTP access info.
|
|
775
921
|
*/
|
|
776
922
|
async getHttpAccess() {
|
|
777
|
-
return await
|
|
923
|
+
return await at();
|
|
778
924
|
}
|
|
779
925
|
/**
|
|
780
926
|
* Sets the HTTP API access configuration.
|
|
@@ -785,9 +931,27 @@ class mt {
|
|
|
785
931
|
* @returns {Promise<SuccessResponse>} Result of the set operation.
|
|
786
932
|
*/
|
|
787
933
|
async setHttpAccess(t) {
|
|
788
|
-
const i = await
|
|
934
|
+
const i = await ct(t);
|
|
789
935
|
return t.mode === "key" && t.key && this.setApiKey(t.key), i;
|
|
790
936
|
}
|
|
937
|
+
/**
|
|
938
|
+
* Gets the current device name.
|
|
939
|
+
*
|
|
940
|
+
* @returns {Promise<NameInfo>} The current device name information.
|
|
941
|
+
*/
|
|
942
|
+
async getName() {
|
|
943
|
+
return await ft();
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Sets the device name.
|
|
947
|
+
*
|
|
948
|
+
* @param {NameParams} params - The parameters for setting the device name.
|
|
949
|
+
* @param {NameParams['name']} params.name - The new device name.
|
|
950
|
+
* @returns {Promise<SuccessResponse>} Result of setting the device name.
|
|
951
|
+
*/
|
|
952
|
+
async setName(t) {
|
|
953
|
+
return await ut(t);
|
|
954
|
+
}
|
|
791
955
|
/**
|
|
792
956
|
* Sets API key for all subsequent requests.
|
|
793
957
|
* @param {string} key - API key to use in "X-API-Token" header.
|
|
@@ -800,14 +964,30 @@ class mt {
|
|
|
800
964
|
* @returns {Promise<SuccessResponse>} Result of the enable operation.
|
|
801
965
|
*/
|
|
802
966
|
async enableBle() {
|
|
803
|
-
return await
|
|
967
|
+
return await wt();
|
|
804
968
|
}
|
|
805
969
|
/**
|
|
806
970
|
* Disables BLE module.
|
|
807
971
|
* @returns {Promise<SuccessResponse>} Result of the disable operation.
|
|
808
972
|
*/
|
|
809
973
|
async disableBle() {
|
|
810
|
-
return await
|
|
974
|
+
return await dt();
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* Removes all BLE pairings from the device.
|
|
978
|
+
*
|
|
979
|
+
* @returns {Promise<SuccessResponse>} Result of the BLE pairing removal operation.
|
|
980
|
+
*/
|
|
981
|
+
async pairingBle() {
|
|
982
|
+
return await ht();
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* Gets the current BLE module status.
|
|
986
|
+
*
|
|
987
|
+
* @returns {Promise<BleStatusResponse>} Current BLE status information.
|
|
988
|
+
*/
|
|
989
|
+
async statusBle() {
|
|
990
|
+
return await lt();
|
|
811
991
|
}
|
|
812
992
|
/**
|
|
813
993
|
* Sends a button press.
|
|
@@ -821,12 +1001,12 @@ class mt {
|
|
|
821
1001
|
* @returns {Promise<SuccessResponse>} Result of pressing the button.
|
|
822
1002
|
*/
|
|
823
1003
|
async pressButton(t) {
|
|
824
|
-
return await
|
|
1004
|
+
return await pt(t);
|
|
825
1005
|
}
|
|
826
1006
|
}
|
|
827
1007
|
var E = /* @__PURE__ */ ((e) => (e[e.FRONT = 0] = "FRONT", e[e.BACK = 1] = "BACK", e))(E || {});
|
|
828
|
-
const
|
|
829
|
-
function
|
|
1008
|
+
const g = 3e3, k = /* @__PURE__ */ new Set([1001, 1006, 1012, 1013, 1014, 3008]);
|
|
1009
|
+
function S(e, t) {
|
|
830
1010
|
if (t < 0 || t >= e.length)
|
|
831
1011
|
throw new Error(`Index ${t} is out of bounds (0…${e.length - 1})`);
|
|
832
1012
|
const i = e[t];
|
|
@@ -834,11 +1014,11 @@ function g(e, t) {
|
|
|
834
1014
|
throw new Error(`Unexpected undefined at index ${t}`);
|
|
835
1015
|
return i;
|
|
836
1016
|
}
|
|
837
|
-
function
|
|
1017
|
+
function At(e, t) {
|
|
838
1018
|
let i = 0;
|
|
839
1019
|
const n = e.length, s = [];
|
|
840
1020
|
for (; i < n; ) {
|
|
841
|
-
const a =
|
|
1021
|
+
const a = S(e, i);
|
|
842
1022
|
if (i += 1, (a & 128) !== 0) {
|
|
843
1023
|
const c = a & 127;
|
|
844
1024
|
for (let f = 0; f < c * t; f++)
|
|
@@ -854,16 +1034,16 @@ function ht(e, t) {
|
|
|
854
1034
|
}
|
|
855
1035
|
return new Uint8Array(s);
|
|
856
1036
|
}
|
|
857
|
-
function
|
|
1037
|
+
function gt(e) {
|
|
858
1038
|
const t = new Uint8Array(e.length * 2);
|
|
859
1039
|
let i = 0, n = 0;
|
|
860
1040
|
for (; i < e.length; ) {
|
|
861
|
-
const s =
|
|
1041
|
+
const s = S(e, i), a = s & 15, c = s >> 4 & 15;
|
|
862
1042
|
t[n] = a, t[n + 1] = c, i += 1, n += 2;
|
|
863
1043
|
}
|
|
864
1044
|
return t;
|
|
865
1045
|
}
|
|
866
|
-
class
|
|
1046
|
+
class Pt {
|
|
867
1047
|
constructor(t) {
|
|
868
1048
|
o(this, "connected", !1);
|
|
869
1049
|
// @ts-ignore
|
|
@@ -922,8 +1102,8 @@ class Et {
|
|
|
922
1102
|
let s;
|
|
923
1103
|
const a = this.config.deviceScreen === E.FRONT ? 3 : 2;
|
|
924
1104
|
try {
|
|
925
|
-
const c =
|
|
926
|
-
this.config.deviceScreen === E.BACK ? s =
|
|
1105
|
+
const c = At(n, a);
|
|
1106
|
+
this.config.deviceScreen === E.BACK ? s = gt(c) : s = c, this.emitData(s);
|
|
927
1107
|
} catch {
|
|
928
1108
|
this.emitData(n);
|
|
929
1109
|
}
|
|
@@ -939,7 +1119,7 @@ class Et {
|
|
|
939
1119
|
raw: i
|
|
940
1120
|
}), this.emitStop();
|
|
941
1121
|
}, this.socket.onclose = async (i) => {
|
|
942
|
-
if (this.socket = null, this.connected = !1, i.code ===
|
|
1122
|
+
if (this.socket = null, this.connected = !1, i.code === g || k.has(i.code)) {
|
|
943
1123
|
this.emitError({
|
|
944
1124
|
code: i.code,
|
|
945
1125
|
message: i.reason,
|
|
@@ -958,7 +1138,7 @@ class Et {
|
|
|
958
1138
|
});
|
|
959
1139
|
}
|
|
960
1140
|
}
|
|
961
|
-
class
|
|
1141
|
+
class vt {
|
|
962
1142
|
constructor(t) {
|
|
963
1143
|
o(this, "connected", !1);
|
|
964
1144
|
// @ts-ignore
|
|
@@ -1019,7 +1199,7 @@ class At {
|
|
|
1019
1199
|
raw: i
|
|
1020
1200
|
}), this.emitStop();
|
|
1021
1201
|
}, this.socket.onclose = async (i) => {
|
|
1022
|
-
if (this.socket = null, this.connected = !1, i.code ===
|
|
1202
|
+
if (this.socket = null, this.connected = !1, i.code === g || k.has(i.code)) {
|
|
1023
1203
|
this.emitError({
|
|
1024
1204
|
code: i.code,
|
|
1025
1205
|
message: i.reason,
|
|
@@ -1044,8 +1224,8 @@ class At {
|
|
|
1044
1224
|
}
|
|
1045
1225
|
}
|
|
1046
1226
|
export {
|
|
1047
|
-
|
|
1227
|
+
Tt as BusyBar,
|
|
1048
1228
|
E as DeviceScreen,
|
|
1049
|
-
|
|
1050
|
-
|
|
1229
|
+
vt as Input,
|
|
1230
|
+
Pt as ScreenStream
|
|
1051
1231
|
};
|