@neurosity/sdk 6.5.9 → 6.5.11

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 (130) hide show
  1. package/dist/browser/neurosity.iife.js +2419 -1009
  2. package/dist/browser/neurosity.js +180 -148
  3. package/dist/browser/neurosity.js.map +1 -1
  4. package/dist/cjs/__tests__/Neurosity.test.d.ts +1 -0
  5. package/dist/cjs/__tests__/Neurosity.test.js +201 -0
  6. package/dist/cjs/__tests__/WebBluetoothTransport.test.d.ts +1 -0
  7. package/dist/cjs/__tests__/WebBluetoothTransport.test.js +201 -0
  8. package/dist/cjs/__tests__/accelerometer.test.d.ts +1 -0
  9. package/dist/cjs/__tests__/accelerometer.test.js +158 -0
  10. package/dist/cjs/__tests__/auth.test.d.ts +1 -0
  11. package/dist/cjs/__tests__/auth.test.js +239 -0
  12. package/dist/cjs/__tests__/brainwaves.test.d.ts +1 -0
  13. package/dist/cjs/__tests__/brainwaves.test.js +291 -0
  14. package/dist/cjs/__tests__/device.test.d.ts +1 -0
  15. package/dist/cjs/__tests__/device.test.js +281 -0
  16. package/dist/cjs/__tests__/haptics.test.d.ts +1 -0
  17. package/dist/cjs/__tests__/haptics.test.js +162 -0
  18. package/dist/cjs/__tests__/metrics.test.d.ts +1 -0
  19. package/dist/cjs/__tests__/metrics.test.js +178 -0
  20. package/dist/cjs/__tests__/oauth.test.d.ts +1 -0
  21. package/dist/cjs/__tests__/oauth.test.js +138 -0
  22. package/dist/cjs/__tests__/settings.test.d.ts +1 -0
  23. package/dist/cjs/__tests__/settings.test.js +130 -0
  24. package/dist/cjs/__tests__/setup/webBluetooth.setup.d.ts +11 -0
  25. package/dist/cjs/__tests__/setup/webBluetooth.setup.js +35 -0
  26. package/dist/cjs/__tests__/setup.d.ts +0 -0
  27. package/dist/cjs/__tests__/setup.js +7 -0
  28. package/dist/cjs/__tests__/streaming.test.d.ts +1 -0
  29. package/dist/cjs/__tests__/streaming.test.js +259 -0
  30. package/dist/cjs/__tests__/timesync.test.d.ts +1 -0
  31. package/dist/cjs/__tests__/timesync.test.js +54 -0
  32. package/dist/cjs/__tests__/utils.test.d.ts +1 -0
  33. package/dist/cjs/__tests__/utils.test.js +281 -0
  34. package/dist/cjs/api/bluetooth/BluetoothClient.d.ts +6 -6
  35. package/dist/cjs/api/bluetooth/BluetoothTransport.d.ts +1 -1
  36. package/dist/cjs/api/bluetooth/react-native/ReactNativeTransport.d.ts +4 -4
  37. package/dist/cjs/api/bluetooth/react-native/types/ReactNativeTypes.d.ts +2 -2
  38. package/dist/cjs/api/bluetooth/types/index.d.ts +2 -2
  39. package/dist/cjs/api/bluetooth/utils/decodeJSONChunks.d.ts +1 -1
  40. package/dist/cjs/api/bluetooth/utils/stitch.d.ts +1 -1
  41. package/dist/cjs/api/bluetooth/utils/textCodec.d.ts +1 -1
  42. package/dist/cjs/api/bluetooth/web/WebBluetoothTransport.d.ts +1 -1
  43. package/dist/cjs/api/firebase/FirebaseDevice.d.ts +1 -1
  44. package/dist/cjs/api/firebase/FirebaseUser.d.ts +1 -1
  45. package/dist/cjs/api/index.js +1 -1
  46. package/dist/cjs/timesync/Timesync.d.ts +1 -1
  47. package/dist/cjs/types/awareness.d.ts +1 -1
  48. package/dist/cjs/types/brainwaves.d.ts +25 -12
  49. package/dist/cjs/types/credentials.d.ts +4 -4
  50. package/dist/cjs/types/deviceInfo.d.ts +4 -4
  51. package/dist/cjs/types/epoch.d.ts +1 -1
  52. package/dist/cjs/types/experiment.d.ts +1 -1
  53. package/dist/cjs/types/hapticEffects.d.ts +1 -1
  54. package/dist/cjs/types/marker.d.ts +1 -1
  55. package/dist/cjs/types/metrics.d.ts +2 -2
  56. package/dist/cjs/types/oauth.d.ts +4 -4
  57. package/dist/cjs/types/sample.d.ts +2 -2
  58. package/dist/cjs/types/signalQuality.d.ts +1 -1
  59. package/dist/cjs/types/skill.d.ts +2 -2
  60. package/dist/cjs/types/user.d.ts +3 -3
  61. package/dist/cjs/utils/oauth.d.ts +1 -1
  62. package/dist/cjs/utils/transferDevice.d.ts +3 -3
  63. package/dist/cjs/utils/whileOnline.d.ts +1 -1
  64. package/dist/electron/index.js +1 -1
  65. package/dist/electron/index.js.map +1 -1
  66. package/dist/esm/__tests__/Neurosity.test.d.ts +1 -0
  67. package/dist/esm/__tests__/Neurosity.test.js +199 -0
  68. package/dist/esm/__tests__/WebBluetoothTransport.test.d.ts +1 -0
  69. package/dist/esm/__tests__/WebBluetoothTransport.test.js +199 -0
  70. package/dist/esm/__tests__/accelerometer.test.d.ts +1 -0
  71. package/dist/esm/__tests__/accelerometer.test.js +156 -0
  72. package/dist/esm/__tests__/auth.test.d.ts +1 -0
  73. package/dist/esm/__tests__/auth.test.js +237 -0
  74. package/dist/esm/__tests__/brainwaves.test.d.ts +1 -0
  75. package/dist/esm/__tests__/brainwaves.test.js +289 -0
  76. package/dist/esm/__tests__/device.test.d.ts +1 -0
  77. package/dist/esm/__tests__/device.test.js +279 -0
  78. package/dist/esm/__tests__/haptics.test.d.ts +1 -0
  79. package/dist/esm/__tests__/haptics.test.js +160 -0
  80. package/dist/esm/__tests__/metrics.test.d.ts +1 -0
  81. package/dist/esm/__tests__/metrics.test.js +176 -0
  82. package/dist/esm/__tests__/oauth.test.d.ts +1 -0
  83. package/dist/esm/__tests__/oauth.test.js +133 -0
  84. package/dist/esm/__tests__/settings.test.d.ts +1 -0
  85. package/dist/esm/__tests__/settings.test.js +128 -0
  86. package/dist/esm/__tests__/setup/webBluetooth.setup.d.ts +11 -0
  87. package/dist/esm/__tests__/setup/webBluetooth.setup.js +35 -0
  88. package/dist/esm/__tests__/setup.d.ts +0 -0
  89. package/dist/esm/__tests__/setup.js +7 -0
  90. package/dist/esm/__tests__/streaming.test.d.ts +1 -0
  91. package/dist/esm/__tests__/streaming.test.js +257 -0
  92. package/dist/esm/__tests__/timesync.test.d.ts +1 -0
  93. package/dist/esm/__tests__/timesync.test.js +52 -0
  94. package/dist/esm/__tests__/utils.test.d.ts +1 -0
  95. package/dist/esm/__tests__/utils.test.js +279 -0
  96. package/dist/esm/api/bluetooth/BluetoothClient.d.ts +6 -6
  97. package/dist/esm/api/bluetooth/BluetoothTransport.d.ts +1 -1
  98. package/dist/esm/api/bluetooth/react-native/ReactNativeTransport.d.ts +4 -4
  99. package/dist/esm/api/bluetooth/react-native/types/ReactNativeTypes.d.ts +2 -2
  100. package/dist/esm/api/bluetooth/types/index.d.ts +2 -2
  101. package/dist/esm/api/bluetooth/utils/decodeJSONChunks.d.ts +1 -1
  102. package/dist/esm/api/bluetooth/utils/stitch.d.ts +1 -1
  103. package/dist/esm/api/bluetooth/utils/textCodec.d.ts +1 -1
  104. package/dist/esm/api/bluetooth/web/WebBluetoothTransport.d.ts +1 -1
  105. package/dist/esm/api/firebase/FirebaseDevice.d.ts +1 -1
  106. package/dist/esm/api/firebase/FirebaseUser.d.ts +1 -1
  107. package/dist/esm/api/index.js +2 -2
  108. package/dist/esm/neurosity.mjs +2480 -1007
  109. package/dist/esm/timesync/Timesync.d.ts +1 -1
  110. package/dist/esm/types/awareness.d.ts +1 -1
  111. package/dist/esm/types/brainwaves.d.ts +25 -12
  112. package/dist/esm/types/credentials.d.ts +4 -4
  113. package/dist/esm/types/deviceInfo.d.ts +4 -4
  114. package/dist/esm/types/epoch.d.ts +1 -1
  115. package/dist/esm/types/experiment.d.ts +1 -1
  116. package/dist/esm/types/hapticEffects.d.ts +1 -1
  117. package/dist/esm/types/marker.d.ts +1 -1
  118. package/dist/esm/types/metrics.d.ts +2 -2
  119. package/dist/esm/types/oauth.d.ts +4 -4
  120. package/dist/esm/types/sample.d.ts +2 -2
  121. package/dist/esm/types/signalQuality.d.ts +1 -1
  122. package/dist/esm/types/skill.d.ts +2 -2
  123. package/dist/esm/types/user.d.ts +3 -3
  124. package/dist/esm/utils/oauth.d.ts +1 -1
  125. package/dist/esm/utils/transferDevice.d.ts +3 -3
  126. package/dist/esm/utils/whileOnline.d.ts +1 -1
  127. package/dist/examples/neurosity.iife.js +2419 -1009
  128. package/dist/examples/neurosity.js +180 -148
  129. package/dist/examples/neurosity.mjs +2480 -1007
  130. package/package.json +17 -5
