@neurosity/sdk 6.2.1-next.1 → 6.2.1-next.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 (49) hide show
  1. package/dist/Neurosity.d.ts +733 -0
  2. package/dist/api/bluetooth/BluetoothClient.d.ts +72 -0
  3. package/dist/api/bluetooth/constants.d.ts +4 -0
  4. package/dist/api/bluetooth/index.d.ts +5 -0
  5. package/dist/api/bluetooth/react-native/ReactNativeTransport.d.ts +70 -0
  6. package/dist/api/bluetooth/types/index.d.ts +31 -0
  7. package/dist/api/bluetooth/utils/create6DigitPin.d.ts +1 -0
  8. package/dist/api/bluetooth/utils/csvBufferToEpoch.d.ts +11 -0
  9. package/dist/api/bluetooth/utils/encoding.d.ts +3 -0
  10. package/dist/api/bluetooth/utils/osHasBluetoothSupport.d.ts +2 -0
  11. package/dist/api/bluetooth/utils/stitch.d.ts +5 -0
  12. package/dist/api/bluetooth/web/WebBluetoothTransport.d.ts +54 -0
  13. package/dist/api/bluetooth/web/isMaybeWebWorkerContext.d.ts +1 -0
  14. package/dist/api/bluetooth/web/isWebBluetoothSupported.d.ts +1 -0
  15. package/dist/api/firebase/FirebaseApp.d.ts +20 -0
  16. package/dist/api/firebase/FirebaseDevice.d.ts +68 -0
  17. package/dist/api/firebase/FirebaseUser.d.ts +53 -0
  18. package/dist/api/firebase/config.d.ts +8 -0
  19. package/dist/api/firebase/deviceStore.d.ts +26 -0
  20. package/dist/api/firebase/index.d.ts +3 -0
  21. package/dist/api/https/config.d.ts +1 -0
  22. package/dist/api/https/createOAuthURL.d.ts +3 -0
  23. package/dist/api/https/getOAuthToken.d.ts +3 -0
  24. package/dist/api/https/utils.d.ts +2 -0
  25. package/dist/api/index.d.ts +117 -0
  26. package/dist/index.cjs +2 -0
  27. package/dist/index.cjs.map +1 -0
  28. package/dist/index.d.ts +2 -0
  29. package/dist/index.m.js +2 -0
  30. package/dist/index.m.js.map +1 -0
  31. package/dist/index.umd.js +2 -0
  32. package/dist/index.umd.js.map +1 -0
  33. package/dist/subscriptions/SubscriptionManager.d.ts +11 -0
  34. package/dist/timesync/Timesync.d.ts +20 -0
  35. package/dist/timesync/index.d.ts +1 -0
  36. package/dist/types/status.d.ts +26 -0
  37. package/dist/types/streaming.d.ts +15 -0
  38. package/dist/utils/errors.d.ts +5 -0
  39. package/dist/utils/filterInternalKeys.d.ts +3 -0
  40. package/dist/utils/hapticEffects.d.ts +123 -0
  41. package/dist/utils/heartbeat.d.ts +4 -0
  42. package/dist/utils/is-node.d.ts +1 -0
  43. package/dist/utils/metrics.d.ts +6 -0
  44. package/dist/utils/oauth.d.ts +9 -0
  45. package/dist/utils/pipes.d.ts +46 -0
  46. package/dist/utils/platform.d.ts +30 -0
  47. package/dist/utils/subscription.d.ts +6 -0
  48. package/dist/utils/whileOnline.d.ts +8 -0
  49. package/package.json +1 -2
