@signageos/front-applet 8.1.0 → 8.1.2

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 (34) hide show
  1. package/dist/bundle.js +2 -2
  2. package/dist/bundle.js.map +1 -1
  3. package/docs/fpath/index.md +12 -250
  4. package/docs/sos/fileSystem.md +12 -12
  5. package/docs/sos/index.md +36 -12
  6. package/docs/sos/offline/cache.md +6 -6
  7. package/docs/sos/stream.md +1172 -37
  8. package/docs/sos/sync.md +2 -2
  9. package/docs/sos/video.md +515 -22
  10. package/docs/sos_management/security.md +4 -2
  11. package/docs/sos_management/wifi.md +9 -9
  12. package/es6/FrontApplet/FrontApplet.d.ts +31 -7
  13. package/es6/FrontApplet/FrontApplet.js +32 -8
  14. package/es6/FrontApplet/FrontApplet.js.map +1 -1
  15. package/es6/FrontApplet/Stream/IStreamTrackInfo.d.ts +34 -0
  16. package/es6/FrontApplet/Stream/Stream.d.ts +245 -20
  17. package/es6/FrontApplet/Stream/Stream.js +245 -20
  18. package/es6/FrontApplet/Stream/Stream.js.map +1 -1
  19. package/es6/FrontApplet/Stream/StreamProtocol.d.ts +4 -0
  20. package/es6/FrontApplet/Stream/StreamProtocol.js +4 -0
  21. package/es6/FrontApplet/Stream/StreamProtocol.js.map +1 -1
  22. package/es6/FrontApplet/Stream/streamEventProperties.d.ts +11 -1
  23. package/es6/FrontApplet/Stream/streamEvents.d.ts +26 -0
  24. package/es6/FrontApplet/Video/IOptions.d.ts +41 -0
  25. package/es6/FrontApplet/Video/IVideoEvent.d.ts +8 -0
  26. package/es6/FrontApplet/Video/IVideoEvent.js.map +1 -1
  27. package/es6/FrontApplet/Video/IVideoProperties.d.ts +3 -0
  28. package/es6/FrontApplet/Video/Video.d.ts +256 -19
  29. package/es6/FrontApplet/Video/Video.js +258 -22
  30. package/es6/FrontApplet/Video/Video.js.map +1 -1
  31. package/es6/bundle.d.ts +14 -1
  32. package/es6/bundle.js +5 -16
  33. package/es6/bundle.js.map +1 -1
  34. 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
  ```
@@ -46,7 +46,7 @@ interface IStorageUnit {
46
46
 
47
47
  #### Possible errors
48
48
 
49
- The method throws an error if the parent directory does not exist or the `filePath` is a directory.
49
+ If the parent directory does not exist or the `filePath` is a directory.
50
50
 
51
51
  <Separator />
52
52
 
@@ -84,7 +84,7 @@ interface ICopyFileOptions {
84
84
 
85
85
  #### Possible errors
86
86
 
87
- The method throws an error if the source file does not exists or parent of the destination file path does not exists. It also throws if the
87
+ If the source file does not exists or parent of the destination file path does not exists. It also throws if the
88
88
  `options.overwrite` is not set and the destination file path already exists.
89
89
 
90
90
  <Separator />
@@ -143,7 +143,7 @@ interface IStorageUnit {
143
143
 
144
144
  #### Possible errors
145
145
 
146
- The method throws an error if the directory already exists or its parent directory does not exist.
146
+ If the directory already exists or its parent directory does not exist.
147
147
 
148
148
  <Separator />
149
149
 
@@ -171,7 +171,7 @@ interface IStorageUnit {
171
171
 
172
172
  #### Possible errors
173
173
 
174
- The method throws an error if the file does not exists or if `recursive` is set to false and the file path is a directory.
174
+ If the file does not exists or if `recursive` is set to false and the file path is a directory.
175
175
 
176
176
  <Separator />
177
177
 
@@ -241,7 +241,7 @@ interface IHeaders {
241
241
 
242
242
  #### Possible errors
243
243
 
244
- The method throws an error if the network request fails, parent directory does not exist, or the file path is a directory.
244
+ If the network request fails, parent directory does not exist, or the file path is a directory.
245
245
 
246
246
  <Separator />
247
247
 
@@ -293,7 +293,7 @@ interface IStorageUnit {
293
293
 
294
294
  #### Possible errors
295
295
 
296
- The method throws an error if the archive file path does not exist, it is not a valid archive file or the destination directory does not exist.
296
+ If the archive file path does not exist, it is not a valid archive file or the destination directory does not exist.
297
297
 
298
298
  <Separator />
299
299
 
@@ -359,7 +359,7 @@ type AnyString = string & {};
359
359
 
360
360
  #### Possible errors
361
361
 
362
- The method throws an error if the file does not exist or it is a directory.
362
+ If the file does not exist or it is a directory.
363
363
 
364
364
  <Separator />
365
365
 
@@ -387,7 +387,7 @@ interface IStorageUnit {
387
387
 
388
388
  #### Possible errors
389
389
 
390
- The method throws an error if the file path does not exist.
390
+ If the file path does not exist.
391
391
 
392
392
  <Separator />
393
393
 
@@ -439,7 +439,7 @@ interface IStorageUnit {
439
439
 
440
440
  #### Possible errors
441
441
 
442
- The method throws an error if the path does not exist or it is a file.
442
+ If the path does not exist or it is a file.
443
443
 
444
444
  <Separator />
445
445
 
@@ -510,7 +510,7 @@ interface IMoveFileOptions {
510
510
 
511
511
  #### Possible errors
512
512
 
513
- The method throws an error if the source file does not exists or parent of the destination file path does not exists. It also throws if the
513
+ If the source file does not exists or parent of the destination file path does not exists. It also throws if the
514
514
  `options.overwrite` is not set and the destination file path already exists.
515
515
 
516
516
  <Separator />
@@ -550,7 +550,7 @@ interface IStorageUnit {
550
550
 
551
551
  #### Possible errors
552
552
 
553
- The method throws an error if the file does not exist.
553
+ If the file does not exist.
554
554
 
555
555
  <Separator />
556
556
 
@@ -614,7 +614,7 @@ interface IStorageUnit {
614
614
 
615
615
  #### Possible errors
616
616
 
617
- The method throws an error if the parent directory does not exist or the `filePath` is a directory.
617
+ If the parent directory does not exist or the `filePath` is a directory.
618
618
 
619
619
  ## API Example
620
620
 
package/docs/sos/index.md CHANGED
@@ -4,11 +4,22 @@ sidebar_position: 0
4
4
 
5
5
  # sos
6
6
 
7
- <Admonition type="info" icon="" title="">
8
- Learn more about using this API [here](https://developers.signageos.io/docs/applets/getting-started/#using-the-sos-sdk)
9
- </Admonition>
7
+ The `sos` API groups together all functionality the \@signageos/front-applet offers. This is a basic object that provides you with access to
8
+ all the applet functionality, such as device information, display control, video playback, and more.
10
9
 
11
- The `sos` API groups together all functionality the \@signageos/front-applet offers.
10
+ :::warning
11
+ All calls to the sos object need to happen after `sos.onReady()` is resolved. After the sOS object is ready, there are global properties available, which can be used for applet customization and device identification.
12
+ :::
13
+
14
+ ```ts
15
+ // Simple example of using the sos API to play a video.
16
+ import sos from '@signageos/front-applet';
17
+
18
+ sos.onReady().then(async function () {
19
+ startYourApplet(); // Example method to run
20
+ // Any other code
21
+ }
22
+ ```
12
23
 
13
24
  ## Properties
14
25
 
@@ -23,7 +34,7 @@ readonly appletVersion: string;
23
34
  ### authHash
24
35
 
25
36
  <Admonition type="info" icon="" title="">
26
- Learn more about using this API [here](https://developers.signageos.io/docs/applets/api-guides/device-identification)
37
+ Learn more about using this API [here](https://developers.signageos.io/docs/sos-guides/device-identification)
27
38
  </Admonition>
28
39
 
29
40
  The `authHash` property is an alternative device identifier, which is designed for secure pairing and locating devices through
@@ -39,11 +50,7 @@ readonly authHash: string;
39
50
 
40
51
  ### config
41
52
 
42
- <Admonition type="info" icon="" title="">
43
- Learn more about using this API [here](https://developers.signageos.io/docs/applets/configuration/)
44
- </Admonition>
45
-
46
- The `config` property is a Key-value dictionary of the applet configuration.
53
+ The `config` property is a Key-value dictionary of the applet configuration. It is assigned on the device with timing via Box or SDK/Rest API.
47
54
 
48
55
  ```ts expandable
49
56
  readonly config: Record<string, number | string | boolean>;
@@ -60,6 +67,16 @@ which is resolved at the same time as the listener.
60
67
  onReady(listener?: () => void): Promise<void>;
61
68
  ```
62
69
 
70
+ #### Params
71
+
72
+ | Name | Type | Description |
73
+ |-------------------------|--------------|--------------------------------------------------------------|
74
+ | `listener` *(optional)* | `() => void` | Optional listener which is called when the sos API is ready. |
75
+
76
+ #### Return value
77
+
78
+ Promise which is resolved when the sos API is ready.
79
+
63
80
  #### Example
64
81
 
65
82
  ```ts
@@ -76,12 +93,16 @@ sos.onReady(async function () {
76
93
 
77
94
  ### refresh()
78
95
 
79
- The `refresh()` method initializes refresh of the applet. Similar to window.location.reload(), but the applet is not downloaded again.
96
+ The `refresh()` method initializes the refresh of the applet. Similar to window.location.reload(), but the applet is not downloaded again.
80
97
 
81
98
  ```ts expandable
82
99
  refresh(): Promise<void>;
83
100
  ```
84
101
 
102
+ #### Return value
103
+
104
+ Promise that is resolved when the refresh is completed.
105
+
85
106
  #### Example
86
107
 
87
108
  ```ts
@@ -106,5 +127,8 @@ restore(): void;
106
127
  #### Example
107
128
 
108
129
  ```ts
109
- sos.restore();
130
+ sos.onReady(async function () {
131
+ // Some function which is called when the applet is ready
132
+ sos.restore();
133
+ });
110
134
  ```
@@ -28,7 +28,7 @@ decompressFile(uid: string, destinationUid: string, method: 'zip'): Promise<void
28
28
 
29
29
  #### Possible errors
30
30
 
31
- The method throws an error if the uid does not exist.
31
+ If the uid does not exist.
32
32
 
33
33
  <Separator />
34
34
 
@@ -56,7 +56,7 @@ deleteFile(uid: string): Promise<void>;
56
56
 
57
57
  #### Possible errors
58
58
 
59
- The method throws an error if the uid does not exist.
59
+ If the uid does not exist.
60
60
 
61
61
  <Separator />
62
62
 
@@ -75,7 +75,7 @@ type AnyString = string & {};
75
75
 
76
76
  #### Possible errors
77
77
 
78
- The method throws an error if the uid does not exist or the hashing algorithm is not supported.
78
+ If the uid does not exist or the hashing algorithm is not supported.
79
79
 
80
80
  <Separator />
81
81
 
@@ -132,7 +132,7 @@ interface IFile {
132
132
 
133
133
  #### Possible errors
134
134
 
135
- The method throws an error if the uid does not exists
135
+ If the uid does not exists
136
136
 
137
137
  <Separator />
138
138
 
@@ -185,7 +185,7 @@ saveFile(uid: string, uri: string, headers?: {
185
185
 
186
186
  #### Possible errors
187
187
 
188
- The method throws an error if the network request fails or a file with the same uid is already cached
188
+ If the network request fails or a file with the same uid is already cached
189
189
 
190
190
  <Separator />
191
191
 
@@ -204,4 +204,4 @@ type AnyString = string & {};
204
204
 
205
205
  #### Possible errors
206
206
 
207
- The method throws an error if the uid does not exist or the hashing algorithm is not supported.
207
+ If the uid does not exist or the hashing algorithm is not supported.