@@ -0,0 +1,281 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const create6DigitPin_1 = require("../api/bluetooth/utils/create6DigitPin");
4
+ const decodeJSONChunks_1 = require("../api/bluetooth/utils/decodeJSONChunks");
5
+ const stitch_1 = require("../api/bluetooth/utils/stitch");
6
+ const textCodec_1 = require("../api/bluetooth/utils/textCodec");
7
+ const types_1 = require("../api/bluetooth/types");
8
+ const rxjs_1 = require("rxjs");
9
+ const operators_1 = require("rxjs/operators");
10
+ describe("Bluetooth Utils", () => {
11
+ describe("create6DigitPin", () => {
12
+ it("should create a 6-digit pin", () => {
13
+ const pin = (0, create6DigitPin_1.create6DigitPin)();
14
+ expect(pin.toString()).toMatch(/^\d{6}$/);
15
+ });
16
+ });
17
+ describe("decodeJSONChunks", () => {
18
+ let textCodec;
19
+ let addLog;
20
+ beforeEach(() => {
21
+ textCodec = new textCodec_1.TextCodec(types_1.TRANSPORT_TYPE.WEB);
22
+ addLog = jest.fn();
23
+ });
24
+ it("should decode complete JSON chunks", (done) => {
25
+ const chunks = [
26
+ new Uint8Array(textCodec.encode('{"id":1,"name":"test"}\n')),
27
+ new Uint8Array(textCodec.encode('{"id":2,"name":"test2"}\n'))
28
+ ];
29
+ (0, rxjs_1.of)(...chunks)
30
+ .pipe((0, decodeJSONChunks_1.decodeJSONChunks)({
31
+ textCodec,
32
+ characteristicName: "test",
33
+ delimiter: "\n",
34
+ addLog
35
+ }), (0, operators_1.toArray)())
36
+ .subscribe((result) => {
37
+ expect(result).toEqual([
38
+ { id: 1, name: "test" },
39
+ { id: 2, name: "test2" }
40
+ ]);
41
+ done();
42
+ });
43
+ });
44
+ it("should handle invalid JSON", (done) => {
45
+ const chunks = [
46
+ new Uint8Array(textCodec.encode('{"id":1\n')),
47
+ new Uint8Array(textCodec.encode("invalid json\n"))
48
+ ];
49
+ (0, rxjs_1.of)(...chunks)
50
+ .pipe((0, decodeJSONChunks_1.decodeJSONChunks)({
51
+ textCodec,
52
+ characteristicName: "test",
53
+ delimiter: "\n",
54
+ addLog
55
+ }), (0, operators_1.toArray)())
56
+ .subscribe((result) => {
57
+ expect(result).toEqual(['{"id":1', "invalid json"]);
58
+ done();
59
+ });
60
+ });
61
+ it("should handle empty chunks", (done) => {
62
+ const chunks = [
63
+ new Uint8Array(textCodec.encode("\n")),
64
+ new Uint8Array(textCodec.encode("\n"))
65
+ ];
66
+ (0, rxjs_1.of)(...chunks)
67
+ .pipe((0, decodeJSONChunks_1.decodeJSONChunks)({
68
+ textCodec,
69
+ characteristicName: "test",
70
+ delimiter: "\n",
71
+ addLog
72
+ }), (0, operators_1.toArray)())
73
+ .subscribe((result) => {
74
+ expect(result).toEqual([]);
75
+ done();
76
+ });
77
+ });
78
+ it("should handle chunks without delimiters", (done) => {
79
+ const chunks = [
80
+ new Uint8Array(textCodec.encode('{"id":1}')),
81
+ new Uint8Array(textCodec.encode('{"id":2}'))
82
+ ];
83
+ (0, rxjs_1.of)(...chunks)
84
+ .pipe((0, decodeJSONChunks_1.decodeJSONChunks)({
85
+ textCodec,
86
+ characteristicName: "test",
87
+ delimiter: "\n",
88
+ addLog
89
+ }), (0, operators_1.toArray)())
90
+ .subscribe((result) => {
91
+ expect(result).toEqual([]);
92
+ done();
93
+ });
94
+ });
95
+ it("should handle invalid JSON with custom error", (done) => {
96
+ const chunks = [
97
+ new Uint8Array(textCodec.encode('{"id":1\n')),
98
+ new Uint8Array(textCodec.encode("invalid json\n"))
99
+ ];
100
+ // Mock error without message property
101
+ const originalJSONParse = JSON.parse;
102
+ JSON.parse = jest.fn().mockImplementation(() => {
103
+ const error = Object.create(Error.prototype);
104
+ throw error;
105
+ });
106
+ (0, rxjs_1.of)(...chunks)
107
+ .pipe((0, decodeJSONChunks_1.decodeJSONChunks)({
108
+ textCodec,
109
+ characteristicName: "test",
110
+ delimiter: "\n",
111
+ addLog
112
+ }), (0, operators_1.toArray)())
113
+ .subscribe({
114
+ next: (result) => {
115
+ expect(result).toEqual(['{"id":1', "invalid json"]);
116
+ JSON.parse = originalJSONParse;
117
+ done();
118
+ },
119
+ error: (error) => {
120
+ JSON.parse = originalJSONParse;
121
+ done(error);
122
+ }
123
+ });
124
+ });
125
+ });
126
+ describe("stitch", () => {
127
+ it("should stitch complete chunks", (done) => {
128
+ const chunks = ['{"id":1}\n', '{"id":2}\n'];
129
+ (0, rxjs_1.of)(...chunks)
130
+ .pipe((0, stitch_1.stitchChunks)({ delimiter: "\n" }), (0, operators_1.toArray)())
131
+ .subscribe({
132
+ next: (result) => {
133
+ expect(result).toEqual(['{"id":1}', '{"id":2}']);
134
+ done();
135
+ },
136
+ error: (error) => {
137
+ done(error);
138
+ }
139
+ });
140
+ });
141
+ it("should stitch incomplete chunks", (done) => {
142
+ const chunks = ['{"id":', "1}\n", '{"id":2', "}\n"];
143
+ (0, rxjs_1.of)(...chunks)
144
+ .pipe((0, stitch_1.stitchChunks)({ delimiter: "\n" }), (0, operators_1.toArray)())
145
+ .subscribe({
146
+ next: (result) => {
147
+ expect(result).toEqual(['{"id":1}', '{"id":2}']);
148
+ done();
149
+ },
150
+ error: (error) => {
151
+ done(error);
152
+ }
153
+ });
154
+ });
155
+ it("should handle chunks with multiple delimiters", (done) => {
156
+ const chunks = ['{"id":1}\n', '{"id":2}\n', '{"id":3}\n'];
157
+ (0, rxjs_1.of)(...chunks)
158
+ .pipe((0, stitch_1.stitchChunks)({ delimiter: "\n" }), (0, operators_1.toArray)())
159
+ .subscribe({
160
+ next: (result) => {
161
+ expect(result).toEqual(['{"id":1}', '{"id":2}', '{"id":3}']);
162
+ done();
163
+ },
164
+ error: (error) => {
165
+ done(error);
166
+ }
167
+ });
168
+ });
169
+ it("should handle empty chunks", (done) => {
170
+ (0, rxjs_1.of)()
171
+ .pipe((0, stitch_1.stitchChunks)({ delimiter: "\n" }), (0, operators_1.toArray)())
172
+ .subscribe({
173
+ next: (result) => {
174
+ expect(result).toEqual([]);
175
+ done();
176
+ },
177
+ error: (error) => {
178
+ done(error);
179
+ }
180
+ });
181
+ });
182
+ it("should handle chunks without delimiters", (done) => {
183
+ const chunks = ['{"id":1}', '{"id":2}'];
184
+ (0, rxjs_1.of)(...chunks)
185
+ .pipe((0, stitch_1.stitchChunks)({ delimiter: "\n" }), (0, operators_1.toArray)())
186
+ .subscribe({
187
+ next: (result) => {
188
+ expect(result).toEqual([]);
189
+ done();
190
+ },
191
+ error: (error) => {
192
+ done(error);
193
+ }
194
+ });
195
+ });
196
+ it("should handle chunks ending with delimiter", (done) => {
197
+ const chunks = ['{"id":1}\n', '{"id":2}\n'];
198
+ (0, rxjs_1.of)(...chunks)
199
+ .pipe((0, stitch_1.stitchChunks)({ delimiter: "\n" }), (0, operators_1.toArray)())
200
+ .subscribe({
201
+ next: (result) => {
202
+ expect(result).toEqual(['{"id":1}', '{"id":2}']);
203
+ done();
204
+ },
205
+ error: (error) => {
206
+ done(error);
207
+ }
208
+ });
209
+ });
210
+ it("should handle remainder with delimiter", (done) => {
211
+ const chunks = ['{"id":1}\n{"id', ":2}\n"];
212
+ (0, rxjs_1.of)(...chunks)
213
+ .pipe((0, stitch_1.stitchChunks)({ delimiter: "\n" }), (0, operators_1.toArray)())
214
+ .subscribe({
215
+ next: (result) => {
216
+ expect(result).toEqual(['{"id":1}', '{"id:2}']);
217
+ done();
218
+ },
219
+ error: (error) => {
220
+ done(error);
221
+ }
222
+ });
223
+ });
224
+ });
225
+ describe("TextCodec", () => {
226
+ let textCodec;
227
+ beforeEach(() => {
228
+ textCodec = new textCodec_1.TextCodec(types_1.TRANSPORT_TYPE.WEB);
229
+ });
230
+ it("should encode and decode text", () => {
231
+ const text = "Hello, World!";
232
+ const encoded = textCodec.encode(text);
233
+ const decoded = textCodec.decode(encoded);
234
+ expect(decoded).toBe(text);
235
+ });
236
+ it("should handle empty text", () => {
237
+ const text = "";
238
+ const encoded = textCodec.encode(text);
239
+ const decoded = textCodec.decode(encoded);
240
+ expect(decoded).toBe(text);
241
+ });
242
+ it("should handle special characters", () => {
243
+ const text = "Hello, 世界!";
244
+ const encoded = textCodec.encode(text);
245
+ const decoded = textCodec.decode(encoded);
246
+ expect(decoded).toBe(text);
247
+ });
248
+ it("should handle different transport types", () => {
249
+ const nativeCodec = new textCodec_1.TextCodec(types_1.TRANSPORT_TYPE.REACT_NATIVE);
250
+ const text = "Hello, World!";
251
+ const encoded = nativeCodec.encode(text);
252
+ expect(Array.isArray(encoded)).toBe(true);
253
+ const decoded = nativeCodec.decode(Uint8Array.from(encoded));
254
+ expect(decoded).toBe(text);
255
+ });
256
+ it("should handle invalid input for decode", () => {
257
+ const invalidInput = new Uint8Array([0xff, 0xff, 0xff]);
258
+ const decoded = textCodec.decode(invalidInput);
259
+ expect(decoded).toBeDefined();
260
+ expect(typeof decoded).toBe("string");
261
+ });
262
+ it("should handle null input in decode", () => {
263
+ const emptyArray = new Uint8Array(0);
264
+ const result = textCodec.decode(emptyArray);
265
+ expect(result).toBe("");
266
+ });
267
+ it("should handle undefined input in decode", () => {
268
+ const emptyArray = new Uint8Array(0);
269
+ const result = textCodec.decode(emptyArray);
270
+ expect(result).toBe("");
271
+ });
272
+ it("should handle non-web transport type", () => {
273
+ const nodeCodec = new textCodec_1.TextCodec("node");
274
+ const text = "Hello, World!";
275
+ const encoded = nodeCodec.encode(text);
276
+ expect(encoded).toBeDefined();
277
+ const decoded = nodeCodec.decode(encoded);
278
+ expect(decoded).toBe(text);
279
+ });
280
+ });
281
+ });
@@ -8,12 +8,12 @@ import { Epoch } from "../../types/epoch";
8
8
  import { BLUETOOTH_CONNECTION } from "./types";
