@neurodevs/node-lsl 12.0.0 → 12.0.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.
- package/build/__tests__/AbstractPackageTest.d.ts +3 -3
- package/build/__tests__/AbstractPackageTest.js +34 -39
- package/build/__tests__/AbstractPackageTest.js.map +1 -1
- package/build/__tests__/impl/LiblslAdapter.test.d.ts +3 -1
- package/build/__tests__/impl/LiblslAdapter.test.js +177 -142
- package/build/__tests__/impl/LiblslAdapter.test.js.map +1 -1
- package/build/__tests__/impl/LslEventMarkerOutlet.test.d.ts +1 -1
- package/build/__tests__/impl/LslEventMarkerOutlet.test.js +39 -44
- package/build/__tests__/impl/LslEventMarkerOutlet.test.js.map +1 -1
- package/build/__tests__/impl/LslStreamInfo.test.d.ts +1 -1
- package/build/__tests__/impl/LslStreamInfo.test.js +51 -58
- package/build/__tests__/impl/LslStreamInfo.test.js.map +1 -1
- package/build/__tests__/impl/LslStreamInlet.test.d.ts +2 -1
- package/build/__tests__/impl/LslStreamInlet.test.js +23 -21
- package/build/__tests__/impl/LslStreamInlet.test.js.map +1 -1
- package/build/__tests__/impl/LslStreamOutlet.test.d.ts +2 -2
- package/build/__tests__/impl/LslStreamOutlet.test.js +56 -61
- package/build/__tests__/impl/LslStreamOutlet.test.js.map +1 -1
- package/build/__tests__/impl/LslWebSocketBridge.test.d.ts +2 -2
- package/build/__tests__/impl/LslWebSocketBridge.test.js +8 -45
- package/build/__tests__/impl/LslWebSocketBridge.test.js.map +1 -1
- package/build/assertions.d.ts +1 -1
- package/build/assertions.js +13 -20
- package/build/assertions.js.map +1 -1
- package/build/consts.js +2 -5
- package/build/consts.js.map +1 -1
- package/build/impl/LiblslAdapter.d.ts +5 -4
- package/build/impl/LiblslAdapter.js +60 -51
- package/build/impl/LiblslAdapter.js.map +1 -1
- package/build/impl/LslEventMarkerOutlet.d.ts +3 -3
- package/build/impl/LslEventMarkerOutlet.js +10 -12
- package/build/impl/LslEventMarkerOutlet.js.map +1 -1
- package/build/impl/LslStreamInfo.d.ts +1 -1
- package/build/impl/LslStreamInfo.js +19 -16
- package/build/impl/LslStreamInfo.js.map +1 -1
- package/build/impl/LslStreamInlet.d.ts +5 -2
- package/build/impl/LslStreamInlet.js +17 -14
- package/build/impl/LslStreamInlet.js.map +1 -1
- package/build/impl/LslStreamOutlet.d.ts +2 -2
- package/build/impl/LslStreamOutlet.js +20 -21
- package/build/impl/LslStreamOutlet.js.map +1 -1
- package/build/impl/LslWebSocketBridge.js +2 -4
- package/build/impl/LslWebSocketBridge.js.map +1 -1
- package/build/index.d.ts +34 -34
- package/build/index.js +34 -71
- package/build/index.js.map +1 -1
- package/build/scripts/runLslEventMarkerOutlet.js +2 -7
- package/build/scripts/runLslEventMarkerOutlet.js.map +1 -1
- package/build/scripts/runLslStreamOutlet.js +2 -7
- package/build/scripts/runLslStreamOutlet.js.map +1 -1
- package/build/testDoubles/EventMarkerOutlet/FakeEventMarkerOutlet.d.ts +2 -2
- package/build/testDoubles/EventMarkerOutlet/FakeEventMarkerOutlet.js +5 -8
- package/build/testDoubles/EventMarkerOutlet/FakeEventMarkerOutlet.js.map +1 -1
- package/build/testDoubles/EventMarkerOutlet/MockEventMarkerOutlet.d.ts +2 -2
- package/build/testDoubles/EventMarkerOutlet/MockEventMarkerOutlet.js +12 -15
- package/build/testDoubles/EventMarkerOutlet/MockEventMarkerOutlet.js.map +1 -1
- package/build/testDoubles/EventMarkerOutlet/SpyEventMarkerOutlet.d.ts +2 -2
- package/build/testDoubles/EventMarkerOutlet/SpyEventMarkerOutlet.js +4 -9
- package/build/testDoubles/EventMarkerOutlet/SpyEventMarkerOutlet.js.map +1 -1
- package/build/testDoubles/EventMarkerOutlet/ThrowingEventMarkerOutlet.d.ts +2 -2
- package/build/testDoubles/EventMarkerOutlet/ThrowingEventMarkerOutlet.js +2 -5
- package/build/testDoubles/EventMarkerOutlet/ThrowingEventMarkerOutlet.js.map +1 -1
- package/build/testDoubles/Liblsl/FakeLiblsl.d.ts +4 -1
- package/build/testDoubles/Liblsl/FakeLiblsl.js +23 -15
- package/build/testDoubles/Liblsl/FakeLiblsl.js.map +1 -1
- package/build/testDoubles/StreamInfo/FakeStreamInfo.d.ts +2 -2
- package/build/testDoubles/StreamInfo/FakeStreamInfo.js +3 -6
- package/build/testDoubles/StreamInfo/FakeStreamInfo.js.map +1 -1
- package/build/testDoubles/StreamInfo/SpyStreamInfo.d.ts +2 -2
- package/build/testDoubles/StreamInfo/SpyStreamInfo.js +2 -8
- package/build/testDoubles/StreamInfo/SpyStreamInfo.js.map +1 -1
- package/build/testDoubles/StreamInlet/FakeStreamInlet.d.ts +4 -2
- package/build/testDoubles/StreamInlet/FakeStreamInlet.js +7 -5
- package/build/testDoubles/StreamInlet/FakeStreamInlet.js.map +1 -1
- package/build/testDoubles/StreamInlet/SpyStreamInlet.d.ts +3 -2
- package/build/testDoubles/StreamInlet/SpyStreamInlet.js +5 -9
- package/build/testDoubles/StreamInlet/SpyStreamInlet.js.map +1 -1
- package/build/testDoubles/StreamOutlet/FakeStreamOutlet.d.ts +3 -3
- package/build/testDoubles/StreamOutlet/FakeStreamOutlet.js +16 -21
- package/build/testDoubles/StreamOutlet/FakeStreamOutlet.js.map +1 -1
- package/build/testDoubles/StreamTransportBridge/FakeStreamTransportBridge.d.ts +1 -1
- package/build/testDoubles/StreamTransportBridge/FakeStreamTransportBridge.js +2 -5
- package/build/testDoubles/StreamTransportBridge/FakeStreamTransportBridge.js.map +1 -1
- package/build/testDoubles/consts.js +4 -7
- package/build/testDoubles/consts.js.map +1 -1
- package/build/testDoubles/generateRandomOutletOptions.d.ts +1 -1
- package/build/testDoubles/generateRandomOutletOptions.js +14 -20
- package/build/testDoubles/generateRandomOutletOptions.js.map +1 -1
- package/build/types.d.ts +8 -3
- package/build/types.js +1 -2
- package/build/validations.js +4 -10
- package/build/validations.js.map +1 -1
- package/package.json +4 -6
- package/src/__tests__/AbstractPackageTest.ts +14 -13
- package/src/__tests__/impl/LiblslAdapter.test.ts +49 -28
- package/src/__tests__/impl/LslEventMarkerOutlet.test.ts +8 -7
- package/src/__tests__/impl/LslStreamInfo.test.ts +6 -5
- package/src/__tests__/impl/LslStreamInlet.test.ts +18 -5
- package/src/__tests__/impl/LslStreamOutlet.test.ts +10 -10
- package/src/__tests__/impl/LslWebSocketBridge.test.ts +5 -3
- package/src/assertions.ts +3 -3
- package/src/impl/LiblslAdapter.ts +33 -21
- package/src/impl/LslEventMarkerOutlet.ts +5 -5
- package/src/impl/LslStreamInfo.ts +4 -3
- package/src/impl/LslStreamInlet.ts +16 -5
- package/src/impl/LslStreamOutlet.ts +7 -4
- package/src/index.ts +34 -34
- package/src/scripts/runLslEventMarkerOutlet.ts +1 -1
- package/src/scripts/runLslStreamOutlet.ts +1 -1
- package/src/testDoubles/EventMarkerOutlet/FakeEventMarkerOutlet.ts +2 -2
- package/src/testDoubles/EventMarkerOutlet/MockEventMarkerOutlet.ts +4 -3
- package/src/testDoubles/EventMarkerOutlet/SpyEventMarkerOutlet.ts +3 -3
- package/src/testDoubles/EventMarkerOutlet/ThrowingEventMarkerOutlet.ts +2 -2
- package/src/testDoubles/Liblsl/FakeLiblsl.ts +9 -1
- package/src/testDoubles/StreamInfo/FakeStreamInfo.ts +2 -2
- package/src/testDoubles/StreamInfo/SpyStreamInfo.ts +1 -1
- package/src/testDoubles/StreamInlet/FakeStreamInlet.ts +9 -2
- package/src/testDoubles/StreamInlet/SpyStreamInlet.ts +8 -2
- package/src/testDoubles/StreamOutlet/FakeStreamOutlet.ts +7 -3
- package/src/testDoubles/StreamTransportBridge/FakeStreamTransportBridge.ts +1 -1
- package/src/testDoubles/generateRandomOutletOptions.ts +3 -2
- package/src/types.ts +10 -3
- package/tsconfig.json +17 -28
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { test, assert } from '@neurodevs/node-tdd'
|
|
2
|
+
|
|
2
3
|
import LslWebSocketBridge, {
|
|
3
4
|
StreamTransportBridge,
|
|
4
|
-
} from '../../impl/LslWebSocketBridge'
|
|
5
|
+
} from '../../impl/LslWebSocketBridge.js'
|
|
6
|
+
import AbstractPackageTest from '../AbstractPackageTest.js'
|
|
5
7
|
|
|
6
|
-
export default class LslWebSocketBridgeTest extends
|
|
8
|
+
export default class LslWebSocketBridgeTest extends AbstractPackageTest {
|
|
7
9
|
private static instance: StreamTransportBridge
|
|
8
10
|
|
|
9
11
|
protected static async beforeEach() {
|
package/src/assertions.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { CHANNEL_FORMATS } from './consts'
|
|
2
|
-
import { ChannelFormat } from './types'
|
|
1
|
+
import { CHANNEL_FORMATS } from './consts.js'
|
|
2
|
+
import { ChannelFormat } from './types.js'
|
|
3
3
|
import {
|
|
4
4
|
isGreaterThanOrEqualToZero,
|
|
5
5
|
isPositiveInteger,
|
|
6
6
|
isPositiveIntegerOrZero,
|
|
7
7
|
isStringInArray,
|
|
8
|
-
} from './validations'
|
|
8
|
+
} from './validations.js'
|
|
9
9
|
|
|
10
10
|
export function assertValidChunkSize(chunkSize: number) {
|
|
11
11
|
if (!isPositiveIntegerOrZero(chunkSize)) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DataType, define, open } from 'ffi-rs'
|
|
2
|
+
|
|
2
3
|
import {
|
|
3
4
|
Liblsl,
|
|
4
5
|
LiblslBindings,
|
|
@@ -10,7 +11,8 @@ import {
|
|
|
10
11
|
PushSampleStringTimestampOptions,
|
|
11
12
|
CreateInletOptions,
|
|
12
13
|
DestroyInletOptions,
|
|
13
|
-
|
|
14
|
+
FlushInletOptions,
|
|
15
|
+
} from '../types.js'
|
|
14
16
|
|
|
15
17
|
export default class LiblslAdapter implements Liblsl {
|
|
16
18
|
public static ffiRsOpen = open
|
|
@@ -76,26 +78,6 @@ export default class LiblslAdapter implements Liblsl {
|
|
|
76
78
|
retType: DataType.External,
|
|
77
79
|
paramsType: [DataType.External, DataType.I32, DataType.I32],
|
|
78
80
|
},
|
|
79
|
-
lsl_destroy_outlet: {
|
|
80
|
-
library: 'lsl',
|
|
81
|
-
retType: DataType.Void,
|
|
82
|
-
paramsType: [DataType.External],
|
|
83
|
-
},
|
|
84
|
-
lsl_create_inlet: {
|
|
85
|
-
library: 'lsl',
|
|
86
|
-
retType: DataType.External,
|
|
87
|
-
paramsType: [DataType.External, DataType.I32, DataType.I32],
|
|
88
|
-
},
|
|
89
|
-
lsl_destroy_inlet: {
|
|
90
|
-
library: 'lsl',
|
|
91
|
-
retType: DataType.Void,
|
|
92
|
-
paramsType: [DataType.External],
|
|
93
|
-
},
|
|
94
|
-
lsl_local_clock: {
|
|
95
|
-
library: 'lsl',
|
|
96
|
-
retType: DataType.Double,
|
|
97
|
-
paramsType: [],
|
|
98
|
-
},
|
|
99
81
|
lsl_push_sample_ft: {
|
|
100
82
|
library: 'lsl',
|
|
101
83
|
retType: DataType.Void,
|
|
@@ -114,6 +96,26 @@ export default class LiblslAdapter implements Liblsl {
|
|
|
114
96
|
DataType.Double,
|
|
115
97
|
],
|
|
116
98
|
},
|
|
99
|
+
lsl_destroy_outlet: {
|
|
100
|
+
library: 'lsl',
|
|
101
|
+
retType: DataType.Void,
|
|
102
|
+
paramsType: [DataType.External],
|
|
103
|
+
},
|
|
104
|
+
lsl_create_inlet: {
|
|
105
|
+
library: 'lsl',
|
|
106
|
+
retType: DataType.External,
|
|
107
|
+
paramsType: [DataType.External, DataType.I32, DataType.I32],
|
|
108
|
+
},
|
|
109
|
+
lsl_flush_inlet: {
|
|
110
|
+
library: 'lsl',
|
|
111
|
+
retType: DataType.I32,
|
|
112
|
+
paramsType: [DataType.External],
|
|
113
|
+
},
|
|
114
|
+
lsl_destroy_inlet: {
|
|
115
|
+
library: 'lsl',
|
|
116
|
+
retType: DataType.Void,
|
|
117
|
+
paramsType: [DataType.External],
|
|
118
|
+
},
|
|
117
119
|
lsl_get_desc: {
|
|
118
120
|
library: 'lsl',
|
|
119
121
|
retType: DataType.External,
|
|
@@ -133,6 +135,11 @@ export default class LiblslAdapter implements Liblsl {
|
|
|
133
135
|
DataType.String,
|
|
134
136
|
],
|
|
135
137
|
},
|
|
138
|
+
lsl_local_clock: {
|
|
139
|
+
library: 'lsl',
|
|
140
|
+
retType: DataType.Double,
|
|
141
|
+
paramsType: [],
|
|
142
|
+
},
|
|
136
143
|
}) as unknown as LiblslBindings
|
|
137
144
|
}
|
|
138
145
|
|
|
@@ -203,6 +210,11 @@ export default class LiblslAdapter implements Liblsl {
|
|
|
203
210
|
return this.bindings.lsl_create_inlet([info, chunkSize, maxBuffered])
|
|
204
211
|
}
|
|
205
212
|
|
|
213
|
+
public flushInlet(options: FlushInletOptions) {
|
|
214
|
+
const { inlet } = options
|
|
215
|
+
this.bindings.lsl_flush_inlet([inlet])
|
|
216
|
+
}
|
|
217
|
+
|
|
206
218
|
public destroyInlet(_options: DestroyInletOptions) {}
|
|
207
219
|
|
|
208
220
|
public localClock() {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { DurationMarker } from '../types'
|
|
1
|
+
import { DurationMarker } from '../types.js'
|
|
2
2
|
import LslStreamOutlet, {
|
|
3
3
|
StreamOutletOptions,
|
|
4
4
|
StreamOutlet,
|
|
5
|
-
} from './LslStreamOutlet'
|
|
5
|
+
} from './LslStreamOutlet.js'
|
|
6
6
|
|
|
7
7
|
export default class LslEventMarkerOutlet implements EventMarkerOutlet {
|
|
8
8
|
public static Class?: EventMarkerOutletConstructor
|
|
9
9
|
|
|
10
|
-
protected
|
|
10
|
+
protected outlet: StreamOutlet
|
|
11
11
|
private isPlaying = false
|
|
12
12
|
private waitResolve?: () => void
|
|
13
13
|
private timeout?: any
|
|
14
14
|
|
|
15
15
|
protected constructor(outlet: StreamOutlet) {
|
|
16
|
-
this.
|
|
16
|
+
this.outlet = outlet
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
public static async Create(options?: Partial<StreamOutletOptions>) {
|
|
@@ -58,7 +58,7 @@ export default class LslEventMarkerOutlet implements EventMarkerOutlet {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
private pushMarkerToOutlet(markerName: string) {
|
|
61
|
-
this.
|
|
61
|
+
this.outlet.pushSample([markerName])
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
protected async wait(durationMs: number) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import generateId from '@neurodevs/generate-id'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
|
|
3
|
+
import { CHANNEL_FORMATS_MAP } from '../consts.js'
|
|
4
|
+
import { BoundStreamInfo, ChannelFormat } from '../types.js'
|
|
5
|
+
import LiblslAdapter from './LiblslAdapter.js'
|
|
5
6
|
|
|
6
7
|
export default class LslStreamInfo implements StreamInfo {
|
|
7
8
|
public static Class?: StreamInfoConstructor
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import generateId from '@neurodevs/generate-id'
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
|
|
3
|
+
import { BoundInlet, ChannelFormat } from '../types.js'
|
|
4
|
+
import LiblslAdapter from './LiblslAdapter.js'
|
|
5
|
+
import LslStreamInfo, {
|
|
6
|
+
StreamInfo,
|
|
7
|
+
StreamInfoOptions,
|
|
8
|
+
} from './LslStreamInfo.js'
|
|
5
9
|
|
|
6
10
|
export default class LslStreamInlet implements StreamInlet {
|
|
7
11
|
public static Class?: StreamInletConstructor
|
|
8
12
|
|
|
9
13
|
protected name: string
|
|
10
14
|
protected info: StreamInfo
|
|
15
|
+
protected inlet!: BoundInlet
|
|
11
16
|
private chunkSize: number
|
|
12
17
|
private maxBuffered: number
|
|
13
18
|
|
|
@@ -34,7 +39,7 @@ export default class LslStreamInlet implements StreamInlet {
|
|
|
34
39
|
}
|
|
35
40
|
|
|
36
41
|
private createStreamInlet() {
|
|
37
|
-
this.lsl.createInlet({
|
|
42
|
+
this.inlet = this.lsl.createInlet({
|
|
38
43
|
info: this.boundStreamInfo,
|
|
39
44
|
chunkSize: this.chunkSize,
|
|
40
45
|
maxBuffered: this.maxBuffered,
|
|
@@ -51,12 +56,18 @@ export default class LslStreamInlet implements StreamInlet {
|
|
|
51
56
|
|
|
52
57
|
private readonly defaultName = `lsl-inlet-${generateId()}`
|
|
53
58
|
|
|
59
|
+
public flushSamples() {
|
|
60
|
+
this.lsl.flushInlet({ inlet: this.inlet })
|
|
61
|
+
}
|
|
62
|
+
|
|
54
63
|
private static LslStreamInfo(options: StreamInfoOptions) {
|
|
55
64
|
return LslStreamInfo.Create(options)
|
|
56
65
|
}
|
|
57
66
|
}
|
|
58
67
|
|
|
59
|
-
export interface StreamInlet {
|
|
68
|
+
export interface StreamInlet {
|
|
69
|
+
flushSamples(): void
|
|
70
|
+
}
|
|
60
71
|
|
|
61
72
|
export type StreamInletConstructor = new (
|
|
62
73
|
info: StreamInfo,
|
|
@@ -4,10 +4,13 @@ import {
|
|
|
4
4
|
assertValidChunkSize,
|
|
5
5
|
assertValidMaxBuffered,
|
|
6
6
|
assertValidSampleRate,
|
|
7
|
-
} from '../assertions'
|
|
8
|
-
import { ChannelFormat, BoundOutlet, Liblsl, LslSample } from '../types'
|
|
9
|
-
import LiblslAdapter from './LiblslAdapter'
|
|
10
|
-
import LslStreamInfo, {
|
|
7
|
+
} from '../assertions.js'
|
|
8
|
+
import { ChannelFormat, BoundOutlet, Liblsl, LslSample } from '../types.js'
|
|
9
|
+
import LiblslAdapter from './LiblslAdapter.js'
|
|
10
|
+
import LslStreamInfo, {
|
|
11
|
+
StreamInfo,
|
|
12
|
+
StreamInfoOptions,
|
|
13
|
+
} from './LslStreamInfo.js'
|
|
11
14
|
|
|
12
15
|
export default class LslStreamOutlet implements StreamOutlet {
|
|
13
16
|
public static Class?: StreamOutletConstructor
|
package/src/index.ts
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
export * from './types'
|
|
1
|
+
export * from './types.js'
|
|
2
2
|
|
|
3
3
|
// EventMarkerOutlet
|
|
4
4
|
|
|
5
|
-
export { default as EventMarkerOutlet } from './impl/LslEventMarkerOutlet'
|
|
6
|
-
export * from './impl/LslEventMarkerOutlet'
|
|
5
|
+
export { default as EventMarkerOutlet } from './impl/LslEventMarkerOutlet.js'
|
|
6
|
+
export * from './impl/LslEventMarkerOutlet.js'
|
|
7
7
|
|
|
8
|
-
export { default as FakeMarkerOutlet } from './testDoubles/EventMarkerOutlet/FakeEventMarkerOutlet'
|
|
9
|
-
export * from './testDoubles/EventMarkerOutlet/FakeEventMarkerOutlet'
|
|
8
|
+
export { default as FakeMarkerOutlet } from './testDoubles/EventMarkerOutlet/FakeEventMarkerOutlet.js'
|
|
9
|
+
export * from './testDoubles/EventMarkerOutlet/FakeEventMarkerOutlet.js'
|
|
10
10
|
|
|
11
|
-
export { default as MockMarkerOutlet } from './testDoubles/EventMarkerOutlet/MockEventMarkerOutlet'
|
|
12
|
-
export * from './testDoubles/EventMarkerOutlet/MockEventMarkerOutlet'
|
|
11
|
+
export { default as MockMarkerOutlet } from './testDoubles/EventMarkerOutlet/MockEventMarkerOutlet.js'
|
|
12
|
+
export * from './testDoubles/EventMarkerOutlet/MockEventMarkerOutlet.js'
|
|
13
13
|
|
|
14
|
-
export { default as SpyMarkerOutlet } from './testDoubles/EventMarkerOutlet/SpyEventMarkerOutlet'
|
|
15
|
-
export * from './testDoubles/EventMarkerOutlet/SpyEventMarkerOutlet'
|
|
14
|
+
export { default as SpyMarkerOutlet } from './testDoubles/EventMarkerOutlet/SpyEventMarkerOutlet.js'
|
|
15
|
+
export * from './testDoubles/EventMarkerOutlet/SpyEventMarkerOutlet.js'
|
|
16
16
|
|
|
17
|
-
export { default as ThrowingMarkerOutlet } from './testDoubles/EventMarkerOutlet/ThrowingEventMarkerOutlet'
|
|
18
|
-
export * from './testDoubles/EventMarkerOutlet/ThrowingEventMarkerOutlet'
|
|
17
|
+
export { default as ThrowingMarkerOutlet } from './testDoubles/EventMarkerOutlet/ThrowingEventMarkerOutlet.js'
|
|
18
|
+
export * from './testDoubles/EventMarkerOutlet/ThrowingEventMarkerOutlet.js'
|
|
19
19
|
|
|
20
20
|
// Liblsl
|
|
21
21
|
|
|
22
|
-
export { default as LiblslAdapter } from './impl/LiblslAdapter'
|
|
23
|
-
export * from './impl/LiblslAdapter'
|
|
22
|
+
export { default as LiblslAdapter } from './impl/LiblslAdapter.js'
|
|
23
|
+
export * from './impl/LiblslAdapter.js'
|
|
24
24
|
|
|
25
|
-
export { default as FakeLiblsl } from './testDoubles/Liblsl/FakeLiblsl'
|
|
26
|
-
export * from './testDoubles/Liblsl/FakeLiblsl'
|
|
25
|
+
export { default as FakeLiblsl } from './testDoubles/Liblsl/FakeLiblsl.js'
|
|
26
|
+
export * from './testDoubles/Liblsl/FakeLiblsl.js'
|
|
27
27
|
|
|
28
28
|
// StreamInfo
|
|
29
29
|
|
|
30
|
-
export { default as LslStreamInfo } from './impl/LslStreamInfo'
|
|
31
|
-
export * from './impl/LslStreamInfo'
|
|
30
|
+
export { default as LslStreamInfo } from './impl/LslStreamInfo.js'
|
|
31
|
+
export * from './impl/LslStreamInfo.js'
|
|
32
32
|
|
|
33
|
-
export { default as SpyStreamInfo } from './testDoubles/StreamInfo/SpyStreamInfo'
|
|
34
|
-
export * from './testDoubles/StreamInfo/SpyStreamInfo'
|
|
33
|
+
export { default as SpyStreamInfo } from './testDoubles/StreamInfo/SpyStreamInfo.js'
|
|
34
|
+
export * from './testDoubles/StreamInfo/SpyStreamInfo.js'
|
|
35
35
|
|
|
36
|
-
export { default as FakeStreamInfo } from './testDoubles/StreamInfo/FakeStreamInfo'
|
|
37
|
-
export * from './testDoubles/StreamInfo/FakeStreamInfo'
|
|
36
|
+
export { default as FakeStreamInfo } from './testDoubles/StreamInfo/FakeStreamInfo.js'
|
|
37
|
+
export * from './testDoubles/StreamInfo/FakeStreamInfo.js'
|
|
38
38
|
|
|
39
39
|
// StreamInlet
|
|
40
40
|
|
|
41
|
-
export { default as LslStreamInlet } from './impl/LslStreamInlet'
|
|
42
|
-
export * from './impl/LslStreamInlet'
|
|
41
|
+
export { default as LslStreamInlet } from './impl/LslStreamInlet.js'
|
|
42
|
+
export * from './impl/LslStreamInlet.js'
|
|
43
43
|
|
|
44
|
-
export { default as FakeStreamInlet } from './testDoubles/StreamInlet/FakeStreamInlet'
|
|
45
|
-
export * from './testDoubles/StreamInlet/FakeStreamInlet'
|
|
44
|
+
export { default as FakeStreamInlet } from './testDoubles/StreamInlet/FakeStreamInlet.js'
|
|
45
|
+
export * from './testDoubles/StreamInlet/FakeStreamInlet.js'
|
|
46
46
|
|
|
47
47
|
// StreamOutlet
|
|
48
48
|
|
|
49
|
-
export { default as LslStreamOutlet } from './impl/LslStreamOutlet'
|
|
50
|
-
export * from './impl/LslStreamOutlet'
|
|
49
|
+
export { default as LslStreamOutlet } from './impl/LslStreamOutlet.js'
|
|
50
|
+
export * from './impl/LslStreamOutlet.js'
|
|
51
51
|
|
|
52
|
-
export { default as FakeStreamOutlet } from './testDoubles/StreamOutlet/FakeStreamOutlet'
|
|
53
|
-
export * from './testDoubles/StreamOutlet/FakeStreamOutlet'
|
|
52
|
+
export { default as FakeStreamOutlet } from './testDoubles/StreamOutlet/FakeStreamOutlet.js'
|
|
53
|
+
export * from './testDoubles/StreamOutlet/FakeStreamOutlet.js'
|
|
54
54
|
|
|
55
55
|
// StreamTransportBridge
|
|
56
56
|
|
|
57
|
-
export { default as LslWebSocketBridge } from './impl/LslWebSocketBridge'
|
|
58
|
-
export * from './impl/LslWebSocketBridge'
|
|
57
|
+
export { default as LslWebSocketBridge } from './impl/LslWebSocketBridge.js'
|
|
58
|
+
export * from './impl/LslWebSocketBridge.js'
|
|
59
59
|
|
|
60
|
-
export { default as FakeStreamTransportBridge } from './testDoubles/StreamTransportBridge/FakeStreamTransportBridge'
|
|
61
|
-
export * from './testDoubles/StreamTransportBridge/FakeStreamTransportBridge'
|
|
60
|
+
export { default as FakeStreamTransportBridge } from './testDoubles/StreamTransportBridge/FakeStreamTransportBridge.js'
|
|
61
|
+
export * from './testDoubles/StreamTransportBridge/FakeStreamTransportBridge.js'
|
|
62
62
|
|
|
63
63
|
// Utils
|
|
64
64
|
|
|
65
|
-
export { default as generateRandomOutletOptions } from './testDoubles/generateRandomOutletOptions'
|
|
65
|
+
export { default as generateRandomOutletOptions } from './testDoubles/generateRandomOutletOptions.js'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EventMarkerOutlet } from '../../impl/LslEventMarkerOutlet'
|
|
2
|
-
import { DurationMarker } from '../../types'
|
|
1
|
+
import { EventMarkerOutlet } from '../../impl/LslEventMarkerOutlet.js'
|
|
2
|
+
import { DurationMarker } from '../../types.js'
|
|
3
3
|
|
|
4
4
|
export default class FakeEventMarkerOutlet implements EventMarkerOutlet {
|
|
5
5
|
public static callsToPushMarker: string[] = []
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { assert } from '@
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
import { assert } from '@neurodevs/node-tdd'
|
|
2
|
+
|
|
3
|
+
import { EventMarkerOutlet } from '../../impl/LslEventMarkerOutlet.js'
|
|
4
|
+
import { DurationMarker, LslSample } from '../../types.js'
|
|
4
5
|
|
|
5
6
|
export default class MockEventMarkerOutlet implements EventMarkerOutlet {
|
|
6
7
|
private didPushMarkers = false
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import LslEventMarkerOutlet from '../../impl/LslEventMarkerOutlet'
|
|
2
|
-
import { StreamOutlet } from '../../impl/LslStreamOutlet'
|
|
1
|
+
import LslEventMarkerOutlet from '../../impl/LslEventMarkerOutlet.js'
|
|
2
|
+
import { StreamOutlet } from '../../impl/LslStreamOutlet.js'
|
|
3
3
|
|
|
4
4
|
export default class SpyEventMarkerOutlet extends LslEventMarkerOutlet {
|
|
5
5
|
public totalWaitTimeMs: number
|
|
@@ -15,7 +15,7 @@ export default class SpyEventMarkerOutlet extends LslEventMarkerOutlet {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
public getStreamOutlet() {
|
|
18
|
-
return this.
|
|
18
|
+
return this.outlet
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
public resetTestDouble() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EventMarkerOutlet } from '../../impl/LslEventMarkerOutlet'
|
|
2
|
-
import { DurationMarker } from '../../types'
|
|
1
|
+
import { EventMarkerOutlet } from '../../impl/LslEventMarkerOutlet.js'
|
|
2
|
+
import { DurationMarker } from '../../types.js'
|
|
3
3
|
|
|
4
4
|
export default class ThrowingEventMarkerOutlet implements EventMarkerOutlet {
|
|
5
5
|
private errorMsg = 'Intentional throwing: '
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
CreateInletOptions,
|
|
11
11
|
DestroyInletOptions,
|
|
12
12
|
BoundInlet,
|
|
13
|
-
|
|
13
|
+
FlushInletOptions,
|
|
14
|
+
} from '../../types.js'
|
|
14
15
|
|
|
15
16
|
export default class FakeLiblsl implements Liblsl {
|
|
16
17
|
public outlet: BoundOutlet = {} as BoundOutlet
|
|
@@ -22,12 +23,14 @@ export default class FakeLiblsl implements Liblsl {
|
|
|
22
23
|
public lastPushSampleFloatTimestampOptions?: PushSampleFloatTimestampOptions
|
|
23
24
|
public lastPushSampleStringTimestampOptions?: PushSampleStringTimestampOptions
|
|
24
25
|
public lastCreateInletOptions?: CreateInletOptions
|
|
26
|
+
public lastFlushInletOptions?: FlushInletOptions
|
|
25
27
|
public lastDestroyInletOptions?: DestroyInletOptions
|
|
26
28
|
|
|
27
29
|
public createStreamInfoHitCount = 0
|
|
28
30
|
public createOutletHitCount = 0
|
|
29
31
|
public destroyOutletHitCount = 0
|
|
30
32
|
public createInletHitCount = 0
|
|
33
|
+
public flushInletHitCount = 0
|
|
31
34
|
public destroyInletHitCount = 0
|
|
32
35
|
public localClockHitCount = 0
|
|
33
36
|
public pushSampleStringTimestampHitCount = 0
|
|
@@ -71,6 +74,11 @@ export default class FakeLiblsl implements Liblsl {
|
|
|
71
74
|
return {} as BoundInlet
|
|
72
75
|
}
|
|
73
76
|
|
|
77
|
+
public flushInlet(options: FlushInletOptions) {
|
|
78
|
+
this.flushInletHitCount++
|
|
79
|
+
this.lastFlushInletOptions = options
|
|
80
|
+
}
|
|
81
|
+
|
|
74
82
|
public destroyInlet(options: DestroyInletOptions) {
|
|
75
83
|
this.destroyInletHitCount++
|
|
76
84
|
this.lastDestroyInletOptions = options
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StreamInfo, StreamInfoOptions } from '../../impl/LslStreamInfo'
|
|
2
|
-
import { BoundStreamInfo } from '../../types'
|
|
1
|
+
import { StreamInfo, StreamInfoOptions } from '../../impl/LslStreamInfo.js'
|
|
2
|
+
import { BoundStreamInfo } from '../../types.js'
|
|
3
3
|
|
|
4
4
|
export default class FakeStreamInfo implements StreamInfo {
|
|
5
5
|
public static callsToConstructor: StreamInfoOptions[] = []
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StreamInfo } from '../../impl/LslStreamInfo'
|
|
2
|
-
import { StreamInlet, StreamInletOptions } from '../../impl/LslStreamInlet'
|
|
1
|
+
import { StreamInfo } from '../../impl/LslStreamInfo.js'
|
|
2
|
+
import { StreamInlet, StreamInletOptions } from '../../impl/LslStreamInlet.js'
|
|
3
3
|
|
|
4
4
|
export default class FakeStreamInlet implements StreamInlet {
|
|
5
5
|
public static callsToConstructor: {
|
|
@@ -7,6 +7,8 @@ export default class FakeStreamInlet implements StreamInlet {
|
|
|
7
7
|
options?: StreamInletOptions
|
|
8
8
|
}[] = []
|
|
9
9
|
|
|
10
|
+
public static numCallsToFlushSamples = 0
|
|
11
|
+
|
|
10
12
|
public constructor(info?: StreamInfo, options?: StreamInletOptions) {
|
|
11
13
|
FakeStreamInlet.callsToConstructor.push({
|
|
12
14
|
info,
|
|
@@ -14,7 +16,12 @@ export default class FakeStreamInlet implements StreamInlet {
|
|
|
14
16
|
})
|
|
15
17
|
}
|
|
16
18
|
|
|
19
|
+
public flushSamples() {
|
|
20
|
+
FakeStreamInlet.numCallsToFlushSamples++
|
|
21
|
+
}
|
|
22
|
+
|
|
17
23
|
public static resetTestDouble() {
|
|
18
24
|
FakeStreamInlet.callsToConstructor = []
|
|
25
|
+
FakeStreamInlet.numCallsToFlushSamples = 0
|
|
19
26
|
}
|
|
20
27
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { StreamInfo } from '../../impl/LslStreamInfo'
|
|
2
|
-
import LslStreamInlet, {
|
|
1
|
+
import { StreamInfo } from '../../impl/LslStreamInfo.js'
|
|
2
|
+
import LslStreamInlet, {
|
|
3
|
+
StreamInletOptions,
|
|
4
|
+
} from '../../impl/LslStreamInlet.js'
|
|
3
5
|
|
|
4
6
|
export class SpyStreamInlet extends LslStreamInlet {
|
|
5
7
|
public constructor(info: StreamInfo, options: StreamInletOptions) {
|
|
@@ -13,4 +15,8 @@ export class SpyStreamInlet extends LslStreamInlet {
|
|
|
13
15
|
public getStreamInfo() {
|
|
14
16
|
return this.info
|
|
15
17
|
}
|
|
18
|
+
|
|
19
|
+
public getBoundInlet() {
|
|
20
|
+
return this.inlet
|
|
21
|
+
}
|
|
16
22
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { randomInt } from 'crypto'
|
|
2
2
|
import generateId from '@neurodevs/generate-id'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
|
|
4
|
+
import { StreamInfo } from '../../impl/LslStreamInfo.js'
|
|
5
|
+
import {
|
|
6
|
+
StreamOutlet,
|
|
7
|
+
StreamOutletOptions,
|
|
8
|
+
} from '../../impl/LslStreamOutlet.js'
|
|
9
|
+
import { LslSample } from '../../types.js'
|
|
6
10
|
|
|
7
11
|
export default class FakeStreamOutlet implements StreamOutlet {
|
|
8
12
|
public static callsToConstructor: {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { randomInt } from 'crypto'
|
|
2
2
|
import generateId from '@neurodevs/generate-id'
|
|
3
|
-
|
|
4
|
-
import {
|
|
3
|
+
|
|
4
|
+
import { StreamOutletOptions } from '../impl/LslStreamOutlet.js'
|
|
5
|
+
import { TEST_SUPPORTED_CHANNEL_FORMATS } from './consts.js'
|
|
5
6
|
|
|
6
7
|
export default function generateRandomOutletOptions() {
|
|
7
8
|
const randomChannelIdx = randomInt(TEST_SUPPORTED_CHANNEL_FORMATS.length)
|
package/src/types.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { FuncObj, FieldType } from 'ffi-rs'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
|
|
3
|
+
import { CHANNEL_FORMATS } from './consts.js'
|
|
4
|
+
import { StreamInlet } from './impl/LslStreamInlet.js'
|
|
5
|
+
import { StreamOutlet } from './impl/LslStreamOutlet.js'
|
|
5
6
|
|
|
6
7
|
export type StreamFixuture = StreamOutlet | StreamInlet
|
|
7
8
|
|
|
@@ -20,6 +21,7 @@ export interface Liblsl {
|
|
|
20
21
|
pushSampleStringTimestamp(options: PushSampleStringTimestampOptions): void
|
|
21
22
|
destroyOutlet(options: DestroyOutletOptions): void
|
|
22
23
|
createInlet(options: CreateInletOptions): BoundInlet
|
|
24
|
+
flushInlet(options: FlushInletOptions): void
|
|
23
25
|
destroyInlet(options: DestroyInletOptions): void
|
|
24
26
|
localClock(): number
|
|
25
27
|
}
|
|
@@ -76,6 +78,10 @@ export interface CreateInletOptions {
|
|
|
76
78
|
maxBuffered: number
|
|
77
79
|
}
|
|
78
80
|
|
|
81
|
+
export interface FlushInletOptions {
|
|
82
|
+
inlet: BoundInlet
|
|
83
|
+
}
|
|
84
|
+
|
|
79
85
|
export interface DestroyInletOptions {}
|
|
80
86
|
|
|
81
87
|
export interface LiblslBindings {
|
|
@@ -88,6 +94,7 @@ export interface LiblslBindings {
|
|
|
88
94
|
lsl_push_sample_strt(args: [BoundOutlet, LslSample, number]): void
|
|
89
95
|
lsl_destroy_outlet(args: [BoundOutlet]): void
|
|
90
96
|
lsl_create_inlet(args: any): BoundInlet
|
|
97
|
+
lsl_flush_inlet(args: [BoundInlet]): void
|
|
91
98
|
lsl_destroy_inlet(args: any): void
|
|
92
99
|
lsl_local_clock(args: []): number
|
|
93
100
|
lsl_get_desc(args: [BoundStreamInfo]): BoundDescription
|
package/tsconfig.json
CHANGED
|
@@ -1,39 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
3
|
+
"module": "nodenext",
|
|
4
|
+
"moduleResolution": "nodenext",
|
|
5
|
+
"target": "ES2022",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"baseUrl": "src",
|
|
9
|
+
"outDir": "build",
|
|
10
|
+
"sourceMap": false,
|
|
11
|
+
"strict": true,
|
|
12
12
|
"noImplicitAny": true,
|
|
13
|
-
"allowJs": true,
|
|
14
|
-
"forceConsistentCasingInFileNames": true,
|
|
15
13
|
"noImplicitReturns": true,
|
|
16
|
-
"strict": true,
|
|
17
14
|
"noUnusedLocals": true,
|
|
15
|
+
"forceConsistentCasingInFileNames": true,
|
|
16
|
+
"declaration": true,
|
|
17
|
+
"skipLibCheck": true,
|
|
18
|
+
"esModuleInterop": true,
|
|
19
|
+
"moduleDetection": "force",
|
|
20
|
+
"allowJs": true,
|
|
18
21
|
"resolveJsonModule": true,
|
|
19
|
-
"
|
|
20
|
-
"sourceMap": false,
|
|
21
|
-
"outDir": "build",
|
|
22
|
-
"baseUrl": "src",
|
|
23
|
-
"experimentalDecorators": true,
|
|
24
|
-
"paths": {
|
|
25
|
-
"#spruce/*": [
|
|
26
|
-
".spruce/*"
|
|
27
|
-
]
|
|
28
|
-
}
|
|
22
|
+
"experimentalDecorators": true
|
|
29
23
|
},
|
|
30
24
|
"include": [
|
|
31
25
|
"./src/*.ts",
|
|
32
|
-
"./src/**/*.ts"
|
|
33
|
-
"./src/.spruce/**/*"
|
|
34
|
-
],
|
|
35
|
-
"exclude": [
|
|
36
|
-
"build",
|
|
37
|
-
"esm"
|
|
26
|
+
"./src/**/*.ts"
|
|
38
27
|
]
|
|
39
28
|
}
|