Skip to content

Commit 5ffa0cf

Browse files
committed
Adding getchildren streamIds
1 parent 14d9201 commit 5ffa0cf

6 files changed

Lines changed: 25 additions & 5 deletions

File tree

js/toolkit/StreamsTools.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import type { pryv as Pryv } from '../patchedPryv';
12
/**
23
* Iterate all streams and children
34
*/
4-
export declare function allStreamsAndChildren(streamStructure: any): Generator<any, void, unknown>;
5+
export declare function allStreamsAndChildren(streamStructure: Pryv.Stream[]): Generator<Pryv.Stream, void, unknown>;
6+
export declare function getStreamIdAndChildrenIds(stream: Pryv.Stream): Array<string>;
57
//# sourceMappingURL=StreamsTools.d.ts.map

js/toolkit/StreamsTools.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/toolkit/StreamsTools.js

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/toolkit/StreamsTools.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hds-lib",
3-
"version": "0.1.10",
3+
"version": "0.1.11",
44
"description": "Health Data Safe - Library",
55
"scripts": {
66
"test": "NODE_ENV=test mocha tests --test-reporter=spec",

ts/toolkit/StreamsTools.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import type { pryv as Pryv } from '../patchedPryv';
2+
13
/**
24
* Iterate all streams and children
35
*/
4-
export function * allStreamsAndChildren (streamStructure: any): Generator<any, void, unknown> {
6+
export function * allStreamsAndChildren (streamStructure: Pryv.Stream[]): Generator<Pryv.Stream, void, unknown> {
57
for (const stream of streamStructure) {
68
yield stream;
79
if (stream.children && stream.children.length > 0) {
@@ -11,3 +13,11 @@ export function * allStreamsAndChildren (streamStructure: any): Generator<any, v
1113
}
1214
}
1315
}
16+
17+
export function getStreamIdAndChildrenIds (stream: Pryv.Stream): Array<string> {
18+
const streamIds = [];
19+
for (const s of allStreamsAndChildren([stream])) {
20+
streamIds.push(s.id);
21+
}
22+
return streamIds;
23+
}

0 commit comments

Comments
 (0)