9
9
  import { DeviceNicknameOrPeripheral } from "./BluetoothTransport";
10
10
  import { Peripheral } from "./react-native/types/BleManagerTypes";
11
- export declare type BluetoothTransport = WebBluetoothTransport | ReactNativeTransport;
12
- declare type IsAuthenticated = boolean;
13
- declare type ExpiresIn = number;
14
- declare type IsAuthenticatedResponse = [IsAuthenticated, ExpiresIn];
15
- declare type CreateBluetoothToken = () => Promise<string>;
16
- declare type Options = {
11
+ export type BluetoothTransport = WebBluetoothTransport | ReactNativeTransport;
12
+ type IsAuthenticated = boolean;
13
+ type ExpiresIn = number;
14
+ type IsAuthenticatedResponse = [IsAuthenticated, ExpiresIn];
15
+ type CreateBluetoothToken = () => Promise<string>;
16
+ type Options = {
17
17
  transport: BluetoothTransport;
18
18
  selectedDevice$: Observable<DeviceInfo>;
19
19
  osHasBluetoothSupport$: Observable<boolean>;
@@ -3,7 +3,7 @@ import { BLUETOOTH_CONNECTION, TRANSPORT_TYPE } from "./types";
3
3
  import { Action } from "../../types/actions";
4
4
  import { DeviceInfo, OSVersion } from "../../types/deviceInfo";
5
5
  import { Peripheral } from "./react-native/types/BleManagerTypes";
6
- export declare type DeviceNicknameOrPeripheral = string | Peripheral;
6
+ export type DeviceNicknameOrPeripheral = string | Peripheral;
7
7
  /**
8
8
  * @hidden
9
9
  */
@@ -8,21 +8,21 @@ import { Peripheral } from "./types/BleManagerTypes";
8
8
  import { NativeEventEmitter } from "./types/ReactNativeTypes";
9
9
  import { PlatformOSType } from "./types/ReactNativeTypes";
10
10
  import { DeviceInfo } from "../../../types/deviceInfo";
11
- declare type Characteristic = {
11
+ type Characteristic = {
12
12
  characteristicUUID: string;
13
13
  serviceUUID: string;
14
14
  peripheralId: string;
15
15
  };
16
- declare type CharacteristicsByName = {
16
+ type CharacteristicsByName = {
17
17
  [name: string]: Characteristic;
18
18
  };
19
- declare type Options = {
19
+ type Options = {
20
20
  BleManager: BleManager;
21
21
  bleManagerEmitter: NativeEventEmitter;
22
22
  platform: PlatformOSType;
23
23
  autoConnect?: boolean;
24
24
  };
25
- declare type BleManagerEvents = {
25
+ type BleManagerEvents = {
26
26
  stopScan$: Observable<void>;
27
27
  discoverPeripheral$: Observable<Peripheral>;
28
28
  connectPeripheral$: Observable<void>;
@@ -130,7 +130,7 @@ declare class EventEmitter {
130
130
  * The React Native implementation of the IOS RCTEventEmitter which is required when creating
131
131
  * a module that communicates with IOS
132
132
  */
133
- declare type NativeModule = {
133
+ type NativeModule = {
134
134
  /**
135
135
  * Add the provided eventType as an active listener
136
136
  * @param eventType name of the event for which we are registering listener
@@ -176,5 +176,5 @@ export declare class NativeEventEmitter extends EventEmitter {
176
176
  /**
177
177
  * @see https://reactnative.dev/docs/platform-specific-code#content
178
178
  */
179
- export declare type PlatformOSType = "ios" | "android" | "macos" | "windows" | "web" | "native";
179
+ export type PlatformOSType = "ios" | "android" | "macos" | "windows" | "web" | "native";
180
180
  export {};
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * @hidden
3
3
  */
4
- export declare type ActionOptions = {
4
+ export type ActionOptions = {
5
5
  characteristicName: string;
6
6
  action: any;
7
7
  };
8
8
  /**
9
9
  * @hidden
10
10
  */
11
- export declare type SubscribeOptions = {
11
+ export type SubscribeOptions = {
12
12
  characteristicName: string;
13
13
  manageNotifications?: boolean;
14
14
  skipJSONDecoding?: boolean;
@@ -2,7 +2,7 @@ import { TextCodec } from "./textCodec";
2
2
  /**
3
3
  * @hidden
4
4
  */
5
- declare type Options = {
5
+ type Options = {
6
6
  textCodec: TextCodec;
7
7
  characteristicName: string;
8
8
  delimiter: string;
@@ -1,4 +1,4 @@
1
- declare type StitchChunkOptions = {
1
+ type StitchChunkOptions = {
2
2
  delimiter: string;
3
3
  };
4
4
  export declare function stitchChunks({ delimiter }: StitchChunkOptions): import("rxjs").UnaryFunction<import("rxjs").Observable<string>, import("rxjs").Observable<string>>;
@@ -3,7 +3,7 @@ import { TRANSPORT_TYPE } from "../types";
3
3
  * @hidden
4
4
  * Uint8Array in Web | number[] in React Native
5
5
  */
6
- export declare type BufferLike = Uint8Array | number[];
6
+ export type BufferLike = Uint8Array | number[];
7
7
  /**
8
8
  * @hidden
9
9
  */
@@ -5,7 +5,7 @@ import { TextCodec } from "../utils/textCodec";
5
5
  import { ActionOptions, SubscribeOptions } from "../types";
6
6
  import { TRANSPORT_TYPE, BLUETOOTH_CONNECTION } from "../types";
7
7
  import { DeviceInfo } from "../../../types/deviceInfo";
8
- declare type Options = {
8
+ type Options = {
9
9
  autoConnect?: boolean;
10
10
  };
11
11
  export declare class WebBluetoothTransport implements BluetoothTransport {
@@ -1,7 +1,7 @@
1
1
  import firebase from "firebase/app";
2
2
  import { FirebaseApp } from "./FirebaseApp";
3
3
  import { SDKDependencies } from "../../types/options";
4
- declare type FirebaseDeviceOptions = {
4
+ type FirebaseDeviceOptions = {
5
5
  deviceId: string;
6
6
  firebaseApp: FirebaseApp;
7
7
  dependencies: SDKDependencies;
@@ -11,7 +11,7 @@ import { TransferDeviceOptions } from "../../utils/transferDevice";
11
11
  /**
12
12
  * @hidden
13
13
  */
14
- export declare type UserWithMetadata = User & {
14
+ export type UserWithMetadata = User & {
15
15
  selectedDevice: DeviceInfo | null;
16
16
  };
17
17
  /**
@@ -37,7 +37,7 @@ class CloudClient {
37
37
  this.firebaseApp = new firebase_1.FirebaseApp(options);
38
38
  this.firebaseUser = new firebase_1.FirebaseUser(this.firebaseApp);
39
39
  this._selectedDevice.next(undefined);
40
- this.status$ = (0, heartbeat_1.heartbeatAwareStatus)(this.observeNamespace("status").pipe((0, operators_1.share)())).pipe((0, filterInternalKeys_1.filterInternalKeys)(), (0, operators_1.shareReplay)(1));
40
+ this.status$ = (0, heartbeat_1.heartbeatAwareStatus)(this.observeNamespace("status").pipe((0, operators_1.shareReplay)(1))).pipe((0, filterInternalKeys_1.filterInternalKeys)(), (0, operators_1.shareReplay)(1));
41
41
  this.osVersion$ = this.observeNamespace("info/osVersion").pipe((0, operators_1.shareReplay)(1));
42
42
  this.firebaseUser.onAuthStateChanged().subscribe((user) => {
43
43
  this.user = user;
@@ -1,6 +1,6 @@
1
1
  import { Observable } from "rxjs";
2
2
  import { DeviceStatus } from "../types/status";
3
- declare type Options = {
3
+ type Options = {
4
4
  getTimesync: () => Promise<number>;
5
5
  status$: Observable<DeviceStatus>;
6
6
  bufferSize?: number;
@@ -1 +1 @@
1
- export declare type AwarenessLabels = "calm" | "focus";
1
+ export type AwarenessLabels = "calm" | "focus";
@@ -1,26 +1,39 @@
1
- export declare type BrainwavesLabel = "raw" | "rawUnfiltered" | "powerByBand" | "psd";
2
- export declare type AmplitudeByChannel = number[][];
1
+ export type BrainwavesLabel = "raw" | "rawUnfiltered" | "powerByBand" | "psd";
2
+ export type AmplitudeByChannel = number[][];
3
+ export interface BaseInfo {
4
+ samplingRate: number;
5
+ startTime: number;
6
+ channelNames: string[];
7
+ }
8
+ export interface EpochInfo extends BaseInfo {
9
+ notchFrequency?: string;
10
+ }
3
11
  export interface Epoch {
4
12
  data: AmplitudeByChannel;
5
- info: {
6
- samplingRate: number;
7
- startTime: number;
8
- };
13
+ info: EpochInfo;
14
+ }
15
+ export interface RawUnfilteredEpochInfo extends BaseInfo {
16
+ }
17
+ export interface RawUnfilteredEpoch {
18
+ data: AmplitudeByChannel;
19
+ info: RawUnfilteredEpochInfo;
20
+ }
21
+ export type PSDByChannel = number[][];
22
+ export interface PSDInfo extends BaseInfo {
23
+ notchFrequency: string;
9
24
  }
10
- export declare type PSDByChannel = number[][];
11
25
  export interface PSD {
26
+ label: "psd";
12
27
  psd: PSDByChannel;
13
28
  freqs: number[];
14
- info: {
15
- samplingRate: number;
16
- startTime: number;
17
- };
29
+ info: PSDInfo;
18
30
  }
19
- export declare type BandName = "gamma" | "beta" | "alpha" | "theta" | "delta";
31
+ export type BandName = "gamma" | "beta" | "alpha" | "theta" | "delta";
20
32
  export interface PowerByBand {
21
33
  gamma: number[];
22
34
  beta: number[];
23
35
  alpha: number[];
24
36
  theta: number[];
25
37
  delta: number[];
38
+ info: BaseInfo;
26
39
  }
@@ -1,12 +1,12 @@
1
- export declare type CustomToken = {
1
+ export type CustomToken = {
2
2
  customToken: string;
3
3
  };
4
- export declare type EmailAndPassword = {
4
+ export type EmailAndPassword = {
5
5
  email: string;
6
6
  password: string;
7
7
  };
8
- export declare type OAuthCredentials = {
8
+ export type OAuthCredentials = {
9
9
  idToken: string;
10
10
  providerId: string;
11
11
  };
12
- export declare type Credentials = EmailAndPassword | OAuthCredentials | CustomToken;
12
+ export type Credentials = EmailAndPassword | OAuthCredentials | CustomToken;
@@ -1,4 +1,4 @@
1
- export declare type OSVersion = string;
1
+ export type OSVersion = string;
2
2
  export interface DeviceInfo {
3
3
  deviceId: string;
4
4
  deviceNickname: string;
@@ -13,7 +13,7 @@ export interface DeviceInfo {
13
13
  apiVersion: string;
14
14
  emulator?: boolean;
15
15
  }
16
- declare type DeviceSelectorKeyValue = [string, string | number | string[]];
17
- declare type DeviceSelectorFunction = (devices: DeviceInfo[]) => DeviceInfo;
18
- export declare type DeviceSelector = DeviceSelectorKeyValue | DeviceSelectorFunction;
16
+ type DeviceSelectorKeyValue = [string, string | number | string[]];
17
+ type DeviceSelectorFunction = (devices: DeviceInfo[]) => DeviceInfo;
18
+ export type DeviceSelector = DeviceSelectorKeyValue | DeviceSelectorFunction;
19
19
  export {};
@@ -2,7 +2,7 @@ import { Marker } from "./marker";
2
2
  /**
3
3
  * @hidden
4
4
  */
5
- export declare type Epoch = {
5
+ export type Epoch = {
6
6
  data: number[];
7
7
  info?: {
8
8
  channelNames?: string[];
@@ -1,4 +1,4 @@
1
- export declare type Experiment = {
1
+ export type Experiment = {
2
2
  deviceId: string;
3
3
  id: string;
4
4
  labels: string[];
@@ -1,4 +1,4 @@
1
- export declare type HapticEffects = {
1
+ export type HapticEffects = {
2
2
  strongClick100: string;
3
3
  strongClick60: string;
4
4
  strongClick30: string;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @hidden
3
3
  */
4
- export declare type Marker = {
4
+ export type Marker = {
5
5
  label: string;
6
6
  timestamp: number;
7
7
  };
@@ -2,11 +2,11 @@ import { PendingSubscription, Subscription } from "./subscriptions";
2
2
  /**
3
3
  * @hidden
4
4
  */
5
- declare type SubscriptionListener = Function;
5
+ type SubscriptionListener = Function;
6
6
  /**
7
7
  * @hidden
8
8
  */
9
- export declare type MetricValue = {
9
+ export type MetricValue = {
10
10
  [label: string]: any;
11
11
  };
12
12
  /**
@@ -1,4 +1,4 @@
1
- export declare type OAuthConfig = {
1
+ export type OAuthConfig = {
2
2
  clientId: string;
3
3
  clientSecret?: string;
4
4
  responseType: "token" | "code";
@@ -6,15 +6,15 @@ export declare type OAuthConfig = {
6
6
  scope: string[];
7
7
  state: string;
8
8
  };
9
- export declare type OAuthQuery = {
9
+ export type OAuthQuery = {
10
10
  clientId: string;
11
11
  clientSecret: string;
12
12
  userId: string;
13
13
  };
14
- export declare type OAuthQueryResult = {
14
+ export type OAuthQueryResult = {
15
15
  customToken: string;
16
16
  userId: string;
17
17
  };
18
- export declare type OAuthRemoveResponse = {
18
+ export type OAuthRemoveResponse = {
19
19
  ok: boolean;
20
20
  };
@@ -2,7 +2,7 @@ import { Marker } from "./marker";
2
2
  /**
3
3
  * @hidden
4
4
  */
5
- export declare type Sample = {
5
+ export type Sample = {
6
6
  data: number[];
7
7
  timestamp: number;
8
8
  count?: number;
@@ -12,4 +12,4 @@ export declare type Sample = {
12
12
  /**
13
13
  * @hidden
14
14
  */
15
- export declare type CSVSample = number[];
15
+ export type CSVSample = number[];
@@ -1,4 +1,4 @@
1
- declare type ChannelQuality = {
1
+ type ChannelQuality = {
2
2
  standardDeviation: number;
3
3
  status: "great" | "good" | "bad" | "noContact";
4
4
  };
@@ -2,7 +2,7 @@ import { Observable } from "rxjs";
2
2
  /**
3
3
  * @hidden
4
4
  */
5
- declare type SkillProps = {
5
+ type SkillProps = {
6
6
  [key: string]: string | number | boolean;
7
7
  };
8
8
  /**
@@ -37,7 +37,7 @@ export interface DeviceSkill {
37
37
  /**
38
38
  * @hidden
39
39
  */
40
- declare type SkillMetric = {
40
+ type SkillMetric = {
41
41
  [key: string]: any;
42
42
  };
43
43
  /**