@@ -0,0 +1,72 @@
1
+ import { Observable } from "rxjs";
2
+ import { ReplaySubject } from "rxjs";
3
+ import { WebBluetoothTransport } from "./web/WebBluetoothTransport";
4
+ import { ReactNativeTransport } from "./react-native/ReactNativeTransport";
5
+ import { DeviceInfo } from "../../types/deviceInfo";
6
+ import { Action } from "../../types/actions";
7
+ import { Epoch } from "../../types/epoch";
8
+ import { BLUETOOTH_CONNECTION } from "./types";
9
+ import { DeviceNicknameOrPeripheral } from "./BluetoothTransport";
10
+ import { Peripheral } from "./react-native/types/BleManagerTypes";
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
+ transport: BluetoothTransport;
18
+ selectedDevice$: Observable<DeviceInfo>;
19
+ createBluetoothToken: CreateBluetoothToken;
20
+ };
21
+ export declare class BluetoothClient {
22
+ transport: BluetoothTransport;
23
+ deviceInfo: DeviceInfo;
24
+ selectedDevice$: ReplaySubject<DeviceInfo>;
25
+ isAuthenticated$: ReplaySubject<boolean>;
26
+ _focus$: Observable<any>;
27
+ _calm$: Observable<any>;
28
+ _accelerometer$: Observable<any>;
29
+ _brainwavesRaw$: Observable<any>;
30
+ _brainwavesRawUnfiltered$: Observable<any>;
31
+ _brainwavesPSD$: Observable<any>;
32
+ _brainwavesPowerByBand$: Observable<any>;
33
+ _signalQuality$: Observable<any>;
34
+ _status$: Observable<any>;
35
+ _settings$: Observable<any>;
36
+ _wifiNearbyNetworks$: Observable<any>;
37
+ _wifiConnections$: Observable<any>;
38
+ constructor(options: Options);
39
+ _autoAuthenticate(createBluetoothToken: CreateBluetoothToken): Observable<IsAuthenticatedResponse>;
40
+ enableAutoConnect(autoConnect: boolean): void;
41
+ _hasBluetoothSupport(): Promise<boolean>;
42
+ authenticate(token: string): Promise<IsAuthenticatedResponse>;
43
+ isAuthenticated(): Promise<IsAuthenticatedResponse>;
44
+ scan(options?: any): Observable<Peripheral[]>;
45
+ connect(deviceNicknameORPeripheral?: DeviceNicknameOrPeripheral): Promise<void>;
46
+ disconnect(): Promise<void>;
47
+ connection(): Observable<BLUETOOTH_CONNECTION>;
48
+ logs(): Observable<string>;
49
+ getDeviceId(): Promise<string>;
50
+ _withAuthentication<T>(getter: () => Promise<T>): Promise<T>;
51
+ _subscribeWhileAuthenticated(characteristicName: string): Observable<any>;
52
+ focus(): Observable<any>;
53
+ calm(): Observable<any>;
54
+ accelerometer(): Observable<any>;
55
+ brainwaves(label: string): Observable<Epoch | any>;
56
+ signalQuality(): Observable<any>;
57
+ addMarker(label: string): Promise<void>;
58
+ getInfo(): Promise<DeviceInfo>;
59
+ status(): Observable<any>;
60
+ dispatchAction(action: Action): Promise<any>;
61
+ settings(): Observable<any>;
62
+ haptics(effects: any): Promise<any>;
63
+ get wifi(): {
64
+ nearbyNetworks: () => Observable<any>;
65
+ connections: () => Observable<any>;
66
+ connect: (ssid: string, password?: string) => Promise<any>;
67
+ forgetConnection: (ssid: string) => Promise<any>;
68
+ reset: () => Promise<any>;
69
+ speedTest: () => Promise<any>;
70
+ };
71
+ }
72
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const ANDROID_MAX_MTU: number;
2
+ export declare const REACT_NATIVE_MAX_BYTE_SIZE: number;
3
+ export declare const DEFAULT_ACTION_RESPONSE_TIMEOUT: number;
4
+ export declare const CHARACTERISTIC_UUIDS_TO_NAMES: any;
@@ -0,0 +1,5 @@
1
+ export * from "./BluetoothClient";
2
+ export * from "./web/WebBluetoothTransport";
3
+ export * from "./react-native/ReactNativeTransport";
4
+ export * from "./utils/osHasBluetoothSupport";
5
+ export * from "./types/index";
@@ -0,0 +1,70 @@
1
+ import { BehaviorSubject, ReplaySubject } from "rxjs";
2
+ import { Observable } from "rxjs";
3
+ import { BluetoothTransport } from "../BluetoothTransport";
4
+ import { ActionOptions, SubscribeOptions } from "../types";
5
+ import { TRANSPORT_TYPE, BLUETOOTH_CONNECTION } from "../types";
6
+ import { BleManager } from "./types/BleManagerTypes";
7
+ import { Peripheral } from "./types/BleManagerTypes";
8
+ import { NativeEventEmitter } from "./types/ReactNativeTypes";
9
+ import { PlatformOSType } from "./types/ReactNativeTypes";
10
+ import { DeviceInfo } from "../../../types/deviceInfo";
11
+ type Characteristic = {
12
+ characteristicUUID: string;
13
+ serviceUUID: string;
14
+ peripheralId: string;
15
+ };
16
+ type CharacteristicsByName = {
17
+ [name: string]: Characteristic;
18
+ };
19
+ type Options = {
20
+ BleManager: BleManager;
21
+ bleManagerEmitter: NativeEventEmitter;
22
+ platform: PlatformOSType;
23
+ autoConnect?: boolean;
24
+ };
25
+ type BleManagerEvents = {
26
+ stopScan$: Observable<void>;
27
+ discoverPeripheral$: Observable<Peripheral>;
28
+ connectPeripheral$: Observable<void>;
29
+ disconnectPeripheral$: Observable<void>;
30
+ didUpdateValueForCharacteristic$: Observable<any>;
31
+ didUpdateState$: Observable<any>;
32
+ };
33
+ export declare class ReactNativeTransport implements BluetoothTransport {
34
+ type: TRANSPORT_TYPE;
35
+ options: Options;
36
+ BleManager: BleManager;
37
+ bleManagerEmitter: NativeEventEmitter;
38
+ platform: PlatformOSType;
39
+ bleEvents: BleManagerEvents;
40
+ device: Peripheral;
41
+ characteristicsByName: CharacteristicsByName;
42
+ connection$: BehaviorSubject<BLUETOOTH_CONNECTION>;
43
+ pendingActions$: BehaviorSubject<any[]>;
44
+ logs$: ReplaySubject<string>;
45
+ onDisconnected$: Observable<void>;
46
+ connectionStream$: Observable<BLUETOOTH_CONNECTION>;
47
+ _isAutoConnectEnabled$: ReplaySubject<boolean>;
48
+ constructor(options: Options);
49
+ addLog(log: string): void;
50
+ isConnected(): boolean;
51
+ _autoConnect(selectedDevice$: Observable<DeviceInfo>): Observable<void>;
52
+ enableAutoConnect(autoConnect: boolean): void;
53
+ connection(): Observable<BLUETOOTH_CONNECTION>;
54
+ _fromEvent(eventName: string): Observable<any>;
55
+ scan(options?: {
56
+ seconds?: number;
57
+ once?: boolean;
58
+ }): Observable<Peripheral[]>;
59
+ connect(peripheral: Peripheral): Promise<void>;
60
+ disconnect(): Promise<void>;
61
+ getCharacteristicByName(characteristicName: string): Characteristic;
62
+ subscribeToCharacteristic({ characteristicName, manageNotifications }: SubscribeOptions): Observable<any>;
63
+ readCharacteristic(characteristicName: string, parse?: boolean): Promise<any>;
64
+ writeCharacteristic(characteristicName: string, data: string): Promise<void>;
65
+ _addPendingAction(actionId: number): void;
66
+ _removePendingAction(actionId: number): void;
67
+ _autoToggleActionNotifications(selectedDevice$: Observable<DeviceInfo>): Promise<void>;
68
+ dispatchAction({ characteristicName, action }: ActionOptions): Promise<any>;
69
+ }
70
+ export {};
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @hidden
3
+ */
4
+ export type ActionOptions = {
5
+ characteristicName: string;
6
+ action: any;
7
+ };
8
+ /**
9
+ * @hidden
10
+ */
11
+ export type SubscribeOptions = {
12
+ characteristicName: string;
13
+ manageNotifications?: boolean;
14
+ };
15
+ /**
16
+ * @hidden
17
+ */
18
+ export declare enum BLUETOOTH_CONNECTION {
19
+ SCANNING = "scanning",
20
+ CONNECTED = "connected",
21
+ CONNECTING = "connecting",
22
+ DISCONNECTING = "disconnecting",
23
+ DISCONNECTED = "disconnected"
24
+ }
25
+ /**
26
+ * @hidden
27
+ */
28
+ export declare enum TRANSPORT_TYPE {
29
+ WEB = "web",
30
+ REACT_NATIVE = "reactNative"
31
+ }
@@ -0,0 +1 @@
1
+ export declare function create6DigitPin(): number;
@@ -0,0 +1,11 @@
1
+ import { Observable, UnaryFunction } from "rxjs";
2
+ import { Epoch } from "../../../types/epoch";
3
+ import { DeviceInfo } from "../../../types/deviceInfo";
4
+ /**
5
+ * @hidden
6
+ */
7
+ export declare function csvBufferToEpoch(deviceInfo: DeviceInfo): UnaryFunction<Observable<Epoch>, any>;
8
+ /**
9
+ * @hidden
10
+ */
11
+ export declare function csvBufferToSamples(): UnaryFunction<any, any>;
@@ -0,0 +1,3 @@
1
+ import { TRANSPORT_TYPE } from "../types";
2
+ export declare function encode(transportType: TRANSPORT_TYPE, data: string): Uint8Array | number[];
3
+ export declare function decode(transportType: TRANSPORT_TYPE, data: Uint8Array | number[]): string;
@@ -0,0 +1,2 @@
1
+ import { DeviceInfo } from "../../../types/deviceInfo";
2
+ export declare function osHasBluetoothSupport(selectedDevice: DeviceInfo): any;
@@ -0,0 +1,5 @@
1
+ type StitchChunkOptions = {
2
+ delimiter: string;
3
+ };
4
+ export declare function stitchChunks({ delimiter }: StitchChunkOptions): import("rxjs").UnaryFunction<import("rxjs").Observable<string>, import("rxjs").Observable<string>>;
5
+ export {};
@@ -0,0 +1,54 @@
1
+ /// <reference types="web-bluetooth" />
2
+ import { BehaviorSubject, ReplaySubject } from "rxjs";
3
+ import { Observable } from "rxjs";
4
+ import { BluetoothTransport } from "../BluetoothTransport";
5
+ import { ActionOptions, SubscribeOptions } from "../types";
6
+ import { TRANSPORT_TYPE, BLUETOOTH_CONNECTION } from "../types";
7
+ import { DeviceInfo } from "../../../types/deviceInfo";
8
+ type Options = {
9
+ autoConnect?: boolean;
10
+ };
11
+ export declare class WebBluetoothTransport implements BluetoothTransport {
12
+ type: TRANSPORT_TYPE;
13
+ options: Options;
14
+ device: BluetoothDevice;
15
+ server: BluetoothRemoteGATTServer;
16
+ service: BluetoothRemoteGATTService;
17
+ characteristicsByName: {
18
+ [name: string]: BluetoothRemoteGATTCharacteristic;
19
+ };
20
+ connection$: BehaviorSubject<BLUETOOTH_CONNECTION>;
21
+ pendingActions$: BehaviorSubject<any[]>;
22
+ logs$: ReplaySubject<string>;
23
+ onDisconnected$: Observable<void>;
24
+ connectionStream$: Observable<BLUETOOTH_CONNECTION>;
25
+ _isAutoConnectEnabled$: ReplaySubject<boolean>;
26
+ constructor(options?: Options);
27
+ _getPairedDevices(): Promise<BluetoothDevice[]>;
28
+ _autoConnect(selectedDevice$: Observable<DeviceInfo>): Observable<void>;
29
+ enableAutoConnect(autoConnect: boolean): void;
30
+ addLog(log: string): void;
31
+ isConnected(): boolean;
32
+ connection(): Observable<BLUETOOTH_CONNECTION>;
33
+ connect(deviceNickname?: string): Promise<void>;
34
+ requestDevice(deviceNickname?: string): Promise<BluetoothDevice>;
35
+ getServerServiceAndCharacteristics(device: BluetoothDevice): Promise<never>;
36
+ _onDisconnected(): Observable<any>;
37
+ disconnect(): Promise<void>;
38
+ /**
39
+ *
40
+ * Bluetooth GATT attributes, services, characteristics, etc. are invalidated
41
+ * when a device disconnects. This means your code should always retrieve
42
+ * (through getPrimaryService(s), getCharacteristic(s), etc.) these attributes
43
+ * after reconnecting.
44
+ */
45
+ getCharacteristicByName(characteristicName: string): Promise<BluetoothRemoteGATTCharacteristic>;
46
+ subscribeToCharacteristic({ characteristicName, manageNotifications }: SubscribeOptions): Observable<any>;
47
+ readCharacteristic(characteristicName: string, parse?: boolean): Promise<any>;
48
+ writeCharacteristic(characteristicName: string, data: string): Promise<void>;
49
+ _addPendingAction(actionId: number): void;
50
+ _removePendingAction(actionId: number): void;
51
+ _autoToggleActionNotifications(selectedDevice$: Observable<DeviceInfo>): Promise<void>;
52
+ dispatchAction({ characteristicName, action }: ActionOptions): Promise<any>;
53
+ }
54
+ export {};
@@ -0,0 +1 @@
1
+ export declare const isMaybeWebWorkerContext: () => boolean;
@@ -0,0 +1 @@
1
+ export declare function isWebBluetoothSupported(): boolean;
@@ -0,0 +1,20 @@
1
+ import firebase from "firebase/app";
2
+ import "firebase/database";
3
+ import "firebase/auth";
4
+ import "firebase/functions";
5
+ import "firebase/firestore";
6
+ import { SDKOptions } from "../../types/options";
7
+ export declare const SERVER_TIMESTAMP: Object;
8
+ /**
9
+ * @hidden
10
+ */
11
+ export declare class FirebaseApp {
12
+ protected standalone: boolean;
13
+ app: firebase.app.App;
14
+ constructor(options: SDKOptions);
15
+ private getApp;
16
+ connectEmulators(options: SDKOptions): void;
17
+ goOnline(): void;
18
+ goOffline(): void;
19
+ disconnect(): Promise<any>;
20
+ }
@@ -0,0 +1,68 @@
1
+ import firebase from "firebase/app";
2
+ import { FirebaseApp } from "./FirebaseApp";
3
+ import { SDKDependencies } from "../../types/options";
4
+ type FirebaseDeviceOptions = {
5
+ deviceId: string;
6
+ firebaseApp: FirebaseApp;
7
+ dependencies: SDKDependencies;
8
+ };
9
+ /**
10
+ * @hidden
11
+ */
12
+ export declare class FirebaseDevice {
13
+ static serverType: string;
14
+ protected app: firebase.app.App;
15
+ protected deviceStore: any;
16
+ deviceId: string;
17
+ constructor({ deviceId, firebaseApp, dependencies }: FirebaseDeviceOptions);
18
+ get timestamp(): any;
19
+ dispatchAction(action: any): Promise<any>;
20
+ getInfo(): Promise<any>;
21
+ onNamespace(namespace: string, callback: Function): Function;
22
+ onceNamespace(namespace: string): Promise<any>;
23
+ offNamespace(namespace: string, listener: Function): void;
24
+ getTimesync(): Promise<number>;
25
+ /**
26
+ * Pushes metric for each subscriptions in path:
27
+ * /devices/:deviceId/metrics/:metricName
28
+ */
29
+ nextMetric(metricName: string, metricValue: {
30
+ [label: string]: any;
31
+ }): void;
32
+ /**
33
+ * Listens for metrics in path:
34
+ * /devices/:deviceId/metrics/:metricName
35
+ */
36
+ onMetric(subscription: any, callback: any): Function;
37
+ /**
38
+ * Creates a new and unique subscription in path:
39
+ * /devices/:deviceId/subscriptions/:subscriptionId
40
+ * E.g. /devices/device1/subscriptions/subscription3
41
+ *
42
+ * @param subscription
43
+ * @returns subscriptionId
44
+ */
45
+ subscribeToMetric(subscription: any): any;
46
+ /**
47
+ * Removes subscription in path:
48
+ * /devices/:deviceId/subscriptions/:subscriptionId
49
+ *
50
+ * @param subscription
51
+ */
52
+ unsubscribeFromMetric(subscription: any): void;
53
+ /**
54
+ * Removes metric listener
55
+ * /devices/:deviceId/metric
56
+ * or
57
+ * /devices/:deviceId/metric/label
58
+ *
59
+ * @param subscription
60
+ * @param listener
61
+ */
62
+ removeMetricListener(subscription: any, listener: Function): void;
63
+ changeSettings(settings: any): Promise<void>;
64
+ getSkill(bundleId: any): Promise<any>;
65
+ createBluetoothToken(): Promise<string>;
66
+ disconnect(): void;
67
+ }
68
+ export {};
@@ -0,0 +1,53 @@
1
+ import { Observable } from "rxjs";
2
+ import firebase from "firebase/app";
3
+ import { User } from "@firebase/auth-types";
4
+ import { FirebaseApp } from "./FirebaseApp";
5
+ import { Credentials, EmailAndPassword, CustomToken } from "../../types/credentials";
6
+ import { UserClaims } from "../../types/user";
7
+ import { DeviceInfo } from "../../types/deviceInfo";
8
+ import { OAuthRemoveResponse } from "../../types/oauth";
9
+ import { Experiment } from "../../types/experiment";
10
+ import { TransferDeviceOptions } from "../../utils/transferDevice";
11
+ /**
12
+ * @hidden
13
+ */
14
+ export declare const credentialWithLink: Function;
15
+ /**
16
+ * @hidden
17
+ */
18
+ export declare function createUser(...args: any[]): any;
19
+ /**
20
+ * @hidden
21
+ */
22
+ export declare class FirebaseUser {
23
+ app: firebase.app.App;
24
+ user: User | null;
25
+ constructor(firebaseApp: FirebaseApp);
26
+ auth(): firebase.auth.Auth;
27
+ createAccount(credentials: EmailAndPassword): Promise<any>;
28
+ deleteAccount(): Promise<void>;
29
+ onAuthStateChanged(): Observable<User | null>;
30
+ onLogin(): Observable<User>;
31
+ login(credentials: Credentials): Promise<firebase.auth.UserCredential>;
32
+ logout(): Promise<void>;
33
+ createCustomToken(): Promise<CustomToken>;
34
+ removeOAuthAccess(): Promise<OAuthRemoveResponse>;
35
+ getDevices(): Promise<DeviceInfo[]>;
36
+ addDevice(deviceId: string): Promise<void>;
37
+ removeDevice(deviceId: string): Promise<void>;
38
+ transferDevice(options: TransferDeviceOptions): Promise<void>;
39
+ isDeviceIdValid(deviceId: string): Promise<boolean>;
40
+ onUserDevicesChange(): Observable<DeviceInfo[]>;
41
+ onUserClaimsChange(): Observable<UserClaims>;
42
+ getIdToken(forceRefresh?: boolean): Promise<void>;
43
+ getClaims(): Promise<UserClaims>;
44
+ private userDevicesToDeviceInfoList;
45
+ hasDevicePermission(deviceId: string): Promise<boolean>;
46
+ private getDeviceClaimedByPath;
47
+ private getUserClaimedDevicePath;
48
+ private getUserDevicesPath;
49
+ private getUserClaimsUpdatedOnPath;
50
+ private getDeviceInfoPath;
51
+ onUserExperiments(): Observable<Experiment[]>;
52
+ deleteUserExperiment(experimentId: string): Promise<void>;
53
+ }
@@ -0,0 +1,8 @@
1
+ export declare const config: {
2
+ apiKey: string;
3
+ authDomain: string;
4
+ databaseURL: string;
5
+ projectId: string;
6
+ storageBucket: string;
7
+ messagingSenderId: string;
8
+ };
@@ -0,0 +1,26 @@
1
+ export interface IDevice {
2
+ info: any;
3
+ status: any;
4
+ subscriptions: any;
5
+ metrics: any;
6
+ }
7
+ /**
8
+ * @hidden
9
+ */
10
+ export declare const createDeviceStore: (app: any, deviceId: any, subscriptionManager: any) => {
11
+ set: (namespace: any, payload: any) => any;
12
+ once: (namespace: any, eventType?: string) => Promise<any>;
13
+ update: (namespace: any, payload: any) => any;
14
+ lastOfChildValue: (namespace: any, key: any, value: any) => Promise<unknown>;
15
+ onNamespace: (namespace: string, callback: Function) => Function;
16
+ offNamespace: (namespace: string, listener: Function) => void;
17
+ dispatchAction: (action: any) => Promise<any>;
18
+ nextMetric: (metricName: string, metricValue: {
19
+ [label: string]: any;
20
+ }) => Promise<void>;
21
+ onMetric: (subscription: any, callback: Function) => any;
22
+ subscribeToMetric: (subscription: any) => any;
23
+ unsubscribeFromMetric: (subscription: any) => void;
24
+ removeMetricListener(subscription: any, listener: Function): void;
25
+ disconnect(): void;
26
+ };
@@ -0,0 +1,3 @@
1
+ export * from "./FirebaseApp";
2
+ export * from "./FirebaseUser";
3
+ export * from "./FirebaseDevice";
@@ -0,0 +1 @@
1
+ export declare const prodFunctionsBaseUrl = "https://us-central1-neurosity-device.cloudfunctions.net";
@@ -0,0 +1,3 @@
1
+ import { SDKOptions } from "../../types/options";
2
+ import { OAuthConfig } from "../../types/oauth";
3
+ export declare function createOAuthURL(config: OAuthConfig, sdkOptions: SDKOptions): Promise<string>;
@@ -0,0 +1,3 @@
1
+ import { SDKOptions } from "../../types/options";
2
+ import { OAuthQuery, OAuthQueryResult } from "../../types/oauth";
3
+ export declare function getOAuthToken(query: OAuthQuery, sdkOptions: SDKOptions): Promise<OAuthQueryResult>;
@@ -0,0 +1,2 @@
1
+ import { SDKOptions } from "../../types/options";
2
+ export declare function getFunctionsBaseURL(sdkOptions: SDKOptions): string;
@@ -0,0 +1,117 @@
1
+ import { Observable } from "rxjs";
2
+ import { FirebaseApp, FirebaseUser, FirebaseDevice } from "./firebase";
3
+ import { Timesync } from "../timesync";
4
+ import { SubscriptionManager } from "../subscriptions/SubscriptionManager";
5
+ import { Client } from "../types/client";
6
+ import { Action, Actions } from "../types/actions";
7
+ import { Metrics } from "../types/metrics";
8
+ import { SDKOptions } from "../types/options";
9
+ import { SkillsClient } from "../types/skill";
10
+ import { Credentials, CustomToken } from "../types/credentials";
11
+ import { EmailAndPassword } from "../types/credentials";
12
+ import { ChangeSettings } from "../types/settings";
13
+ import { DeviceStatus } from "../types/status";
14
+ import { DeviceInfo, DeviceSelector } from "../types/deviceInfo";
15
+ import { UserClaims } from "../types/user";
16
+ import { OAuthRemoveResponse } from "../types/oauth";
17
+ import { Experiment } from "../types/experiment";
18
+ import { TransferDeviceOptions } from "../utils/transferDevice";
19
+ export { credentialWithLink, createUser, SERVER_TIMESTAMP } from "./firebase";
20
+ /**
21
+ * @hidden
22
+ */
23
+ export declare class CloudClient implements Client {
24
+ user: any;
25
+ userClaims: any;
26
+ protected options: SDKOptions;
27
+ protected firebaseApp: FirebaseApp;
28
+ protected firebaseUser: FirebaseUser;
29
+ protected firebaseDevice: FirebaseDevice;
30
+ protected timesync: Timesync;
31
+ protected subscriptionManager: SubscriptionManager;
32
+ protected status$: Observable<DeviceStatus>;
33
+ /**
34
+ * @internal
35
+ */
36
+ private _selectedDevice;
37
+ constructor(options: SDKOptions);
38
+ onDeviceChange(): Observable<DeviceInfo>;
39
+ private setAutoSelectedDevice;
40
+ get actions(): Actions;
41
+ dispatchAction(action: Action): Promise<any>;
42
+ disconnect(): Promise<any>;
43
+ getInfo(): Promise<any>;
44
+ login(credentials: Credentials): Promise<any>;
45
+ logout(): Promise<any>;
46
+ onAuthStateChanged(): Observable<{
47
+ selectedDevice: DeviceInfo;
48
+ delete(): Promise<void>;
49
+ emailVerified: boolean;
50
+ getIdTokenResult(forceRefresh?: boolean): Promise<import("@firebase/auth-types").IdTokenResult>;
51
+ getIdToken(forceRefresh?: boolean): Promise<string>;
52
+ isAnonymous: boolean;
53
+ linkAndRetrieveDataWithCredential(credential: import("@firebase/auth-types").AuthCredential): Promise<import("@firebase/auth-types").UserCredential>;
54
+ linkWithCredential(credential: import("@firebase/auth-types").AuthCredential): Promise<import("@firebase/auth-types").UserCredential>;
55
+ linkWithPhoneNumber(phoneNumber: string, applicationVerifier: import("@firebase/auth-types").ApplicationVerifier): Promise<import("@firebase/auth-types").ConfirmationResult>;
56
+ linkWithPopup(provider: import("@firebase/auth-types").AuthProvider): Promise<import("@firebase/auth-types").UserCredential>;
57
+ linkWithRedirect(provider: import("@firebase/auth-types").AuthProvider): Promise<void>;
58
+ metadata: import("@firebase/auth-types").UserMetadata;
59
+ multiFactor: import("@firebase/auth-types").MultiFactorUser;
60
+ phoneNumber: string;
61
+ providerData: import("@firebase/auth-types").UserInfo[];
62
+ reauthenticateAndRetrieveDataWithCredential(credential: import("@firebase/auth-types").AuthCredential): Promise<import("@firebase/auth-types").UserCredential>;
63
+ reauthenticateWithCredential(credential: import("@firebase/auth-types").AuthCredential): Promise<import("@firebase/auth-types").UserCredential>;
64
+ reauthenticateWithPhoneNumber(phoneNumber: string, applicationVerifier: import("@firebase/auth-types").ApplicationVerifier): Promise<import("@firebase/auth-types").ConfirmationResult>;
65
+ reauthenticateWithPopup(provider: import("@firebase/auth-types").AuthProvider): Promise<import("@firebase/auth-types").UserCredential>;
66
+ reauthenticateWithRedirect(provider: import("@firebase/auth-types").AuthProvider): Promise<void>;
67
+ refreshToken: string;
68
+ reload(): Promise<void>;
69
+ sendEmailVerification(actionCodeSettings?: import("@firebase/auth-types").ActionCodeSettings): Promise<void>;
70
+ tenantId: string;
71
+ toJSON(): Object;
72
+ unlink(providerId: string): Promise<import("@firebase/auth-types").User>;
73
+ updateEmail(newEmail: string): Promise<void>;
74
+ updatePassword(newPassword: string): Promise<void>;
75
+ updatePhoneNumber(phoneCredential: import("@firebase/auth-types").AuthCredential): Promise<void>;
76
+ updateProfile(profile: {
77
+ displayName?: string;
78
+ photoURL?: string;
79
+ }): Promise<void>;
80
+ verifyBeforeUpdateEmail(newEmail: string, actionCodeSettings?: import("@firebase/auth-types").ActionCodeSettings): Promise<void>;
81
+ displayName: string;
82
+ email: string;
83
+ photoURL: string;
84
+ providerId: string;
85
+ uid: string;
86
+ }>;
87
+ getDevices(): Promise<DeviceInfo[]>;
88
+ addDevice(deviceId: string): Promise<void>;
89
+ removeDevice(deviceId: string): Promise<void>;
90
+ transferDevice(options: TransferDeviceOptions): Promise<void>;
91
+ onUserDevicesChange(): Observable<DeviceInfo[]>;
92
+ onUserClaimsChange(): Observable<UserClaims>;
93
+ didSelectDevice(): Promise<boolean>;
94
+ selectDevice(deviceSelector: DeviceSelector): Promise<DeviceInfo>;
95
+ getSelectedDevice(): Promise<DeviceInfo | null>;
96
+ status(): Observable<DeviceStatus>;
97
+ observeNamespace(namespace: string): Observable<any>;
98
+ onceNamespace(namespace: string): Promise<any>;
99
+ get metrics(): Metrics;
100
+ createAccount(credentials: EmailAndPassword): Promise<any>;
101
+ deleteAccount(): Promise<void>;
102
+ createBluetoothToken(): Promise<string>;
103
+ createCustomToken(): Promise<CustomToken>;
104
+ removeOAuthAccess(): Promise<OAuthRemoveResponse>;
105
+ onUserExperiments(): Observable<Experiment[]>;
106
+ deleteUserExperiment(experimentId: string): Promise<void>;
107
+ get skills(): SkillsClient;
108
+ get timestamp(): number;
109
+ getTimesyncOffset(): number;
110
+ changeSettings(settings: ChangeSettings): Promise<void>;
111
+ goOffline(): void;
112
+ goOnline(): void;
113
+ /**
114
+ * @internal
115
+ */
116
+ __getApp(): import("firebase").default.app.App;
117
+ }