@signageos/front-applet 8.0.3 → 8.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/bundle.js +5 -5
  2. package/dist/bundle.js.map +1 -1
  3. package/docs/fpath/index.md +12 -250
  4. package/docs/sos/fileSystem.md +15 -0
  5. package/docs/sos_management/power.md +105 -0
  6. package/docs/sos_management/screen.md +35 -2
  7. package/docs/sos_management/wifi.md +82 -18
  8. package/es6/FrontApplet/DeviceInfo/IDeviceInfo.d.ts +1 -0
  9. package/es6/FrontApplet/FileSystem/FileSystem.d.ts +9 -0
  10. package/es6/FrontApplet/FileSystem/FileSystem.js +13 -0
  11. package/es6/FrontApplet/FileSystem/FileSystem.js.map +1 -1
  12. package/es6/FrontApplet/FileSystem/IFileSystem.d.ts +1 -0
  13. package/es6/FrontApplet/Management/Power/IPower.d.ts +35 -0
  14. package/es6/FrontApplet/Management/Power/IPower.js +25 -0
  15. package/es6/FrontApplet/Management/Power/IPower.js.map +1 -1
  16. package/es6/FrontApplet/Management/Power/Power.d.ts +56 -2
  17. package/es6/FrontApplet/Management/Power/Power.js +100 -0
  18. package/es6/FrontApplet/Management/Power/Power.js.map +1 -1
  19. package/es6/FrontApplet/Management/Power/PowerHelper.d.ts +3 -0
  20. package/es6/FrontApplet/Management/Power/PowerHelper.js +12 -0
  21. package/es6/FrontApplet/Management/Power/PowerHelper.js.map +1 -0
  22. package/es6/FrontApplet/Management/Screen/IScreen.d.ts +5 -0
  23. package/es6/FrontApplet/Management/Screen/Screen.d.ts +18 -2
  24. package/es6/FrontApplet/Management/Screen/Screen.js +32 -23
  25. package/es6/FrontApplet/Management/Screen/Screen.js.map +1 -1
  26. package/es6/FrontApplet/Management/Wifi/IWifi.d.ts +3 -0
  27. package/es6/FrontApplet/Management/Wifi/IWifi.js +1 -0
  28. package/es6/FrontApplet/Management/Wifi/IWifi.js.map +1 -1
  29. package/es6/FrontApplet/Management/Wifi/Wifi.d.ts +56 -19
  30. package/es6/FrontApplet/Management/Wifi/Wifi.js +59 -20
  31. package/es6/FrontApplet/Management/Wifi/Wifi.js.map +1 -1
  32. package/es6/Monitoring/DeviceInfo/deviceInfoCommands.d.ts +29 -0
  33. package/es6/Monitoring/DeviceInfo/deviceInfoCommands.js +10 -0
  34. package/es6/Monitoring/DeviceInfo/deviceInfoCommands.js.map +1 -0
  35. package/es6/Monitoring/DeviceInfo/handleDeviceInfoRequests.d.ts +5 -0
  36. package/es6/Monitoring/DeviceInfo/handleDeviceInfoRequests.js +30 -0
  37. package/es6/Monitoring/DeviceInfo/handleDeviceInfoRequests.js.map +1 -0
  38. package/es6/Monitoring/FileSystem/fileSystemCommands.d.ts +21 -1
  39. package/es6/Monitoring/FileSystem/fileSystemCommands.js +5 -1
  40. package/es6/Monitoring/FileSystem/fileSystemCommands.js.map +1 -1
  41. package/es6/Monitoring/FileSystem/handleFileSystemRequests.js +14 -0
  42. package/es6/Monitoring/FileSystem/handleFileSystemRequests.js.map +1 -1
  43. package/es6/Monitoring/Management/Power/handlePowerRequests.js +27 -0
  44. package/es6/Monitoring/Management/Power/handlePowerRequests.js.map +1 -1
  45. package/es6/Monitoring/Management/Power/powerCommands.d.ts +41 -1
  46. package/es6/Monitoring/Management/Power/powerCommands.js +9 -1
  47. package/es6/Monitoring/Management/Power/powerCommands.js.map +1 -1
  48. package/es6/Monitoring/Management/Screen/handleScreenRequests.js +3 -1
  49. package/es6/Monitoring/Management/Screen/handleScreenRequests.js.map +1 -1
  50. package/es6/Monitoring/Management/Screen/screenCommands.d.ts +2 -0
  51. package/es6/Monitoring/Management/Screen/screenCommands.js.map +1 -1
  52. package/es6/Monitoring/Monitoring.js +2 -0
  53. package/es6/Monitoring/Monitoring.js.map +1 -1
  54. package/es6/bundle.d.ts +14 -1
  55. package/es6/bundle.js +5 -16
  56. package/es6/bundle.js.map +1 -1
  57. package/package.json +1 -1
