@neurosity/sdk 6.2.0 → 6.2.1-next.0

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 (306) hide show
  1. package/dist/{cjs/Neurosity.d.ts → Neurosity.d.ts} +116 -2
  2. package/dist/{cjs/api → api}/bluetooth/BluetoothClient.d.ts +6 -6
  3. package/dist/{cjs/api → api}/bluetooth/constants.d.ts +0 -0
  4. package/dist/{cjs/api → api}/bluetooth/index.d.ts +1 -0
  5. package/dist/{esm/api → api}/bluetooth/react-native/ReactNativeTransport.d.ts +4 -4
  6. package/dist/{cjs/api → api}/bluetooth/types/index.d.ts +2 -2
  7. package/dist/{cjs/api → api}/bluetooth/utils/create6DigitPin.d.ts +0 -0
  8. package/dist/{cjs/api → api}/bluetooth/utils/csvBufferToEpoch.d.ts +0 -0
  9. package/dist/{cjs/api → api}/bluetooth/utils/encoding.d.ts +0 -0
  10. package/dist/{cjs/api → api}/bluetooth/utils/osHasBluetoothSupport.d.ts +0 -0
  11. package/dist/{cjs/api → api}/bluetooth/utils/stitch.d.ts +1 -1
  12. package/dist/{esm/api → api}/bluetooth/web/WebBluetoothTransport.d.ts +1 -1
  13. package/dist/{cjs/api → api}/bluetooth/web/isMaybeWebWorkerContext.d.ts +0 -0
  14. package/dist/{cjs/api → api}/bluetooth/web/isWebBluetoothSupported.d.ts +0 -0
  15. package/dist/{cjs/api → api}/firebase/FirebaseApp.d.ts +0 -0
  16. package/dist/{cjs/api → api}/firebase/FirebaseDevice.d.ts +1 -1
  17. package/dist/{cjs/api → api}/firebase/FirebaseUser.d.ts +0 -0
  18. package/dist/{cjs/api → api}/firebase/config.d.ts +0 -0
  19. package/dist/{cjs/api → api}/firebase/deviceStore.d.ts +0 -0
  20. package/dist/{cjs/api → api}/firebase/index.d.ts +0 -0
  21. package/dist/{cjs/api → api}/https/config.d.ts +0 -0
  22. package/dist/{cjs/api → api}/https/createOAuthURL.d.ts +0 -0
  23. package/dist/{cjs/api → api}/https/getOAuthToken.d.ts +0 -0
  24. package/dist/{cjs/api → api}/https/utils.d.ts +0 -0
  25. package/dist/{esm/api → api}/index.d.ts +8 -0
  26. package/dist/index.cjs +2 -0
  27. package/dist/index.cjs.map +1 -0
  28. package/dist/{cjs/index.d.ts → index.d.ts} +0 -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/{cjs/subscriptions → subscriptions}/SubscriptionManager.d.ts +0 -0
  34. package/dist/{cjs/timesync → timesync}/Timesync.d.ts +1 -1
  35. package/dist/{cjs/timesync → timesync}/index.d.ts +0 -0
  36. package/dist/{cjs/types → types}/status.d.ts +0 -0
  37. package/dist/{cjs/types → types}/streaming.d.ts +0 -0
  38. package/dist/{cjs/utils → utils}/errors.d.ts +0 -0
  39. package/dist/{cjs/utils → utils}/filterInternalKeys.d.ts +0 -0
  40. package/dist/{cjs/utils → utils}/hapticEffects.d.ts +0 -0
  41. package/dist/{cjs/utils → utils}/heartbeat.d.ts +0 -0
  42. package/dist/{cjs/utils → utils}/is-node.d.ts +0 -0
  43. package/dist/utils/metrics.d.ts +6 -0
  44. package/dist/{cjs/utils → utils}/oauth.d.ts +1 -1
  45. package/dist/{cjs/utils → utils}/pipes.d.ts +0 -0
  46. package/dist/{cjs/utils → utils}/platform.d.ts +0 -0
  47. package/dist/{cjs/utils → utils}/subscription.d.ts +0 -0
  48. package/dist/{cjs/utils → utils}/whileOnline.d.ts +1 -1
  49. package/package.json +15 -23
  50. package/CHANGELOG.md +0 -25
  51. package/dist/browser/neurosity.iife.js +0 -48712
  52. package/dist/browser/neurosity.js +0 -666
  53. package/dist/browser/neurosity.js.map +0 -1
  54. package/dist/cjs/Neurosity.js +0 -1244
  55. package/dist/cjs/api/bluetooth/BluetoothClient.js +0 -310
  56. package/dist/cjs/api/bluetooth/BluetoothTransport.d.ts +0 -33
  57. package/dist/cjs/api/bluetooth/BluetoothTransport.js +0 -2
  58. package/dist/cjs/api/bluetooth/constants.js +0 -9
  59. package/dist/cjs/api/bluetooth/index.js +0 -20
  60. package/dist/cjs/api/bluetooth/react-native/ReactNativeTransport.d.ts +0 -70
  61. package/dist/cjs/api/bluetooth/react-native/ReactNativeTransport.js +0 -406
  62. package/dist/cjs/api/bluetooth/react-native/types/BleManagerTypes.d.ts +0 -63
  63. package/dist/cjs/api/bluetooth/react-native/types/BleManagerTypes.js +0 -11
  64. package/dist/cjs/api/bluetooth/react-native/types/ReactNativeTypes.d.ts +0 -180
  65. package/dist/cjs/api/bluetooth/react-native/types/ReactNativeTypes.js +0 -10
  66. package/dist/cjs/api/bluetooth/types/index.js +0 -22
  67. package/dist/cjs/api/bluetooth/utils/create6DigitPin.js +0 -8
  68. package/dist/cjs/api/bluetooth/utils/csvBufferToEpoch.js +0 -36
  69. package/dist/cjs/api/bluetooth/utils/encoding.js +0 -22
  70. package/dist/cjs/api/bluetooth/utils/osHasBluetoothSupport.js +0 -23
  71. package/dist/cjs/api/bluetooth/utils/stitch.js +0 -22
  72. package/dist/cjs/api/bluetooth/web/WebBluetoothTransport.d.ts +0 -54
  73. package/dist/cjs/api/bluetooth/web/WebBluetoothTransport.js +0 -430
  74. package/dist/cjs/api/bluetooth/web/isMaybeWebWorkerContext.js +0 -8
  75. package/dist/cjs/api/bluetooth/web/isWebBluetoothSupported.js +0 -11
  76. package/dist/cjs/api/firebase/FirebaseApp.js +0 -70
  77. package/dist/cjs/api/firebase/FirebaseDevice.js +0 -146
  78. package/dist/cjs/api/firebase/FirebaseUser.js +0 -434
  79. package/dist/cjs/api/firebase/config.js +0 -11
  80. package/dist/cjs/api/firebase/deviceStore.js +0 -191
  81. package/dist/cjs/api/firebase/index.js +0 -19
  82. package/dist/cjs/api/https/config.js +0 -4
  83. package/dist/cjs/api/https/createOAuthURL.js +0 -18
  84. package/dist/cjs/api/https/getOAuthToken.js +0 -34
  85. package/dist/cjs/api/https/utils.js +0 -13
  86. package/dist/cjs/api/index.d.ts +0 -109
  87. package/dist/cjs/api/index.js +0 -307
  88. package/dist/cjs/index.js +0 -18
  89. package/dist/cjs/subscriptions/SubscriptionManager.js +0 -27
  90. package/dist/cjs/timesync/Timesync.js +0 -78
  91. package/dist/cjs/timesync/index.js +0 -17
  92. package/dist/cjs/types/accelerometer.d.ts +0 -10
  93. package/dist/cjs/types/accelerometer.js +0 -2
  94. package/dist/cjs/types/actions.d.ts +0 -16
  95. package/dist/cjs/types/actions.js +0 -2
  96. package/dist/cjs/types/awareness.d.ts +0 -1
  97. package/dist/cjs/types/awareness.js +0 -2
  98. package/dist/cjs/types/brainwaves.d.ts +0 -26
  99. package/dist/cjs/types/brainwaves.js +0 -2
  100. package/dist/cjs/types/calm.d.ts +0 -6
  101. package/dist/cjs/types/calm.js +0 -2
  102. package/dist/cjs/types/client.d.ts +0 -22
  103. package/dist/cjs/types/client.js +0 -2
  104. package/dist/cjs/types/credentials.d.ts +0 -12
  105. package/dist/cjs/types/credentials.js +0 -2
  106. package/dist/cjs/types/deviceInfo.d.ts +0 -18
  107. package/dist/cjs/types/deviceInfo.js +0 -2
  108. package/dist/cjs/types/epoch.d.ts +0 -12
  109. package/dist/cjs/types/epoch.js +0 -2
  110. package/dist/cjs/types/experiment.d.ts +0 -9
  111. package/dist/cjs/types/experiment.js +0 -2
  112. package/dist/cjs/types/focus.d.ts +0 -6
  113. package/dist/cjs/types/focus.js +0 -2
  114. package/dist/cjs/types/hapticEffects.d.ts +0 -125
  115. package/dist/cjs/types/hapticEffects.js +0 -2
  116. package/dist/cjs/types/kinesis.d.ts +0 -6
  117. package/dist/cjs/types/kinesis.js +0 -2
  118. package/dist/cjs/types/marker.d.ts +0 -7
  119. package/dist/cjs/types/marker.js +0 -2
  120. package/dist/cjs/types/metrics.d.ts +0 -21
  121. package/dist/cjs/types/metrics.js +0 -2
  122. package/dist/cjs/types/oauth.d.ts +0 -20
  123. package/dist/cjs/types/oauth.js +0 -2
  124. package/dist/cjs/types/options.d.ts +0 -51
  125. package/dist/cjs/types/options.js +0 -2
  126. package/dist/cjs/types/sample.d.ts +0 -15
  127. package/dist/cjs/types/sample.js +0 -2
  128. package/dist/cjs/types/settings.d.ts +0 -13
  129. package/dist/cjs/types/settings.js +0 -2
  130. package/dist/cjs/types/signalQuality.d.ts +0 -13
  131. package/dist/cjs/types/signalQuality.js +0 -2
  132. package/dist/cjs/types/skill.d.ts +0 -68
  133. package/dist/cjs/types/skill.js +0 -2
  134. package/dist/cjs/types/status.js +0 -22
  135. package/dist/cjs/types/streaming.js +0 -20
  136. package/dist/cjs/types/subscriptions.d.ts +0 -23
  137. package/dist/cjs/types/subscriptions.js +0 -2
  138. package/dist/cjs/types/training.d.ts +0 -19
  139. package/dist/cjs/types/training.js +0 -2
  140. package/dist/cjs/types/user.d.ts +0 -12
  141. package/dist/cjs/types/user.js +0 -2
  142. package/dist/cjs/utils/errors.js +0 -17
  143. package/dist/cjs/utils/filterInternalKeys.js +0 -21
  144. package/dist/cjs/utils/hapticEffects.js +0 -130
  145. package/dist/cjs/utils/heartbeat.js +0 -41
  146. package/dist/cjs/utils/is-node.js +0 -9
  147. package/dist/cjs/utils/metrics.d.ts +0 -1
  148. package/dist/cjs/utils/metrics.js +0 -56
  149. package/dist/cjs/utils/oauth.js +0 -92
  150. package/dist/cjs/utils/pick.d.ts +0 -1
  151. package/dist/cjs/utils/pick.js +0 -5
  152. package/dist/cjs/utils/pipes.js +0 -71
  153. package/dist/cjs/utils/platform.js +0 -47
  154. package/dist/cjs/utils/subscription.js +0 -55
  155. package/dist/cjs/utils/transferDevice.d.ts +0 -9
  156. package/dist/cjs/utils/transferDevice.js +0 -2
  157. package/dist/cjs/utils/whileOnline.js +0 -15
  158. package/dist/electron/index.js +0 -86
  159. package/dist/electron/index.js.map +0 -1
  160. package/dist/esm/Neurosity.d.ts +0 -619
  161. package/dist/esm/Neurosity.js +0 -1213
  162. package/dist/esm/api/bluetooth/BluetoothClient.d.ts +0 -72
  163. package/dist/esm/api/bluetooth/BluetoothClient.js +0 -306
  164. package/dist/esm/api/bluetooth/BluetoothTransport.d.ts +0 -33
  165. package/dist/esm/api/bluetooth/BluetoothTransport.js +0 -1
  166. package/dist/esm/api/bluetooth/constants.d.ts +0 -4
  167. package/dist/esm/api/bluetooth/constants.js +0 -6
  168. package/dist/esm/api/bluetooth/index.d.ts +0 -4
  169. package/dist/esm/api/bluetooth/index.js +0 -4
  170. package/dist/esm/api/bluetooth/react-native/ReactNativeTransport.js +0 -402
  171. package/dist/esm/api/bluetooth/react-native/types/BleManagerTypes.d.ts +0 -63
  172. package/dist/esm/api/bluetooth/react-native/types/BleManagerTypes.js +0 -8
  173. package/dist/esm/api/bluetooth/react-native/types/ReactNativeTypes.d.ts +0 -180
  174. package/dist/esm/api/bluetooth/react-native/types/ReactNativeTypes.js +0 -9
  175. package/dist/esm/api/bluetooth/types/index.d.ts +0 -31
  176. package/dist/esm/api/bluetooth/types/index.js +0 -19
  177. package/dist/esm/api/bluetooth/utils/create6DigitPin.d.ts +0 -1
  178. package/dist/esm/api/bluetooth/utils/create6DigitPin.js +0 -4
  179. package/dist/esm/api/bluetooth/utils/csvBufferToEpoch.d.ts +0 -11
  180. package/dist/esm/api/bluetooth/utils/csvBufferToEpoch.js +0 -31
  181. package/dist/esm/api/bluetooth/utils/encoding.d.ts +0 -3
  182. package/dist/esm/api/bluetooth/utils/encoding.js +0 -17
  183. package/dist/esm/api/bluetooth/utils/osHasBluetoothSupport.d.ts +0 -2
  184. package/dist/esm/api/bluetooth/utils/osHasBluetoothSupport.js +0 -16
  185. package/dist/esm/api/bluetooth/utils/stitch.d.ts +0 -5
  186. package/dist/esm/api/bluetooth/utils/stitch.js +0 -18
  187. package/dist/esm/api/bluetooth/web/WebBluetoothTransport.js +0 -426
  188. package/dist/esm/api/bluetooth/web/isMaybeWebWorkerContext.d.ts +0 -1
  189. package/dist/esm/api/bluetooth/web/isMaybeWebWorkerContext.js +0 -4
  190. package/dist/esm/api/bluetooth/web/isWebBluetoothSupported.d.ts +0 -1
  191. package/dist/esm/api/bluetooth/web/isWebBluetoothSupported.js +0 -7
  192. package/dist/esm/api/firebase/FirebaseApp.d.ts +0 -20
  193. package/dist/esm/api/firebase/FirebaseApp.js +0 -63
  194. package/dist/esm/api/firebase/FirebaseDevice.d.ts +0 -68
  195. package/dist/esm/api/firebase/FirebaseDevice.js +0 -139
  196. package/dist/esm/api/firebase/FirebaseUser.d.ts +0 -53
  197. package/dist/esm/api/firebase/FirebaseUser.js +0 -426
  198. package/dist/esm/api/firebase/config.d.ts +0 -8
  199. package/dist/esm/api/firebase/config.js +0 -8
  200. package/dist/esm/api/firebase/deviceStore.d.ts +0 -26
  201. package/dist/esm/api/firebase/deviceStore.js +0 -184
  202. package/dist/esm/api/firebase/index.d.ts +0 -3
  203. package/dist/esm/api/firebase/index.js +0 -3
  204. package/dist/esm/api/https/config.d.ts +0 -1
  205. package/dist/esm/api/https/config.js +0 -1
  206. package/dist/esm/api/https/createOAuthURL.d.ts +0 -3
  207. package/dist/esm/api/https/createOAuthURL.js +0 -11
  208. package/dist/esm/api/https/getOAuthToken.d.ts +0 -3
  209. package/dist/esm/api/https/getOAuthToken.js +0 -27
  210. package/dist/esm/api/https/utils.d.ts +0 -2
  211. package/dist/esm/api/https/utils.js +0 -9
  212. package/dist/esm/api/index.js +0 -300
  213. package/dist/esm/index.d.ts +0 -2
  214. package/dist/esm/index.js +0 -2
  215. package/dist/esm/neurosity.mjs +0 -48700
  216. package/dist/esm/subscriptions/SubscriptionManager.d.ts +0 -11
  217. package/dist/esm/subscriptions/SubscriptionManager.js +0 -23
  218. package/dist/esm/timesync/Timesync.d.ts +0 -20
  219. package/dist/esm/timesync/Timesync.js +0 -71
  220. package/dist/esm/timesync/index.d.ts +0 -1
  221. package/dist/esm/timesync/index.js +0 -1
  222. package/dist/esm/types/accelerometer.d.ts +0 -10
  223. package/dist/esm/types/accelerometer.js +0 -1
  224. package/dist/esm/types/actions.d.ts +0 -16
  225. package/dist/esm/types/actions.js +0 -1
  226. package/dist/esm/types/awareness.d.ts +0 -1
  227. package/dist/esm/types/awareness.js +0 -1
  228. package/dist/esm/types/brainwaves.d.ts +0 -26
  229. package/dist/esm/types/brainwaves.js +0 -1
  230. package/dist/esm/types/calm.d.ts +0 -6
  231. package/dist/esm/types/calm.js +0 -1
  232. package/dist/esm/types/client.d.ts +0 -22
  233. package/dist/esm/types/client.js +0 -1
  234. package/dist/esm/types/credentials.d.ts +0 -12
  235. package/dist/esm/types/credentials.js +0 -1
  236. package/dist/esm/types/deviceInfo.d.ts +0 -18
  237. package/dist/esm/types/deviceInfo.js +0 -1
  238. package/dist/esm/types/epoch.d.ts +0 -12
  239. package/dist/esm/types/epoch.js +0 -1
  240. package/dist/esm/types/experiment.d.ts +0 -9
  241. package/dist/esm/types/experiment.js +0 -1
  242. package/dist/esm/types/focus.d.ts +0 -6
  243. package/dist/esm/types/focus.js +0 -1
  244. package/dist/esm/types/hapticEffects.d.ts +0 -125
  245. package/dist/esm/types/hapticEffects.js +0 -1
  246. package/dist/esm/types/kinesis.d.ts +0 -6
  247. package/dist/esm/types/kinesis.js +0 -1
  248. package/dist/esm/types/marker.d.ts +0 -7
  249. package/dist/esm/types/marker.js +0 -1
  250. package/dist/esm/types/metrics.d.ts +0 -21
  251. package/dist/esm/types/metrics.js +0 -1
  252. package/dist/esm/types/oauth.d.ts +0 -20
  253. package/dist/esm/types/oauth.js +0 -1
  254. package/dist/esm/types/options.d.ts +0 -51
  255. package/dist/esm/types/options.js +0 -1
  256. package/dist/esm/types/sample.d.ts +0 -15
  257. package/dist/esm/types/sample.js +0 -1
  258. package/dist/esm/types/settings.d.ts +0 -13
  259. package/dist/esm/types/settings.js +0 -1
  260. package/dist/esm/types/signalQuality.d.ts +0 -13
  261. package/dist/esm/types/signalQuality.js +0 -1
  262. package/dist/esm/types/skill.d.ts +0 -68
  263. package/dist/esm/types/skill.js +0 -1
  264. package/dist/esm/types/status.d.ts +0 -26
  265. package/dist/esm/types/status.js +0 -19
  266. package/dist/esm/types/streaming.d.ts +0 -15
  267. package/dist/esm/types/streaming.js +0 -17
  268. package/dist/esm/types/subscriptions.d.ts +0 -23
  269. package/dist/esm/types/subscriptions.js +0 -1
  270. package/dist/esm/types/training.d.ts +0 -19
  271. package/dist/esm/types/training.js +0 -1
  272. package/dist/esm/types/user.d.ts +0 -12
  273. package/dist/esm/types/user.js +0 -1
  274. package/dist/esm/utils/errors.d.ts +0 -5
  275. package/dist/esm/utils/errors.js +0 -11
  276. package/dist/esm/utils/filterInternalKeys.d.ts +0 -3
  277. package/dist/esm/utils/filterInternalKeys.js +0 -17
  278. package/dist/esm/utils/hapticEffects.d.ts +0 -123
  279. package/dist/esm/utils/hapticEffects.js +0 -125
  280. package/dist/esm/utils/heartbeat.d.ts +0 -4
  281. package/dist/esm/utils/heartbeat.js +0 -33
  282. package/dist/esm/utils/is-node.d.ts +0 -1
  283. package/dist/esm/utils/is-node.js +0 -5
  284. package/dist/esm/utils/metrics.d.ts +0 -1
  285. package/dist/esm/utils/metrics.js +0 -52
  286. package/dist/esm/utils/oauth.d.ts +0 -9
  287. package/dist/esm/utils/oauth.js +0 -64
  288. package/dist/esm/utils/pick.d.ts +0 -1
  289. package/dist/esm/utils/pick.js +0 -1
  290. package/dist/esm/utils/pipes.d.ts +0 -46
  291. package/dist/esm/utils/pipes.js +0 -65
  292. package/dist/esm/utils/platform.d.ts +0 -30
  293. package/dist/esm/utils/platform.js +0 -41
  294. package/dist/esm/utils/subscription.d.ts +0 -6
  295. package/dist/esm/utils/subscription.js +0 -24
  296. package/dist/esm/utils/transferDevice.d.ts +0 -9
  297. package/dist/esm/utils/transferDevice.js +0 -1
  298. package/dist/esm/utils/whileOnline.d.ts +0 -8
  299. package/dist/esm/utils/whileOnline.js +0 -11
  300. package/dist/examples/auth.html +0 -32
  301. package/dist/examples/cloud.html +0 -17
  302. package/dist/examples/index.html +0 -1
  303. package/dist/examples/neurosity.iife.js +0 -48712
  304. package/dist/examples/neurosity.js +0 -666
  305. package/dist/examples/neurosity.mjs +0 -48700
  306. package/dist/examples/training.html +0 -49