@@ -1,48 +1,19 @@
1
1
  ---
2
- sidebar_position: 99
2
+ sidebar_position: 0
3
3
  ---
4
4
 
5
5
  # fpath
6
6
 
7
- fpath utility mirrors node [path](https://nodejs.org/docs/latest/api/path.html)
8
- module, but accepts IFilePath type instead of strings. It is useful when
9
- working with [sos.fileSystem](/sdk/sos/fileSystem).
10
-
11
- Not implemented functions:
12
- - format
13
- - matchesGlob
14
- - parse
15
- - relative
16
-
17
- ```ts
18
- import { sos, fpath } from "@signageos/front-applet";
19
-
20
- const [internal] = await sos.fileSystem.listInternalStorageUnits();
21
- const rootPath = {
22
- filePath: '', // Empty string is used as an absolute path instead of "/"
23
- storageUnit: internal
24
- };
25
-
26
- // list saved files in videos/2025-05-19/ directory
27
- const videos = await sos.fileSystem.listFiles(
28
- fpath.join(rootPath, "videos", "2025-05-19"),
29
- );
30
- ```
31
-
32
7
  ## Properties
33
8
 
34
9
  ### path
35
10
 
36
- Underlying path polyfill
37
-
38
11
  ```ts expandable
39
- path: path.Path;
12
+ path: import("path-browserify").Path;
40
13
  ```
41
14
 
42
15
  ### sep
43
16
 
44
- Separator used for joining path segments
45
-
46
17
  ```ts expandable
47
18
  sep: string;
48
19
  ```
@@ -51,287 +22,78 @@ sep: string;
51
22
 
52
23
  ### basename()
53
24
 
54
- Return the last portion of path, since it is not a valid path, a string is returned.
55
-
56
25
  ```ts expandable
57
- basename(filePath: IFilePath, suffix?: string): string;
58
- // show-more
59
- interface IFilePath {
60
- storageUnit: IStorageUnit;
61
- filePath: string;
62
- }
63
-
64
- interface IStorageUnit {
65
- type: string;
66
- capacity: number;
67
- freeSpace: number;
68
- usableSpace: number;
69
- removable: boolean;
70
- }
71
-
72
- ```
73
-
74
- #### Example
75
-
76
- ```ts
77
- const path = { filePath: "images/picture.png", storageUnit: ... };
78
- fpath.basename(path); // "picture.png"
26
+ basename(filePath: import("./FrontApplet/FileSystem/types").IFilePath, suffix?: string): string;
79
27
  ```
80
28
 
81
29
  <Separator />
82
30
 
83
31
  ### concat()
84
32
 
85
- Concatenate fp with paths without adding separator
86
-
87
33
  ```ts expandable
88
- concat(filePath: IFilePath, ...paths: string[]): IFilePath;
89
- // show-more
90
- interface IFilePath {
91
- storageUnit: IStorageUnit;
92
- filePath: string;
93
- }
94
-
95
- interface IStorageUnit {
96
- type: string;
97
- capacity: number;
98
- freeSpace: number;
99
- usableSpace: number;
100
- removable: boolean;
101
- }
102
-
103
- ```
104
-
105
- #### Example
106
-
107
- ```ts
108
- const path = { filePath: "uploads/archive.tar", storageUnit: ... };
109
- fpath.concat(path, "_extracted"); // { filePath: "uploads/archive.tar_extracted", storageUnit: ... }
34
+ concat(filePath: import("./FrontApplet/FileSystem/types").IFilePath, ...paths: string[]): import("./FrontApplet/FileSystem/types").IFilePath;
110
35
  ```
111
36
 
112
37
  <Separator />
113
38
 
114
39
  ### dirname()
115
40
 
116
- Removes the last portion of path, returning the parent directory of the path. Ignores trailing slashes
117
-
118
41
  ```ts expandable
119
- dirname(filePath: IFilePath): IFilePath;
120
- // show-more
121
- interface IFilePath {
122
- storageUnit: IStorageUnit;
123
- filePath: string;
124
- }
125
-
126
- interface IStorageUnit {
127
- type: string;
128
- capacity: number;
129
- freeSpace: number;
130
- usableSpace: number;
131
- removable: boolean;
132
- }
133
-
134
- ```
135
-
136
- #### Example
137
-
138
- ```ts
139
- const path = { filePath: "images/picture.png", storageUnit: ... };
140
- fpath.dirname(path); // { filePath: "images", storageUnit: ... }
42
+ dirname(filePath: import("./FrontApplet/FileSystem/types").IFilePath): import("./FrontApplet/FileSystem/types").IFilePath;
141
43
  ```
142
44
 
143
45
  <Separator />
144
46
 
145
47
  ### extname()
146
48
 
147
- Returns extension of the path, from the last period, including the period.
148
-
149
49
  ```ts expandable
150
- extname(filePath: IFilePath): string;
151
- // show-more
152
- interface IFilePath {
153
- storageUnit: IStorageUnit;
154
- filePath: string;
155
- }
156
-
157
- interface IStorageUnit {
158
- type: string;
159
- capacity: number;
160
- freeSpace: number;
161
- usableSpace: number;
162
- removable: boolean;
163
- }
164
-
165
- ```
166
-
167
- #### Example
168
-
169
- ```ts
170
- const path = { filePath: "images/picture.png", storageUnit: ... };
171
- fpath.dirname(path); // .png
50
+ extname(filePath: import("./FrontApplet/FileSystem/types").IFilePath): string;
172
51
  ```
173
52
 
174
53
  <Separator />
175
54
 
176
55
  ### isAbsolute()
177
56
 
178
- Always returns true, because all file paths are absolute
179
-
180
57
  ```ts expandable
181
- isAbsolute(_: IFilePath): boolean;
182
- // show-more
183
- interface IFilePath {
184
- storageUnit: IStorageUnit;
185
- filePath: string;
186
- }
187
-
188
- interface IStorageUnit {
189
- type: string;
190
- capacity: number;
191
- freeSpace: number;
192
- usableSpace: number;
193
- removable: boolean;
194
- }
195
-
58
+ isAbsolute(_: import("./FrontApplet/FileSystem/types").IFilePath): boolean;
196
59
  ```
197
60
 
198
61
  <Separator />
199
62
 
200
63
  ### join()
201
64
 
202
- Returns new filePath with paths appended to it and normalized (resolved . and ..)
203
-
204
65
  ```ts expandable
205
- join(filePath: IFilePath, ...paths: string[]): IFilePath;
206
- // show-more
207
- interface IFilePath {
208
- storageUnit: IStorageUnit;
209
- filePath: string;
210
- }
211
-
212
- interface IStorageUnit {
213
- type: string;
214
- capacity: number;
215
- freeSpace: number;
216
- usableSpace: number;
217
- removable: boolean;
218
- }
219
-
220
- ```
221
-
222
- #### Example
223
-
224
- ```ts
225
- const path = { filePath: "images", storageUnit: ... };
226
- fpath.join(path, "racoons", ".", "picture.png"); // { filePath: "images/racoons/picture.png", storageUnit: ... }
66
+ join(filePath: import("./FrontApplet/FileSystem/types").IFilePath, ...paths: string[]): import("./FrontApplet/FileSystem/types").IFilePath;
227
67
  ```
228
68
 
229
69
  <Separator />
230
70
 
231
71
  ### normalize()
232
72
 
233
- Resolves . and .. in the path and removes multiple slashes
234
-
235
73
  ```ts expandable
236
- normalize(filePath: IFilePath): IFilePath;
237
- // show-more
238
- interface IFilePath {
239
- storageUnit: IStorageUnit;
240
- filePath: string;
241
- }
242
-
243
- interface IStorageUnit {
244
- type: string;
245
- capacity: number;
246
- freeSpace: number;
247
- usableSpace: number;
248
- removable: boolean;
249
- }
250
-
251
- ```
252
-
253
- #### Example
254
-
255
- ```ts
256
- const path = { filePath: "images//test/../test2/./", storageUnit: ... };
257
- fpath.normalize(path); // { filePath: "images/test2/", storageUnit: ... }
74
+ normalize(filePath: import("./FrontApplet/FileSystem/types").IFilePath): import("./FrontApplet/FileSystem/types").IFilePath;
258
75
  ```
259
76
 
260
77
  <Separator />
261
78
 
262
79
  ### resolve()
263
80
 
264
- Same as fpath.join()
265
-
266
81
  ```ts expandable
267
- resolve(filePath: IFilePath, ...paths: string[]): IFilePath;
268
- // show-more
269
- interface IFilePath {
270
- storageUnit: IStorageUnit;
271
- filePath: string;
272
- }
273
-
274
- interface IStorageUnit {
275
- type: string;
276
- capacity: number;
277
- freeSpace: number;
278
- usableSpace: number;
279
- removable: boolean;
280
- }
281
-
82
+ resolve(filePath: import("./FrontApplet/FileSystem/types").IFilePath, ...paths: string[]): import("./FrontApplet/FileSystem/types").IFilePath;
282
83
  ```
283
84
 
284
85
  <Separator />
285
86
 
286
87
  ### safeJoin()
287
88
 
288
- Similar to fpath.join, but resulting path will always be subdirectory of base
289
-
290
89
  ```ts expandable
291
- safeJoin(base: IFilePath, ...paths: string[]): IFilePath;
292
- // show-more
293
- interface IFilePath {
294
- storageUnit: IStorageUnit;
295
- filePath: string;
296
- }
297
-
298
- interface IStorageUnit {
299
- type: string;
300
- capacity: number;
301
- freeSpace: number;
302
- usableSpace: number;
303
- removable: boolean;
304
- }
305
-
306
- ```
307
-
308
- #### Example
309
-
310
- ```ts
311
- const path = { filePath: "uploads/userA", storageUnit: ... };
312
- fpath.safeJoin(path, "..", "userB", "picture.png"); // { filePath: "uploads/userA/userB/picture.png", storageUnit: ... }
90
+ safeJoin(base: import("./FrontApplet/FileSystem/types").IFilePath, ...paths: string[]): import("./FrontApplet/FileSystem/types").IFilePath;
313
91
  ```
314
92
 
315
93
  <Separator />
316
94
 
317
95
  ### stringify()
318
96
 
319
- Convert filePath to string, this string is not guaranteed to be unique and should be only used for debugging/logging
320
-
321
97
  ```ts expandable
322
- stringify(filePath: IFilePath): string;
323
- // show-more
324
- interface IFilePath {
325
- storageUnit: IStorageUnit;
326
- filePath: string;
327
- }
328
-
329
- interface IStorageUnit {
330
- type: string;
331
- capacity: number;
332
- freeSpace: number;
333
- usableSpace: number;
334
- removable: boolean;
335
- }
336
-
98
+ stringify(filePath: import("./FrontApplet/FileSystem/types").IFilePath): string;
337
99
  ```
@@ -574,6 +574,21 @@ removeStorageUnitsChangedListener(listener: () => void): void;
574
574
 
575
575
  <Separator />
576
576
 
577
+ ### wipeout()
578
+
579
+ The `wipeout()` method is used to wipe out all data from the file system, later when action is finished the device is rebooted.
580
+
581
+ :::danger
582
+ - Ensure that function is called only once, otherwise it will wipe out the file system again on applet start!
583
+ - This function is clearing internal file system storage, cache storage and cookies. Local storage will not be cleared.
584
+ :::
585
+
586
+ ```ts expandable
587
+ wipeout(): Promise<void>;
588
+ ```
589
+
590
+ <Separator />
591
+
577
592
  ### writeFile()
578
593
 
579
594
  The `writeFile()` method writes string content to the file specified by `filePath`. If the file does exist, it is created. If the directory
@@ -25,6 +25,22 @@ await sos.management.power.appRestart();
25
25
 
26
26
  <Separator />
27
27
 
28
+ ### clearScheduledReboots()
29
+
30
+ Removes all scheduled reboot rules from the device.
31
+
32
+ ```ts expandable
33
+ clearScheduledReboots(): Promise<void>;
34
+ ```
35
+
36
+ #### Example
37
+
38
+ ```ts
39
+ await sos.management.power.clearScheduledReboots();
40
+ ```
41
+
42
+ <Separator />
43
+
28
44
  ### getProprietaryTimers()
29
45
 
30
46
  The `getProprietaryTimers()` method returns a list of currently set
@@ -50,6 +66,33 @@ const timers = await sos.management.power.getProprietaryTimers();
50
66
 
51
67
  <Separator />
52
68
 
69
+ ### getScheduledReboots()
70
+
71
+ Returns all scheduled reboot rules on the device.
72
+
73
+ ```ts expandable
74
+ getScheduledReboots(): Promise<IScheduledRebootActions[]>;
75
+ // show-more
76
+ interface IScheduledRebootActions {
77
+ id: string;
78
+ rule: IScheduledRebootRule;
79
+ }
80
+
81
+ interface IScheduledRebootRule {
82
+ weekdays: number[] | string[];
83
+ time: string;
84
+ }
85
+
86
+ ```
87
+
88
+ #### Example
89
+
90
+ ```ts
91
+ await sos.management.power.getScheduledReboots();
92
+ ```
93
+
94
+ <Separator />
95
+
53
96
  ### getTimers()
54
97
 
55
98
  The `getTimers()` method returns a list of currently set native timers.
@@ -75,6 +118,32 @@ const timers = await sos.management.power.getTimers();
75
118
 
76
119
  <Separator />
77
120
 
121
+ ### removeScheduledReboot()
122
+
123
+ Removes scheduled reboot rule from the device.
124
+
125
+ ```ts expandable
126
+ removeScheduledReboot(id: string): Promise<void>;
127
+ ```
128
+
129
+ #### Params
130
+
131
+ | Name | Type | Description |
132
+ |------|----------|---------------------------------|
133
+ | `id` | `string` | - ID of the rule to be removed. |
134
+
135
+ #### Example
136
+
137
+ ```ts
138
+ // Get scheduled reboots
139
+ const scheduledReboots = await sos.management.power.getScheduledReboots();
140
+
141
+ // Remove scheduled reboot
142
+ await sos.management.power.removeScheduledReboot(scheduledReboots[0].id);
143
+ ```
144
+
145
+ <Separator />
146
+
78
147
  ### setProprietaryTimer()
79
148
 
80
149
  The `setProprietaryTimer()` method creates or updates a
@@ -102,6 +171,42 @@ await sos.management.power.setProprietaryTimer("TIMER_20", "08:00", "22:00", ["m
102
171
 
103
172
  <Separator />
104
173
 
174
+ ### setScheduledReboot()
175
+
176
+ Schedule automatic reboot on the device. Calling this function will create one rule.
177
+ It is possible to set multiple rules, which can be later obtained by `getScheduledReboots` function.
178
+
179
+ :::note
180
+ - Setting new scheduled reboot on device might take up to 10 minutes to show in Box.
181
+ - Every new scheduled reboot rule gets unique identifier generated by device, it might be later returned by `getScheduledReboots()`.
182
+ :::
183
+
184
+ ```ts expandable
185
+ setScheduledReboot(weekdays: WeekdayType[], time: string): Promise<void>;
186
+ // show-more
187
+ type WeekdayType = 'MONDAY' | 'TUESDAY' | 'WEDNESDAY' | 'THURSDAY' | 'FRIDAY' | 'SATURDAY' | 'SUNDAY';
188
+
189
+ ```
190
+
191
+ #### Params
192
+
193
+ | Name | Type | Description |
194
+ |------------|-----------------|------------------------------------------------------------------|
195
+ | `weekdays` | `WeekdayType[]` | |
196
+ | `time` | `string` | - Time when the reboot should be executed. Format is `HH:mm:ss`. |
197
+
198
+ #### Example
199
+
200
+ ```ts
201
+ // Schedule reboot every Monday at 3:00 AM
202
+ await sos.management.power.setScheduledReboot(["MONDAY"], "03:00:00");
203
+
204
+ // Schedule reboot every Monday and Friday at 7:30 PM / 19:30
205
+ await sos.management.power.setScheduledReboot(["MONDAY", "FRIDAY"], "19:30:00");
206
+ ```
207
+
208
+ <Separator />
209
+
105
210
  ### setTimer()
106
211
 
107
212
  The `setTimers()` method creates or updates a native timer.
@@ -74,7 +74,7 @@ isPoweredOn(): Promise<boolean>;
74
74
 
75
75
  ### powerOff()
76
76
 
77
- The `powerOff()` method turn the screen off.
77
+ The `powerOff()` method turn the screen off. It will turn off the display backlight and the panel, and it will also disable applet.
78
78
 
79
79
  :::warning
80
80
 
@@ -183,7 +183,7 @@ await sos.management.screen.setBrightness(
183
183
 
184
184
  <Separator />
185
185
 
186
- ### takeAndUploadScreenshot()
186
+ ### takeAndUploadScreenshot(uploadBaseUrl, computeHash)
187
187
 
188
188
  The `takeAndUploadScreenshot()` method takes a screenshot and uploads it to a specified url. This can be either a signageOS upload url
189
189
  (`https://upload.signageos.io`) or a dedicated server url for uploading screenshots. Format in which the screenshot is uploaded may be
@@ -197,6 +197,39 @@ To implement a custom screenshot upload server, it needs to implement these endp
197
197
  signageOS provides standalone server which is implements all of those methods. It is provided to all of our partners through the
198
198
  [support ticketing system](https://box.signageos.io/support/).
199
199
 
200
+ ```ts expandable
201
+ takeAndUploadScreenshot(uploadBaseUrl: string, computeHash?: boolean): Promise<{
202
+ screenshotUrl: string;
203
+ aHash?: string;
204
+ }>;
205
+ ```
206
+
207
+ #### Params
208
+
209
+ | Name | Type | Description |
210
+ |----------------------------|-----------|---------------------------------------------------------------------------------------------------------------|
211
+ | `uploadBaseUrl` | `string` | URL to which the screenshot will be uploaded. It can be either a signageOS upload url or a custom server url. |
212
+ | `computeHash` *(optional)* | `boolean` | Whether to compute a hash of the screenshot and return it in the response. |
213
+
214
+ #### Example
215
+
216
+ ```ts
217
+ const { screenshotUrl, aHash } = await sos.management.screen.takeAndUploadScreenshot(
218
+ 'https://your.upload.server/upload/file?prefix=screenshot/',
219
+ true,
220
+ );
221
+ ```
222
+
223
+ <Separator />
224
+
225
+ ### ~takeAndUploadScreenshot(uploadBaseUrl)~
226
+
227
+ :::danger Deprecated
228
+
229
+ This method was deprecated. Use `takeAndUploadScreenshot(uploadBaseUrl: string, computeHash?: boolean): Promise<{ screenshotUrl: string; aHash?: string }>` instead.
230
+
231
+ :::
232
+
200
233
  ```ts expandable
201
234
  takeAndUploadScreenshot(uploadBaseUrl: string): Promise<string>;
202
235
  ```