@@ -1,426 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { Observable, fromEventPattern, from, EMPTY } from "rxjs";
11
- import { map, switchMap } from "rxjs/operators";
12
- import firebase from "firebase/app";
13
- const SERVER_TIMESTAMP = firebase.database.ServerValue.TIMESTAMP;
14
- /**
15
- * @hidden
16
- */
17
- export const credentialWithLink = firebase.auth.EmailAuthProvider.credentialWithLink;
18
- /**
19
- * @hidden
20
- */
21
- export function createUser(...args) {
22
- return new firebase.User(...args);
23
- }
24
- /**
25
- * @hidden
26
- */
27
- export class FirebaseUser {
28
- constructor(firebaseApp) {
29
- this.app = firebaseApp.app;
30
- this.app.auth().onAuthStateChanged((user) => {
31
- this.user = user;
32
- });
33
- }
34
- auth() {
35
- return this.app.auth();
36
- }
37
- createAccount(credentials) {
38
- return __awaiter(this, void 0, void 0, function* () {
39
- const { email, password } = credentials;
40
- const [error, user] = yield this.app
41
- .auth()
42
- .createUserWithEmailAndPassword(email, password)
43
- .then((user) => [null, user])
44
- .catch((error) => [error, null]);
45
- if (error) {
46
- return Promise.reject(error);
47
- }
48
- return user;
49
- });
50
- }
51
- deleteAccount() {
52
- return __awaiter(this, void 0, void 0, function* () {
53
- const user = this.app.auth().currentUser;
54
- if (!user) {
55
- return Promise.reject(new Error(`You are trying to delete an account that is not authenticated. To delete an account, the account must have signed in recently.`));
56
- }
57
- const [devicesError, devices] = yield this.getDevices()
58
- .then((response) => [null, response])
59
- .catch((error) => [error, null]);
60
- if (devicesError) {
61
- return Promise.reject(devicesError);
62
- }
63
- if (devices.length) {
64
- const removeDeviceError = yield Promise.all(devices.map((device) => this.removeDevice(device.deviceId)))
65
- .then(() => null)
66
- .catch((error) => error);
67
- if (removeDeviceError) {
68
- return Promise.reject(removeDeviceError);
69
- }
70
- }
71
- return user.delete();
72
- });
73
- }
74
- onAuthStateChanged() {
75
- return new Observable((subscriber) => {
76
- try {
77
- this.app.auth().onAuthStateChanged((user) => {
78
- subscriber.next(user);
79
- }, (error) => {
80
- subscriber.error(error);
81
- });
82
- }
83
- catch (error) {
84
- subscriber.error(error);
85
- }
86
- });
87
- }
88
- onLogin() {
89
- return new Observable((subscriber) => {
90
- const unsubscribe = this.app
91
- .auth()
92
- .onAuthStateChanged((user) => {
93
- if (!!user) {
94
- subscriber.next(user);
95
- subscriber.complete();
96
- }
97
- });
98
- return () => unsubscribe();
99
- });
100
- }
101
- login(credentials) {
102
- if ("customToken" in credentials) {
103
- const { customToken } = credentials;
104
- return this.app.auth().signInWithCustomToken(customToken);
105
- }
106
- if ("idToken" in credentials && "providerId" in credentials) {
107
- const provider = new firebase.auth.OAuthProvider(credentials.providerId);
108
- const oAuthCredential = provider.credential(credentials.idToken);
109
- return this.app.auth().signInWithCredential(oAuthCredential);
110
- }
111
- if ("email" in credentials && "password" in credentials) {
112
- const { email, password } = credentials;
113
- return this.app
114
- .auth()
115
- .signInWithEmailAndPassword(email, password);
116
- }
117
- throw new Error(`Either {email,password}, {customToken}, or {idToken,providerId} is required`);
118
- }
119
- logout() {
120
- return this.app.auth().signOut();
121
- }
122
- createCustomToken() {
123
- return __awaiter(this, void 0, void 0, function* () {
124
- const [error, customToken] = yield this.app
125
- .functions()
126
- .httpsCallable("createCustomToken")()
127
- .then(({ data }) => [null, data])
128
- .catch((error) => [error, null]);
129
- if (error) {
130
- return Promise.reject(error);
131
- }
132
- return customToken;
133
- });
134
- }
135
- removeOAuthAccess() {
136
- var _a;
137
- return __awaiter(this, void 0, void 0, function* () {
138
- const userId = (_a = this.user) === null || _a === void 0 ? void 0 : _a.uid;
139
- if (!userId) {
140
- return Promise.reject(`OAuth access can only be removed while logged in via OAuth.`);
141
- }
142
- const [error, response] = yield this.app
143
- .functions()
144
- .httpsCallable("removeAccessOAuthApp")()
145
- .then(({ data }) => [null, data])
146
- .catch((error) => [error, null]);
147
- if (error) {
148
- return Promise.reject(error);
149
- }
150
- const logoutError = yield this.logout()
151
- .then(() => false)
152
- .catch((error) => error);
153
- if (logoutError) {
154
- return Promise.reject(logoutError);
155
- }
156
- return response;
157
- });
158
- }
159
- getDevices() {
160
- var _a;
161
- return __awaiter(this, void 0, void 0, function* () {
162
- const userId = (_a = this.user) === null || _a === void 0 ? void 0 : _a.uid;
163
- if (!userId) {
164
- return Promise.reject(`Please login.`);
165
- }
166
- const snapshot = yield this.app
167
- .database()
168
- .ref(this.getUserDevicesPath())
169
- .once("value");
170
- const userDevices = snapshot.val();
171
- return this.userDevicesToDeviceInfoList(userDevices);
172
- });
173
- }
174
- addDevice(deviceId) {
175
- var _a;
176
- return __awaiter(this, void 0, void 0, function* () {
177
- const userId = (_a = this.user) === null || _a === void 0 ? void 0 : _a.uid;
178
- if (!userId) {
179
- return Promise.reject(`Please login.`);
180
- }
181
- const devices = yield this.getDevices().catch((error) => {
182
- console.log(error);
183
- });
184
- const deviceAlreadyInAccount = devices &&
185
- devices.length &&
186
- devices.map(({ deviceId }) => deviceId).includes(deviceId);
187
- if (deviceAlreadyInAccount) {
188
- return Promise.reject(`The device is already added to this account.`);
189
- }
190
- const [isValid, invalidErrorMessage] = yield this.isDeviceIdValid(deviceId)
191
- .then((isValid) => [isValid])
192
- .catch((error) => [false, error]);
193
- if (!isValid) {
194
- return Promise.reject(invalidErrorMessage);
195
- }
196
- const claimedByPath = this.getDeviceClaimedByPath(deviceId);
197
- const userDevicePath = this.getUserClaimedDevicePath(deviceId);
198
- const [hasError, errorMessage] = yield this.app
199
- .database()
200
- .ref()
201
- .update({
202
- [claimedByPath]: userId,
203
- [userDevicePath]: {
204
- claimedOn: SERVER_TIMESTAMP
205
- }
206
- })
207
- .then(() => [false])
208
- .catch((error) => [true, error]);
209
- if (hasError) {
210
- return Promise.reject(errorMessage);
211
- }
212
- });
213
- }
214
- removeDevice(deviceId) {
215
- var _a;
216
- return __awaiter(this, void 0, void 0, function* () {
217
- const userId = (_a = this.user) === null || _a === void 0 ? void 0 : _a.uid;
218
- if (!userId) {
219
- return Promise.reject(`Please login.`);
220
- }
221
- const claimedByPath = this.getDeviceClaimedByPath(deviceId);
222
- const userDevicePath = this.getUserClaimedDevicePath(deviceId);
223
- const claimedByRef = this.app.database().ref(claimedByPath);
224
- const userDeviceRef = this.app.database().ref(userDevicePath);
225
- const [hasError, errorMessage] = yield Promise.all([
226
- claimedByRef.remove(),
227
- userDeviceRef.remove()
228
- ])
229
- .then(() => [false])
230
- .catch((error) => [true, error]);
231
- if (hasError) {
232
- return Promise.reject(errorMessage);
233
- }
234
- });
235
- }
236
- transferDevice(options) {
237
- var _a;
238
- return __awaiter(this, void 0, void 0, function* () {
239
- const userId = (_a = this.user) === null || _a === void 0 ? void 0 : _a.uid;
240
- if (!userId) {
241
- return Promise.reject(new Error(`transferDevice: auth is required.`));
242
- }
243
- if (!("recipientsEmail" in options) &&
244
- !("recipientsUserId" in options)) {
245
- return Promise.reject(new Error(`transferDevice: either 'recipientsEmail' or 'recipientsUserId' key is required.`));
246
- }
247
- if (!(options === null || options === void 0 ? void 0 : options.deviceId)) {
248
- return Promise.reject(new Error(`transferDevice: a deviceId is required.`));
249
- }
250
- const [error, response] = yield this.app
251
- .functions()
252
- .httpsCallable("transferDeviceOwnership")(options)
253
- .then(({ data }) => [null, data])
254
- .catch((error) => [error, null]);
255
- if (error) {
256
- return Promise.reject(error);
257
- }
258
- });
259
- }
260
- isDeviceIdValid(deviceId) {
261
- return __awaiter(this, void 0, void 0, function* () {
262
- // hex string of 32 characters
263
- const hexRegEx = /[0-9A-Fa-f]{32}/g;
264
- if (!deviceId ||
265
- deviceId.length !== 32 ||
266
- !hexRegEx.test(deviceId)) {
267
- return Promise.reject("The device id is incorrectly formatted.");
268
- }
269
- const claimedByPath = this.getDeviceClaimedByPath(deviceId);
270
- const claimedByRef = this.app.database().ref(claimedByPath);
271
- const claimedBySnapshot = yield claimedByRef
272
- .once("value")
273
- .catch(() => null);
274
- if (!claimedBySnapshot || claimedBySnapshot.exists()) {
275
- return Promise.reject("The device has already been claimed.");
276
- }
277
- return true;
278
- });
279
- }
280
- onUserDevicesChange() {
281
- return this.onAuthStateChanged().pipe(switchMap((user) => {
282
- if (!user) {
283
- return EMPTY;
284
- }
285
- const userDevicesPath = this.getUserDevicesPath();
286
- const userDevicesRef = this.app.database().ref(userDevicesPath);
287
- return fromEventPattern((handler) => userDevicesRef.on("value", handler), (handler) => userDevicesRef.off("value", handler)).pipe(map(([snapshot]) => snapshot.val()), switchMap((userDevices) => {
288
- return from(this.userDevicesToDeviceInfoList(userDevices));
289
- }));
290
- }));
291
- }
292
- onUserClaimsChange() {
293
- return this.onAuthStateChanged().pipe(switchMap((user) => {
294
- if (!user) {
295
- return EMPTY;
296
- }
297
- const claimsUpdatedOnPath = this.getUserClaimsUpdatedOnPath();
298
- const claimsUpdatedOnRef = this.app
299
- .database()
300
- .ref(claimsUpdatedOnPath);
301
- return fromEventPattern((handler) => claimsUpdatedOnRef.on("value", handler), (handler) => claimsUpdatedOnRef.off("value", handler)).pipe(map(([snapshot]) => snapshot.val()), switchMap(() => {
302
- // Force refresh of auth id token
303
- return from(this.getIdToken(true)).pipe(switchMap(() => from(this.getClaims())));
304
- }));
305
- }));
306
- }
307
- getIdToken(forceRefresh = false) {
308
- var _a;
309
- return __awaiter(this, void 0, void 0, function* () {
310
- const user = (_a = this.app.auth()) === null || _a === void 0 ? void 0 : _a.currentUser;
311
- if (!user) {
312
- return Promise.reject(`getUserIdToken: unable to get currentUser`);
313
- }
314
- yield user.getIdToken(forceRefresh).catch((error) => {
315
- console.error(error);
316
- });
317
- });
318
- }
319
- getClaims() {
320
- var _a;
321
- const user = (_a = this.app.auth()) === null || _a === void 0 ? void 0 : _a.currentUser;
322
- if (!user) {
323
- return Promise.reject(`getUserClaims: unable to get currentUser`);
324
- }
325
- return user
326
- .getIdTokenResult()
327
- .then((token) => token.claims)
328
- .catch((error) => {
329
- console.error(error);
330
- return null;
331
- });
332
- }
333
- userDevicesToDeviceInfoList(userDevices) {
334
- return __awaiter(this, void 0, void 0, function* () {
335
- const devicesInfoSnapshots = Object.keys(userDevices !== null && userDevices !== void 0 ? userDevices : {}).map((deviceId) => this.app
336
- .database()
337
- .ref(this.getDeviceInfoPath(deviceId))
338
- .once("value"));
339
- const devicesList = yield Promise.all(devicesInfoSnapshots).then((snapshots) => snapshots.map((snapshot) => snapshot.val()));
340
- const validDevices = devicesList.filter((device) => !!device);
341
- validDevices.sort((a, b) => {
342
- return (userDevices[a.deviceId].claimedOn -
343
- userDevices[b.deviceId].claimedOn);
344
- });
345
- return validDevices;
346
- });
347
- }
348
- hasDevicePermission(deviceId) {
349
- return __awaiter(this, void 0, void 0, function* () {
350
- const deviceInfoPath = this.getDeviceInfoPath(deviceId);
351
- const hasPermission = yield this.app
352
- .database()
353
- .ref(deviceInfoPath)
354
- .once("value")
355
- .then(() => true)
356
- .catch(() => false);
357
- return hasPermission;
358
- });
359
- }
360
- getDeviceClaimedByPath(deviceId) {
361
- return `devices/${deviceId}/status/claimedBy`;
362
- }
363
- getUserClaimedDevicePath(deviceId) {
364
- const userId = this.user.uid;
365
- return `users/${userId}/devices/${deviceId}`;
366
- }
367
- getUserDevicesPath() {
368
- const userId = this.user.uid;
369
- return `users/${userId}/devices`;
370
- }
371
- getUserClaimsUpdatedOnPath() {
372
- const userId = this.user.uid;
373
- return `users/${userId}/claimsUpdatedOn`;
374
- }
375
- getDeviceInfoPath(deviceId) {
376
- return `devices/${deviceId}/info`;
377
- }
378
- onUserExperiments() {
379
- return this.onAuthStateChanged().pipe(switchMap((user) => {
380
- if (!user) {
381
- return EMPTY;
382
- }
383
- const userId = this.user.uid;
384
- const userExperimentsRef = this.app
385
- .database()
386
- .ref("experiments")
387
- .orderByChild("userId")
388
- .equalTo(userId)
389
- .limitToFirst(100);
390
- return fromEventPattern((handler) => userExperimentsRef.on("value", handler), (handler) => userExperimentsRef.off("value", handler)).pipe(map(([snapshot]) => snapshot.val()),
391
- // transform experiments map into sorted list
392
- map((experimentsMaps) => {
393
- return Object.entries(experimentsMaps !== null && experimentsMaps !== void 0 ? experimentsMaps : {})
394
- .map(([id, value]) => {
395
- var _a;
396
- return (Object.assign({ id: (_a = value === null || value === void 0 ? void 0 : value.id) !== null && _a !== void 0 ? _a : id }, value));
397
- })
398
- .sort((a, b) => new Date(b === null || b === void 0 ? void 0 : b.timestamp).getTime() -
399
- new Date(a === null || a === void 0 ? void 0 : a.timestamp).getTime());
400
- }));
401
- }));
402
- }
403
- deleteUserExperiment(experimentId) {
404
- return __awaiter(this, void 0, void 0, function* () {
405
- if (!experimentId) {
406
- return Promise.reject(`deleteUserExperiment: please provide an experiment id`);
407
- }
408
- const removeExperiment = (experimentId) => {
409
- return this.app
410
- .database()
411
- .ref("experiments")
412
- .child(experimentId)
413
- .remove();
414
- };
415
- const removeRelations = (experimentId) => {
416
- return this.app.functions().httpsCallable("removeRelations")({
417
- experimentId
418
- });
419
- };
420
- yield Promise.all([
421
- removeExperiment(experimentId),
422
- removeRelations(experimentId)
423
- ]).catch(() => { });
424
- });
425
- }
426
- }
@@ -1,8 +0,0 @@
1
- export declare const config: {
2
- apiKey: string;
3
- authDomain: string;
4
- databaseURL: string;
5
- projectId: string;
6
- storageBucket: string;
7
- messagingSenderId: string;
8
- };
@@ -1,8 +0,0 @@
1
- export const config = {
2
- apiKey: "AIzaSyB0TkZ83Fj0CIzn8AAmE-Osc92s3ER8hy8",
3
- authDomain: "neurosity-device.firebaseapp.com",
4
- databaseURL: "https://neurosity-device.firebaseio.com",
5
- projectId: "neurosity-device",
6
- storageBucket: "neurosity-device.appspot.com",
7
- messagingSenderId: "212595049674"
8
- };
@@ -1,26 +0,0 @@
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
- };
@@ -1,184 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import firebase from "firebase/app";
11
- const SERVER_TIMESTAMP = firebase.database.ServerValue.TIMESTAMP;
12
- /**
13
- * @hidden
14
- */
15
- export const createDeviceStore = (app, deviceId, subscriptionManager) => {
16
- const deviceRef = app.database().ref(`devices/${deviceId}`);
17
- const clientId = deviceRef.child("subscriptions").push().key;
18
- const clientRef = deviceRef.child(`clients/${clientId}`);
19
- let listenersToRemove = [];
20
- const set = (namespace, payload) => {
21
- return deviceRef.child(namespace).set(payload);
22
- };
23
- const push = (namespace, payload) => {
24
- return deviceRef.child(namespace).push(payload);
25
- };
26
- const update = (namespace, payload) => {
27
- return deviceRef.child(namespace).update(payload);
28
- };
29
- const on = (eventType = "value", namespace, callback) => {
30
- const listener = deviceRef
31
- .child(namespace)
32
- .on(eventType, (snapshot) => {
33
- callback(snapshot.val(), snapshot);
34
- });
35
- listenersToRemove.push(() => {
36
- deviceRef.child(namespace).off(eventType, listener);
37
- });
38
- return listener;
39
- };
40
- const off = (namespace, eventType, listener) => {
41
- if (listener) {
42
- deviceRef.child(namespace).off(eventType, listener);
43
- }
44
- else {
45
- deviceRef.child(namespace).off(eventType);
46
- }
47
- };
48
- const once = (namespace, eventType = "value") => __awaiter(void 0, void 0, void 0, function* () {
49
- const snapshot = yield deviceRef.child(namespace).once(eventType);
50
- return snapshot.val();
51
- });
52
- const remove = (namespace) => {
53
- deviceRef.child(namespace).remove();
54
- };
55
- const bindListener = (eventType, namespace, callback, overrideResponse) => {
56
- on(eventType, namespace, (data) => {
57
- if (data !== null) {
58
- off(namespace, eventType);
59
- const response = overrideResponse ? overrideResponse : data;
60
- callback(response);
61
- }
62
- });
63
- };
64
- const lastOfChildValue = (namespace, key, value) => __awaiter(void 0, void 0, void 0, function* () {
65
- const snapshot = yield deviceRef
66
- .child(namespace)
67
- .orderByChild(key)
68
- .equalTo(value)
69
- .limitToLast(1)
70
- .once("value");
71
- const results = snapshot.val();
72
- const [match] = Object.values(results || {});
73
- return match || null;
74
- });
75
- // Add client connections and subscriptions to db and remove them when offline
76
- const connectedListener = app
77
- .database()
78
- .ref(".info/connected")
79
- .on("value", (snapshot) => {
80
- if (!snapshot.val()) {
81
- return;
82
- }
83
- clientRef
84
- .onDisconnect()
85
- .remove()
86
- .then(() => {
87
- clientRef.set(SERVER_TIMESTAMP);
88
- // NOTION-115: Re-subscribe when internet connection is lost and regained
89
- update("subscriptions", subscriptionManager.get()).then(() => {
90
- subscriptionManager.toList().forEach((subscription) => {
91
- const childPath = `subscriptions/${subscription.id}`;
92
- deviceRef.child(childPath).onDisconnect().remove();
93
- });
94
- });
95
- });
96
- });
97
- listenersToRemove.push(() => {
98
- app
99
- .database()
100
- .ref(".info/connected")
101
- .off("value", connectedListener);
102
- });
103
- return {
104
- set,
105
- once,
106
- update,
107
- lastOfChildValue,
108
- onNamespace: (namespace, callback) => {
109
- return on("value", namespace, (data) => {
110
- callback(data);
111
- });
112
- },
113
- offNamespace: (namespace, listener) => {
114
- off(namespace, "value", listener);
115
- },
116
- dispatchAction: (action) => __awaiter(void 0, void 0, void 0, function* () {
117
- const snapshot = yield push("actions", action);
118
- const actionId = snapshot.key;
119
- const actionPath = `actions/${actionId}`;
120
- snapshot.onDisconnect().remove();
121
- if (action.responseRequired) {
122
- const responseTimeout = action.responseTimeout || 600000; // defaults to 10 minutes
123
- const timeout = new Promise((_, reject) => {
124
- const id = setTimeout(() => {
125
- clearTimeout(id);
126
- snapshot.remove();
127
- reject(`Action response timed out in ${responseTimeout}ms.`);
128
- }, responseTimeout);
129
- });
130
- const response = new Promise((resolve) => {
131
- bindListener("value", `${actionPath}/response`, resolve);
132
- });
133
- return Promise.race([response, timeout]);
134
- }
135
- return actionId;
136
- }),
137
- nextMetric: (metricName, metricValue) => __awaiter(void 0, void 0, void 0, function* () {
138
- set(`metrics/${metricName}`, metricValue);
139
- }),
140
- onMetric: (subscription, callback) => {
141
- const { atomic, metric, labels } = subscription;
142
- const child = atomic
143
- ? `metrics/${metric}`
144
- : `metrics/${metric}/${labels[0]}`;
145
- return on("value", child, (data) => {
146
- if (data !== null) {
147
- callback(data);
148
- }
149
- });
150
- },
151
- subscribeToMetric: (subscription) => {
152
- const id = deviceRef.child("subscriptions").push().key;
153
- const childPath = `subscriptions/${id}`;
154
- const subscriptionCreated = Object.assign({ id,
155
- clientId }, subscription);
156
- set(childPath, subscriptionCreated);
157
- deviceRef.child(childPath).onDisconnect().remove();
158
- return subscriptionCreated;
159
- },
160
- unsubscribeFromMetric: (subscription) => {
161
- remove(`subscriptions/${subscription.id}`);
162
- },
163
- removeMetricListener(subscription, listener) {
164
- const { atomic, metric, labels } = subscription;
165
- const child = atomic
166
- ? `metrics/${metric}`
167
- : `metrics/${metric}/${labels[0]}`;
168
- off(child, "value", listener);
169
- },
170
- disconnect() {
171
- clientRef.remove();
172
- listenersToRemove.forEach((removeListener) => {
173
- removeListener();
174
- });
175
- subscriptionManager
176
- .toList()
177
- .filter((subscription) => subscription.clientId === clientId)
178
- .forEach((subscription) => {
179
- const childPath = `subscriptions/${subscription.id}`;
180
- deviceRef.child(childPath).remove();
181
- });
182
- }
183
- };
184
- };
@@ -1,3 +0,0 @@
1
- export * from "./FirebaseApp";
2
- export * from "./FirebaseUser";
3
- export * from "./FirebaseDevice";
@@ -1,3 +0,0 @@
1
- export * from "./FirebaseApp";
2
- export * from "./FirebaseUser";
3
- export * from "./FirebaseDevice";
@@ -1 +0,0 @@
1
- export declare const prodFunctionsBaseUrl = "https://us-central1-neurosity-device.cloudfunctions.net";
@@ -1 +0,0 @@
1
- export const prodFunctionsBaseUrl = "https://us-central1-neurosity-device.cloudfunctions.net";
@@ -1,3 +0,0 @@
1
- import { SDKOptions } from "../../types/options";
2
- import { OAuthConfig } from "../../types/oauth";
3
- export declare function createOAuthURL(config: OAuthConfig, sdkOptions: SDKOptions): Promise<string>;
@@ -1,11 +0,0 @@
1
- import axios from "axios";
2
- import { getFunctionsBaseURL } from "./utils";
3
- export function createOAuthURL(config, sdkOptions) {
4
- const { clientId, clientSecret, responseType, redirectUri, scope, state } = config;
5
- const baseUrl = getFunctionsBaseURL(sdkOptions);
6
- return axios
7
- .get(`${baseUrl}/authorize/entry`, {
8
- params: Object.assign(Object.assign({ client_id: clientId }, (clientSecret ? { client_secret: clientSecret } : {})), { response_type: responseType, redirect_uri: redirectUri, scope: scope.join(","), state: state, redirect: "false" })
9
- })
10
- .then((response) => `${baseUrl}${response.data.url}`);
11
- }