@brightchain/brightchain-api-lib 0.23.21 → 0.24.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 (452) hide show
  1. package/package.json +5 -5
  2. package/src/lib/__tests__/fixtures/mock-backend-brightchain-member.d.ts.map +1 -1
  3. package/src/lib/__tests__/fixtures/mock-backend-brightchain-member.js +11 -0
  4. package/src/lib/__tests__/fixtures/mock-backend-brightchain-member.js.map +1 -1
  5. package/src/lib/__tests__/fixtures/mocked-model.js +63 -60
  6. package/src/lib/__tests__/fixtures/mocked-model.js.map +1 -1
  7. package/src/lib/application.d.ts +1 -1
  8. package/src/lib/application.d.ts.map +1 -1
  9. package/src/lib/application.js +113 -33
  10. package/src/lib/application.js.map +1 -1
  11. package/src/lib/auth/aclEnforcedAvailability.js +4 -0
  12. package/src/lib/auth/aclEnforcedAvailability.js.map +1 -1
  13. package/src/lib/auth/aclEnforcedBlockStore.js +7 -0
  14. package/src/lib/auth/aclEnforcedBlockStore.js.map +1 -1
  15. package/src/lib/auth/ecdsaNodeAuthenticator.js +1 -0
  16. package/src/lib/auth/ecdsaNodeAuthenticator.js.map +1 -1
  17. package/src/lib/auth/poolAclBootstrap.js +2 -0
  18. package/src/lib/auth/poolAclBootstrap.js.map +1 -1
  19. package/src/lib/auth/poolAclStore.js +2 -1
  20. package/src/lib/auth/poolAclStore.js.map +1 -1
  21. package/src/lib/auth/poolAclUpdater.js +4 -0
  22. package/src/lib/auth/poolAclUpdater.js.map +1 -1
  23. package/src/lib/availability/availabilityMetrics.js +43 -45
  24. package/src/lib/availability/availabilityMetrics.js.map +1 -1
  25. package/src/lib/availability/availabilityService.js +26 -20
  26. package/src/lib/availability/availabilityService.js.map +1 -1
  27. package/src/lib/availability/blockRegistry.js +46 -25
  28. package/src/lib/availability/blockRegistry.js.map +1 -1
  29. package/src/lib/availability/discoveryProtocol.js +10 -8
  30. package/src/lib/availability/discoveryProtocol.js.map +1 -1
  31. package/src/lib/availability/gossipService.js +56 -45
  32. package/src/lib/availability/gossipService.js.map +1 -1
  33. package/src/lib/availability/heartbeatMonitor.js +22 -20
  34. package/src/lib/availability/heartbeatMonitor.js.map +1 -1
  35. package/src/lib/availability/poolDiscoveryService.js +7 -1
  36. package/src/lib/availability/poolDiscoveryService.js.map +1 -1
  37. package/src/lib/availability/quorumGossipHandler.js +13 -6
  38. package/src/lib/availability/quorumGossipHandler.js.map +1 -1
  39. package/src/lib/availability/reconciliationService.js +18 -12
  40. package/src/lib/availability/reconciliationService.js.map +1 -1
  41. package/src/lib/blockFetch/blockFetcher.js +14 -8
  42. package/src/lib/blockFetch/blockFetcher.js.map +1 -1
  43. package/src/lib/blockFetch/fetchQueue.js +9 -7
  44. package/src/lib/blockFetch/fetchQueue.js.map +1 -1
  45. package/src/lib/blockFetch/httpBlockFetchTransport.js +2 -0
  46. package/src/lib/blockFetch/httpBlockFetchTransport.js.map +1 -1
  47. package/src/lib/browserKeyring.js +5 -2
  48. package/src/lib/browserKeyring.js.map +1 -1
  49. package/src/lib/controllers/api/blocks.d.ts.map +1 -1
  50. package/src/lib/controllers/api/blocks.js +9 -3
  51. package/src/lib/controllers/api/blocks.js.map +1 -1
  52. package/src/lib/controllers/api/brighthub/connectionController.d.ts +80 -0
  53. package/src/lib/controllers/api/brighthub/connectionController.d.ts.map +1 -0
  54. package/src/lib/controllers/api/brighthub/connectionController.js +890 -0
  55. package/src/lib/controllers/api/brighthub/connectionController.js.map +1 -0
  56. package/src/lib/controllers/api/brighthub/index.d.ts +9 -0
  57. package/src/lib/controllers/api/brighthub/index.d.ts.map +1 -0
  58. package/src/lib/controllers/api/brighthub/index.js +12 -0
  59. package/src/lib/controllers/api/brighthub/index.js.map +1 -0
  60. package/src/lib/controllers/api/brighthub/messagingController.d.ts +84 -0
  61. package/src/lib/controllers/api/brighthub/messagingController.d.ts.map +1 -0
  62. package/src/lib/controllers/api/brighthub/messagingController.js +1077 -0
  63. package/src/lib/controllers/api/brighthub/messagingController.js.map +1 -0
  64. package/src/lib/controllers/api/brighthub/notificationController.d.ts +89 -0
  65. package/src/lib/controllers/api/brighthub/notificationController.d.ts.map +1 -0
  66. package/src/lib/controllers/api/brighthub/notificationController.js +444 -0
  67. package/src/lib/controllers/api/brighthub/notificationController.js.map +1 -0
  68. package/src/lib/controllers/api/brighthub/postController.d.ts +75 -0
  69. package/src/lib/controllers/api/brighthub/postController.d.ts.map +1 -0
  70. package/src/lib/controllers/api/brighthub/postController.js +388 -0
  71. package/src/lib/controllers/api/brighthub/postController.js.map +1 -0
  72. package/src/lib/controllers/api/brighthub/timelineController.d.ts +74 -0
  73. package/src/lib/controllers/api/brighthub/timelineController.d.ts.map +1 -0
  74. package/src/lib/controllers/api/brighthub/timelineController.js +418 -0
  75. package/src/lib/controllers/api/brighthub/timelineController.js.map +1 -0
  76. package/src/lib/controllers/api/brightpass.d.ts.map +1 -1
  77. package/src/lib/controllers/api/brightpass.js +46 -4
  78. package/src/lib/controllers/api/brightpass.js.map +1 -1
  79. package/src/lib/controllers/api/cbl.js +1 -0
  80. package/src/lib/controllers/api/cbl.js.map +1 -1
  81. package/src/lib/controllers/api/channels.js +2 -2
  82. package/src/lib/controllers/api/channels.js.map +1 -1
  83. package/src/lib/controllers/api/conversations.js +1 -1
  84. package/src/lib/controllers/api/conversations.js.map +1 -1
  85. package/src/lib/controllers/api/docs.js +2 -1
  86. package/src/lib/controllers/api/docs.js.map +1 -1
  87. package/src/lib/controllers/api/emails.d.ts.map +1 -1
  88. package/src/lib/controllers/api/emails.js +16 -2
  89. package/src/lib/controllers/api/emails.js.map +1 -1
  90. package/src/lib/controllers/api/explodingMessages.js +2 -4
  91. package/src/lib/controllers/api/explodingMessages.js.map +1 -1
  92. package/src/lib/controllers/api/groups.js +2 -2
  93. package/src/lib/controllers/api/groups.js.map +1 -1
  94. package/src/lib/controllers/api/health.d.ts +9 -2
  95. package/src/lib/controllers/api/health.d.ts.map +1 -1
  96. package/src/lib/controllers/api/health.js +48 -6
  97. package/src/lib/controllers/api/health.js.map +1 -1
  98. package/src/lib/controllers/api/index.d.ts +1 -0
  99. package/src/lib/controllers/api/index.d.ts.map +1 -1
  100. package/src/lib/controllers/api/index.js +1 -0
  101. package/src/lib/controllers/api/index.js.map +1 -1
  102. package/src/lib/controllers/api/introspection.js +2 -0
  103. package/src/lib/controllers/api/introspection.js.map +1 -1
  104. package/src/lib/controllers/api/messages.js +1 -1
  105. package/src/lib/controllers/api/messages.js.map +1 -1
  106. package/src/lib/controllers/api/nodes.js +6 -6
  107. package/src/lib/controllers/api/nodes.js.map +1 -1
  108. package/src/lib/controllers/api/quorum.d.ts +1 -1
  109. package/src/lib/controllers/api/quorum.d.ts.map +1 -1
  110. package/src/lib/controllers/api/quorum.js +3 -2
  111. package/src/lib/controllers/api/quorum.js.map +1 -1
  112. package/src/lib/controllers/api/scbl.js +3 -0
  113. package/src/lib/controllers/api/scbl.js.map +1 -1
  114. package/src/lib/controllers/api/sessions.d.ts +18 -2
  115. package/src/lib/controllers/api/sessions.d.ts.map +1 -1
  116. package/src/lib/controllers/api/sessions.js +60 -3
  117. package/src/lib/controllers/api/sessions.js.map +1 -1
  118. package/src/lib/controllers/api/sync.js +4 -4
  119. package/src/lib/controllers/api/sync.js.map +1 -1
  120. package/src/lib/controllers/api/user.d.ts +2 -0
  121. package/src/lib/controllers/api/user.d.ts.map +1 -1
  122. package/src/lib/controllers/api/user.js +95 -3
  123. package/src/lib/controllers/api/user.js.map +1 -1
  124. package/src/lib/controllers/identity/deviceController.js +2 -2
  125. package/src/lib/controllers/identity/deviceController.js.map +1 -1
  126. package/src/lib/controllers/identity/directoryController.js +1 -1
  127. package/src/lib/controllers/identity/directoryController.js.map +1 -1
  128. package/src/lib/controllers/identity/identityProofController.js +4 -6
  129. package/src/lib/controllers/identity/identityProofController.js.map +1 -1
  130. package/src/lib/databaseInit.d.ts +3 -3
  131. package/src/lib/databaseInit.js +5 -5
  132. package/src/lib/databaseInit.js.map +1 -1
  133. package/src/lib/datastore/block-document-store.d.ts.map +1 -1
  134. package/src/lib/datastore/block-document-store.js +18 -6
  135. package/src/lib/datastore/block-document-store.js.map +1 -1
  136. package/src/lib/datastore/document-store.d.ts.map +1 -1
  137. package/src/lib/datastore/memory-document-store.js +5 -2
  138. package/src/lib/datastore/memory-document-store.js.map +1 -1
  139. package/src/lib/encryption/encryptedMetadataService.js +2 -0
  140. package/src/lib/encryption/encryptedMetadataService.js.map +1 -1
  141. package/src/lib/encryption/encryptionAwareReplication.js +3 -0
  142. package/src/lib/encryption/encryptionAwareReplication.js.map +1 -1
  143. package/src/lib/encryption/errors.d.ts.map +1 -1
  144. package/src/lib/encryption/errors.js +8 -0
  145. package/src/lib/encryption/errors.js.map +1 -1
  146. package/src/lib/encryption/poolKeyManager.js +2 -0
  147. package/src/lib/encryption/poolKeyManager.js.map +1 -1
  148. package/src/lib/environment.js +10 -0
  149. package/src/lib/environment.js.map +1 -1
  150. package/src/lib/errors/express-validation.js +1 -0
  151. package/src/lib/errors/express-validation.js.map +1 -1
  152. package/src/lib/errors/invalid-backup-code-version.js +1 -0
  153. package/src/lib/errors/invalid-backup-code-version.js.map +1 -1
  154. package/src/lib/errors/memberIndexSchemaValidationError.js +1 -0
  155. package/src/lib/errors/memberIndexSchemaValidationError.js.map +1 -1
  156. package/src/lib/errors/missing-validated-data.js +2 -0
  157. package/src/lib/errors/missing-validated-data.js.map +1 -1
  158. package/src/lib/errors/token-not-found.js +1 -0
  159. package/src/lib/errors/token-not-found.js.map +1 -1
  160. package/src/lib/errors/typed-error-local.js +3 -0
  161. package/src/lib/errors/typed-error-local.js.map +1 -1
  162. package/src/lib/interfaces/brightpass/index.d.ts +103 -0
  163. package/src/lib/interfaces/brightpass/index.d.ts.map +1 -0
  164. package/src/lib/interfaces/brightpass/index.js +11 -0
  165. package/src/lib/interfaces/brightpass/index.js.map +1 -0
  166. package/src/lib/interfaces/environment.d.ts +1 -1
  167. package/src/lib/interfaces/environment.d.ts.map +1 -1
  168. package/src/lib/interfaces/index.d.ts +1 -0
  169. package/src/lib/interfaces/index.d.ts.map +1 -1
  170. package/src/lib/interfaces/member/memberProfileResponse.d.ts.map +1 -1
  171. package/src/lib/interfaces/member/operational.d.ts.map +1 -1
  172. package/src/lib/interfaces/member-init-config.d.ts +1 -1
  173. package/src/lib/interfaces/member-init-config.d.ts.map +1 -1
  174. package/src/lib/interfaces/responses/api-backup-codes-response.d.ts.map +1 -1
  175. package/src/lib/interfaces/responses/api-challenge-response.d.ts.map +1 -1
  176. package/src/lib/interfaces/responses/api-code-count-response.d.ts.map +1 -1
  177. package/src/lib/interfaces/responses/api-detailed-health-response.d.ts.map +1 -1
  178. package/src/lib/interfaces/responses/api-discover-block-response.d.ts.map +1 -1
  179. package/src/lib/interfaces/responses/api-express-validation-error.d.ts.map +1 -1
  180. package/src/lib/interfaces/responses/api-get-block-response.d.ts.map +1 -1
  181. package/src/lib/interfaces/responses/api-get-node-response.d.ts.map +1 -1
  182. package/src/lib/interfaces/responses/api-health-response.d.ts.map +1 -1
  183. package/src/lib/interfaces/responses/api-list-nodes-response.d.ts.map +1 -1
  184. package/src/lib/interfaces/responses/api-login-response.d.ts.map +1 -1
  185. package/src/lib/interfaces/responses/api-members-response.d.ts.map +1 -1
  186. package/src/lib/interfaces/responses/api-mnemonic-response.d.ts.map +1 -1
  187. package/src/lib/interfaces/responses/api-reconcile-response.d.ts.map +1 -1
  188. package/src/lib/interfaces/responses/api-register-node-response.d.ts.map +1 -1
  189. package/src/lib/interfaces/responses/api-registration-response.d.ts.map +1 -1
  190. package/src/lib/interfaces/responses/api-replicate-block-response.d.ts.map +1 -1
  191. package/src/lib/interfaces/responses/api-request-user-response.d.ts.map +1 -1
  192. package/src/lib/interfaces/responses/api-store-block-response.d.ts.map +1 -1
  193. package/src/lib/interfaces/responses/api-store-cbl-response.d.ts.map +1 -1
  194. package/src/lib/interfaces/responses/api-sync-request-response.d.ts.map +1 -1
  195. package/src/lib/interfaces/responses/brighthub/api-connection-response.d.ts +21 -0
  196. package/src/lib/interfaces/responses/brighthub/api-connection-response.d.ts.map +1 -0
  197. package/src/lib/interfaces/responses/brighthub/api-connection-response.js +3 -0
  198. package/src/lib/interfaces/responses/brighthub/api-connection-response.js.map +1 -0
  199. package/src/lib/interfaces/responses/brighthub/api-messaging-response.d.ts +39 -0
  200. package/src/lib/interfaces/responses/brighthub/api-messaging-response.d.ts.map +1 -0
  201. package/src/lib/interfaces/responses/brighthub/api-messaging-response.js +3 -0
  202. package/src/lib/interfaces/responses/brighthub/api-messaging-response.js.map +1 -0
  203. package/src/lib/interfaces/responses/brighthub/api-notification-response.d.ts +30 -0
  204. package/src/lib/interfaces/responses/brighthub/api-notification-response.d.ts.map +1 -0
  205. package/src/lib/interfaces/responses/brighthub/api-notification-response.js +3 -0
  206. package/src/lib/interfaces/responses/brighthub/api-notification-response.js.map +1 -0
  207. package/src/lib/interfaces/responses/brighthub/api-post-response.d.ts +21 -0
  208. package/src/lib/interfaces/responses/brighthub/api-post-response.d.ts.map +1 -0
  209. package/src/lib/interfaces/responses/brighthub/api-post-response.js +3 -0
  210. package/src/lib/interfaces/responses/brighthub/api-post-response.js.map +1 -0
  211. package/src/lib/interfaces/responses/brighthub/api-timeline-response.d.ts +14 -0
  212. package/src/lib/interfaces/responses/brighthub/api-timeline-response.d.ts.map +1 -0
  213. package/src/lib/interfaces/responses/brighthub/api-timeline-response.js +3 -0
  214. package/src/lib/interfaces/responses/brighthub/api-timeline-response.js.map +1 -0
  215. package/src/lib/interfaces/responses/brighthub/api-user-profile-response.d.ts +10 -0
  216. package/src/lib/interfaces/responses/brighthub/api-user-profile-response.d.ts.map +1 -0
  217. package/src/lib/interfaces/responses/brighthub/api-user-profile-response.js +3 -0
  218. package/src/lib/interfaces/responses/brighthub/api-user-profile-response.js.map +1 -0
  219. package/src/lib/interfaces/responses/brighthub/index.d.ts +13 -0
  220. package/src/lib/interfaces/responses/brighthub/index.d.ts.map +1 -0
  221. package/src/lib/interfaces/responses/brighthub/index.js +9 -0
  222. package/src/lib/interfaces/responses/brighthub/index.js.map +1 -0
  223. package/src/lib/interfaces/responses/index.d.ts +1 -0
  224. package/src/lib/interfaces/responses/index.d.ts.map +1 -1
  225. package/src/lib/interfaces/storage/storedDocumentTypes.d.ts +1 -1
  226. package/src/lib/interfaces/storage/storedDocumentTypes.js +1 -1
  227. package/src/lib/interfaces/storage/userRoleSchema.d.ts.map +1 -1
  228. package/src/lib/interfaces/storage/userRoleSchema.js +1 -3
  229. package/src/lib/interfaces/storage/userRoleSchema.js.map +1 -1
  230. package/src/lib/middlewares.js +31 -31
  231. package/src/lib/middlewares.js.map +1 -1
  232. package/src/lib/nodeKeyring.js +2 -0
  233. package/src/lib/nodeKeyring.js.map +1 -1
  234. package/src/lib/plugins/brightchain-database-plugin.d.ts +14 -14
  235. package/src/lib/plugins/brightchain-database-plugin.d.ts.map +1 -1
  236. package/src/lib/plugins/brightchain-database-plugin.js +36 -34
  237. package/src/lib/plugins/brightchain-database-plugin.js.map +1 -1
  238. package/src/lib/routers/api.d.ts +63 -1
  239. package/src/lib/routers/api.d.ts.map +1 -1
  240. package/src/lib/routers/api.js +126 -2
  241. package/src/lib/routers/api.js.map +1 -1
  242. package/src/lib/routers/app.d.ts.map +1 -1
  243. package/src/lib/routers/app.js +10 -1
  244. package/src/lib/routers/app.js.map +1 -1
  245. package/src/lib/routers/base.js +2 -0
  246. package/src/lib/routers/base.js.map +1 -1
  247. package/src/lib/routers/index.d.ts +1 -0
  248. package/src/lib/routers/index.d.ts.map +1 -1
  249. package/src/lib/routers/index.js +1 -0
  250. package/src/lib/routers/index.js.map +1 -1
  251. package/src/lib/routers/testEmailRouter.d.ts +15 -0
  252. package/src/lib/routers/testEmailRouter.d.ts.map +1 -0
  253. package/src/lib/routers/testEmailRouter.js +34 -0
  254. package/src/lib/routers/testEmailRouter.js.map +1 -0
  255. package/src/lib/secureEnclaveKeyring.js +4 -2
  256. package/src/lib/secureEnclaveKeyring.js.map +1 -1
  257. package/src/lib/services/auth.d.ts.map +1 -1
  258. package/src/lib/services/auth.js +11 -2
  259. package/src/lib/services/auth.js.map +1 -1
  260. package/src/lib/services/base.js +1 -0
  261. package/src/lib/services/base.js.map +1 -1
  262. package/src/lib/services/blockServiceFactory.js +2 -0
  263. package/src/lib/services/blockServiceFactory.js.map +1 -1
  264. package/src/lib/services/blockStore.js +3 -2
  265. package/src/lib/services/blockStore.js.map +1 -1
  266. package/src/lib/services/blocks.js +1 -0
  267. package/src/lib/services/blocks.js.map +1 -1
  268. package/src/lib/services/brightChainBackupCodeService.d.ts +114 -0
  269. package/src/lib/services/brightChainBackupCodeService.d.ts.map +1 -0
  270. package/src/lib/services/brightChainBackupCodeService.js +303 -0
  271. package/src/lib/services/brightChainBackupCodeService.js.map +1 -0
  272. package/src/lib/services/brightchain-authentication-provider.d.ts.map +1 -1
  273. package/src/lib/services/brightchain-authentication-provider.js +40 -9
  274. package/src/lib/services/brightchain-authentication-provider.js.map +1 -1
  275. package/src/lib/services/brightchain-member-init.service.d.ts +17 -17
  276. package/src/lib/services/brightchain-member-init.service.d.ts.map +1 -1
  277. package/src/lib/services/brightchain-member-init.service.js +12 -9
  278. package/src/lib/services/brightchain-member-init.service.js.map +1 -1
  279. package/src/lib/services/brighthub/connectionService.d.ts +286 -0
  280. package/src/lib/services/brighthub/connectionService.d.ts.map +1 -0
  281. package/src/lib/services/brighthub/connectionService.js +1887 -0
  282. package/src/lib/services/brighthub/connectionService.js.map +1 -0
  283. package/src/lib/services/brighthub/discoveryService.d.ts +110 -0
  284. package/src/lib/services/brighthub/discoveryService.d.ts.map +1 -0
  285. package/src/lib/services/brighthub/discoveryService.js +528 -0
  286. package/src/lib/services/brighthub/discoveryService.js.map +1 -0
  287. package/src/lib/services/brighthub/feedService.d.ts +141 -0
  288. package/src/lib/services/brighthub/feedService.d.ts.map +1 -0
  289. package/src/lib/services/brighthub/feedService.js +418 -0
  290. package/src/lib/services/brighthub/feedService.js.map +1 -0
  291. package/src/lib/services/brighthub/index.d.ts +11 -0
  292. package/src/lib/services/brighthub/index.d.ts.map +1 -0
  293. package/src/lib/services/brighthub/index.js +14 -0
  294. package/src/lib/services/brighthub/index.js.map +1 -0
  295. package/src/lib/services/brighthub/messagingService.d.ts +109 -0
  296. package/src/lib/services/brighthub/messagingService.d.ts.map +1 -0
  297. package/src/lib/services/brighthub/messagingService.js +947 -0
  298. package/src/lib/services/brighthub/messagingService.js.map +1 -0
  299. package/src/lib/services/brighthub/messagingService.test-helpers.d.ts +75 -0
  300. package/src/lib/services/brighthub/messagingService.test-helpers.d.ts.map +1 -0
  301. package/src/lib/services/brighthub/messagingService.test-helpers.js +237 -0
  302. package/src/lib/services/brighthub/messagingService.test-helpers.js.map +1 -0
  303. package/src/lib/services/brighthub/notificationService.d.ts +172 -0
  304. package/src/lib/services/brighthub/notificationService.d.ts.map +1 -0
  305. package/src/lib/services/brighthub/notificationService.js +768 -0
  306. package/src/lib/services/brighthub/notificationService.js.map +1 -0
  307. package/src/lib/services/brighthub/notificationService.test-helpers.d.ts +75 -0
  308. package/src/lib/services/brighthub/notificationService.test-helpers.d.ts.map +1 -0
  309. package/src/lib/services/brighthub/notificationService.test-helpers.js +230 -0
  310. package/src/lib/services/brighthub/notificationService.test-helpers.js.map +1 -0
  311. package/src/lib/services/brighthub/postService.d.ts +129 -0
  312. package/src/lib/services/brighthub/postService.d.ts.map +1 -0
  313. package/src/lib/services/brighthub/postService.js +470 -0
  314. package/src/lib/services/brighthub/postService.js.map +1 -0
  315. package/src/lib/services/brighthub/postService.test-helpers.d.ts +40 -0
  316. package/src/lib/services/brighthub/postService.test-helpers.d.ts.map +1 -0
  317. package/src/lib/services/brighthub/postService.test-helpers.js +84 -0
  318. package/src/lib/services/brighthub/postService.test-helpers.js.map +1 -0
  319. package/src/lib/services/brighthub/textFormatter.d.ts +64 -0
  320. package/src/lib/services/brighthub/textFormatter.d.ts.map +1 -0
  321. package/src/lib/services/brighthub/textFormatter.js +256 -0
  322. package/src/lib/services/brighthub/textFormatter.js.map +1 -0
  323. package/src/lib/services/brighthub/threadService.d.ts +79 -0
  324. package/src/lib/services/brighthub/threadService.d.ts.map +1 -0
  325. package/src/lib/services/brighthub/threadService.js +246 -0
  326. package/src/lib/services/brighthub/threadService.js.map +1 -0
  327. package/src/lib/services/brighthub/userProfileService.d.ts +203 -0
  328. package/src/lib/services/brighthub/userProfileService.d.ts.map +1 -0
  329. package/src/lib/services/brighthub/userProfileService.js +868 -0
  330. package/src/lib/services/brighthub/userProfileService.js.map +1 -0
  331. package/src/lib/services/brighthub/userProfileService.test-helpers.d.ts +86 -0
  332. package/src/lib/services/brighthub/userProfileService.test-helpers.d.ts.map +1 -0
  333. package/src/lib/services/brighthub/userProfileService.test-helpers.js +169 -0
  334. package/src/lib/services/brighthub/userProfileService.test-helpers.js.map +1 -0
  335. package/src/lib/services/brighthub/webSocketServer.d.ts +68 -0
  336. package/src/lib/services/brighthub/webSocketServer.d.ts.map +1 -0
  337. package/src/lib/services/brighthub/webSocketServer.js +194 -0
  338. package/src/lib/services/brighthub/webSocketServer.js.map +1 -0
  339. package/src/lib/services/brightpass/auditLogger.js +10 -5
  340. package/src/lib/services/brightpass/auditLogger.js.map +1 -1
  341. package/src/lib/services/brightpass/vaultEncryption.js +8 -8
  342. package/src/lib/services/brightpass/vaultEncryption.js.map +1 -1
  343. package/src/lib/services/brightpass.js +16 -8
  344. package/src/lib/services/brightpass.js.map +1 -1
  345. package/src/lib/services/cliOperatorPrompt.js +5 -2
  346. package/src/lib/services/cliOperatorPrompt.js.map +1 -1
  347. package/src/lib/services/clientWebSocketServer.d.ts +69 -4
  348. package/src/lib/services/clientWebSocketServer.d.ts.map +1 -1
  349. package/src/lib/services/clientWebSocketServer.js +188 -10
  350. package/src/lib/services/clientWebSocketServer.js.map +1 -1
  351. package/src/lib/services/contentAwareBlocksService.js +2 -0
  352. package/src/lib/services/contentAwareBlocksService.js.map +1 -1
  353. package/src/lib/services/contentIngestionService.d.ts.map +1 -1
  354. package/src/lib/services/contentIngestionService.js +2 -0
  355. package/src/lib/services/contentIngestionService.js.map +1 -1
  356. package/src/lib/services/diskQuorumService.js +3 -0
  357. package/src/lib/services/diskQuorumService.js.map +1 -1
  358. package/src/lib/services/email.js +5 -0
  359. package/src/lib/services/email.js.map +1 -1
  360. package/src/lib/services/eventNotificationSystem.d.ts +51 -10
  361. package/src/lib/services/eventNotificationSystem.d.ts.map +1 -1
  362. package/src/lib/services/eventNotificationSystem.js +76 -23
  363. package/src/lib/services/eventNotificationSystem.js.map +1 -1
  364. package/src/lib/services/expirationScheduler.js +6 -3
  365. package/src/lib/services/expirationScheduler.js.map +1 -1
  366. package/src/lib/services/fakeEmailService.d.ts +68 -0
  367. package/src/lib/services/fakeEmailService.d.ts.map +1 -0
  368. package/src/lib/services/fakeEmailService.js +110 -0
  369. package/src/lib/services/fakeEmailService.js.map +1 -0
  370. package/src/lib/services/fec.js +1 -3
  371. package/src/lib/services/fec.js.map +1 -1
  372. package/src/lib/services/fecServiceFactory.js +2 -2
  373. package/src/lib/services/fecServiceFactory.js.map +1 -1
  374. package/src/lib/services/fecUsageExample.js +1 -3
  375. package/src/lib/services/fecUsageExample.js.map +1 -1
  376. package/src/lib/services/identityExpirationScheduler.d.ts.map +1 -1
  377. package/src/lib/services/identityExpirationScheduler.js +7 -2
  378. package/src/lib/services/identityExpirationScheduler.js.map +1 -1
  379. package/src/lib/services/index.d.ts +3 -1
  380. package/src/lib/services/index.d.ts.map +1 -1
  381. package/src/lib/services/index.js +3 -1
  382. package/src/lib/services/index.js.map +1 -1
  383. package/src/lib/services/messageEventsWebSocketHandler.js +1 -0
  384. package/src/lib/services/messageEventsWebSocketHandler.js.map +1 -1
  385. package/src/lib/services/messagePassingService.js +5 -0
  386. package/src/lib/services/messagePassingService.js.map +1 -1
  387. package/src/lib/services/nativeRsFecService.js +3 -5
  388. package/src/lib/services/nativeRsFecService.js.map +1 -1
  389. package/src/lib/services/presenceService.js +5 -4
  390. package/src/lib/services/presenceService.js.map +1 -1
  391. package/src/lib/services/quorum.js +3 -2
  392. package/src/lib/services/quorum.js.map +1 -1
  393. package/src/lib/services/quorumDatabaseAdapter.d.ts +5 -5
  394. package/src/lib/services/quorumDatabaseAdapter.d.ts.map +1 -1
  395. package/src/lib/services/quorumDatabaseAdapter.js +5 -3
  396. package/src/lib/services/quorumDatabaseAdapter.js.map +1 -1
  397. package/src/lib/services/rbac-input-builder.js +5 -0
  398. package/src/lib/services/rbac-input-builder.js.map +1 -1
  399. package/src/lib/services/secureKeyStorage.js +3 -0
  400. package/src/lib/services/secureKeyStorage.js.map +1 -1
  401. package/src/lib/services/sessionAdapter.d.ts +4 -4
  402. package/src/lib/services/sessionAdapter.d.ts.map +1 -1
  403. package/src/lib/services/sessionAdapter.js +3 -2
  404. package/src/lib/services/sessionAdapter.js.map +1 -1
  405. package/src/lib/services/webSocketMessageServer.js +7 -4
  406. package/src/lib/services/webSocketMessageServer.js.map +1 -1
  407. package/src/lib/services/webSocketPeerProvider.js +2 -1
  408. package/src/lib/services/webSocketPeerProvider.js.map +1 -1
  409. package/src/lib/services/websocketHandler.js +9 -1
  410. package/src/lib/services/websocketHandler.js.map +1 -1
  411. package/src/lib/shared-types.d.ts +1 -2
  412. package/src/lib/shared-types.d.ts.map +1 -1
  413. package/src/lib/stores/__tests__/helpers/mockCloudBlockStore.d.ts +63 -0
  414. package/src/lib/stores/__tests__/helpers/mockCloudBlockStore.d.ts.map +1 -0
  415. package/src/lib/stores/__tests__/helpers/mockCloudBlockStore.js +160 -0
  416. package/src/lib/stores/__tests__/helpers/mockCloudBlockStore.js.map +1 -0
  417. package/src/lib/stores/availabilityAwareBlockStore.js +34 -5
  418. package/src/lib/stores/availabilityAwareBlockStore.js.map +1 -1
  419. package/src/lib/stores/cloudBlockStoreBase.d.ts +121 -0
  420. package/src/lib/stores/cloudBlockStoreBase.d.ts.map +1 -0
  421. package/src/lib/stores/cloudBlockStoreBase.js +1165 -0
  422. package/src/lib/stores/cloudBlockStoreBase.js.map +1 -0
  423. package/src/lib/stores/diskBlockAsyncStore.js +9 -5
  424. package/src/lib/stores/diskBlockAsyncStore.js.map +1 -1
  425. package/src/lib/stores/diskBlockMetadataStore.js +2 -0
  426. package/src/lib/stores/diskBlockMetadataStore.js.map +1 -1
  427. package/src/lib/stores/diskBlockStore.js +10 -8
  428. package/src/lib/stores/diskBlockStore.js.map +1 -1
  429. package/src/lib/stores/diskCBLStore.d.ts.map +1 -1
  430. package/src/lib/stores/diskCBLStore.js +8 -0
  431. package/src/lib/stores/diskCBLStore.js.map +1 -1
  432. package/src/lib/stores/index.d.ts +1 -0
  433. package/src/lib/stores/index.d.ts.map +1 -1
  434. package/src/lib/stores/index.js +1 -0
  435. package/src/lib/stores/index.js.map +1 -1
  436. package/src/lib/systemKeyring.d.ts.map +1 -1
  437. package/src/lib/systemKeyring.js +5 -4
  438. package/src/lib/systemKeyring.js.map +1 -1
  439. package/src/lib/transforms/checksumTransform.js +1 -0
  440. package/src/lib/transforms/checksumTransform.js.map +1 -1
  441. package/src/lib/transforms/memoryWritableStream.js +1 -0
  442. package/src/lib/transforms/memoryWritableStream.js.map +1 -1
  443. package/src/lib/transforms/xorMultipleTransform.js +3 -0
  444. package/src/lib/transforms/xorMultipleTransform.js.map +1 -1
  445. package/src/lib/utils/rehydration.d.ts +1 -1
  446. package/src/lib/utils/rehydration.js +1 -1
  447. package/src/lib/utils/serialization.d.ts +1 -1
  448. package/src/lib/utils/serialization.js +1 -1
  449. package/src/lib/services/backupCodeService.d.ts +0 -35
  450. package/src/lib/services/backupCodeService.d.ts.map +0 -1
  451. package/src/lib/services/backupCodeService.js +0 -109
  452. package/src/lib/services/backupCodeService.js.map +0 -1
@@ -0,0 +1,890 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BrightHubConnectionController = void 0;
4
+ const brighthub_lib_1 = require("@brightchain/brighthub-lib");
5
+ const node_express_suite_1 = require("@digitaldefiance/node-express-suite");
6
+ const errorResponse_1 = require("../../../utils/errorResponse");
7
+ const base_1 = require("../../base");
8
+ /**
9
+ * Controller for BrightHub connection management operations.
10
+ *
11
+ * Provides REST API endpoints for connection lists, categories, hubs,
12
+ * notes, suggestions, mutual connections, and follow requests.
13
+ *
14
+ * @requirements 34.1-34.22
15
+ */
16
+ class BrightHubConnectionController extends base_1.BaseController {
17
+ connectionService = null;
18
+ discoveryService = null;
19
+ userProfileService = null;
20
+ constructor(application) {
21
+ super(application);
22
+ }
23
+ setConnectionService(service) {
24
+ this.connectionService = service;
25
+ }
26
+ setDiscoveryService(service) {
27
+ this.discoveryService = service;
28
+ }
29
+ setUserProfileService(service) {
30
+ this.userProfileService = service;
31
+ }
32
+ getConnectionService() {
33
+ if (!this.connectionService)
34
+ throw new Error('ConnectionService not initialized');
35
+ return this.connectionService;
36
+ }
37
+ getDiscoveryService() {
38
+ if (!this.discoveryService)
39
+ throw new Error('DiscoveryService not initialized');
40
+ return this.discoveryService;
41
+ }
42
+ getUserProfileService() {
43
+ if (!this.userProfileService)
44
+ throw new Error('UserProfileService not initialized');
45
+ return this.userProfileService;
46
+ }
47
+ mapConnectionError(error) {
48
+ switch (error.code) {
49
+ case brighthub_lib_1.ConnectionServiceErrorCode.ListNotFound:
50
+ case brighthub_lib_1.ConnectionServiceErrorCode.CategoryNotFound:
51
+ case brighthub_lib_1.ConnectionServiceErrorCode.HubNotFound:
52
+ case brighthub_lib_1.ConnectionServiceErrorCode.NoteNotFound:
53
+ return (0, errorResponse_1.notFoundError)('Resource', 'unknown');
54
+ case brighthub_lib_1.ConnectionServiceErrorCode.ListNotAuthorized:
55
+ case brighthub_lib_1.ConnectionServiceErrorCode.CategoryNotAuthorized:
56
+ case brighthub_lib_1.ConnectionServiceErrorCode.HubNotAuthorized:
57
+ return (0, errorResponse_1.forbiddenError)(error.message);
58
+ case brighthub_lib_1.ConnectionServiceErrorCode.ListLimitExceeded:
59
+ case brighthub_lib_1.ConnectionServiceErrorCode.ListMemberLimitExceeded:
60
+ case brighthub_lib_1.ConnectionServiceErrorCode.CategoryLimitExceeded:
61
+ case brighthub_lib_1.ConnectionServiceErrorCode.HubLimitExceeded:
62
+ case brighthub_lib_1.ConnectionServiceErrorCode.HubMemberLimitExceeded:
63
+ case brighthub_lib_1.ConnectionServiceErrorCode.PriorityLimitExceeded:
64
+ case brighthub_lib_1.ConnectionServiceErrorCode.NoteTooLong:
65
+ case brighthub_lib_1.ConnectionServiceErrorCode.InvalidImportFormat:
66
+ case brighthub_lib_1.ConnectionServiceErrorCode.ImportRateLimited:
67
+ return (0, errorResponse_1.validationError)(error.message);
68
+ default:
69
+ return (0, errorResponse_1.handleError)(error);
70
+ }
71
+ }
72
+ parsePaginationOptions(query) {
73
+ const options = {};
74
+ if (query['cursor'])
75
+ options.cursor = query['cursor'];
76
+ if (query['limit'])
77
+ options.limit = parseInt(query['limit'], 10);
78
+ return options;
79
+ }
80
+ initRouteDefinitions() {
81
+ this.routeDefinitions = [
82
+ // ── List Management (21.3) ──
83
+ (0, node_express_suite_1.routeConfig)('post', '/lists', {
84
+ handlerKey: 'createList',
85
+ useAuthentication: false,
86
+ useCryptoAuthentication: false,
87
+ openapi: {
88
+ summary: 'Create a connection list',
89
+ tags: ['BrightHub Connections'],
90
+ responses: {
91
+ 201: {
92
+ schema: 'ConnectionListResponse',
93
+ description: 'List created',
94
+ },
95
+ },
96
+ },
97
+ }),
98
+ (0, node_express_suite_1.routeConfig)('get', '/lists', {
99
+ handlerKey: 'getUserLists',
100
+ useAuthentication: false,
101
+ useCryptoAuthentication: false,
102
+ openapi: {
103
+ summary: "Get user's connection lists",
104
+ tags: ['BrightHub Connections'],
105
+ responses: {
106
+ 200: {
107
+ schema: 'ConnectionListsResponse',
108
+ description: 'Lists retrieved',
109
+ },
110
+ },
111
+ },
112
+ }),
113
+ (0, node_express_suite_1.routeConfig)('put', '/lists/:id', {
114
+ handlerKey: 'updateList',
115
+ useAuthentication: false,
116
+ useCryptoAuthentication: false,
117
+ openapi: {
118
+ summary: 'Update a connection list',
119
+ tags: ['BrightHub Connections'],
120
+ responses: {
121
+ 200: {
122
+ schema: 'ConnectionListResponse',
123
+ description: 'List updated',
124
+ },
125
+ },
126
+ },
127
+ }),
128
+ (0, node_express_suite_1.routeConfig)('delete', '/lists/:id', {
129
+ handlerKey: 'deleteList',
130
+ useAuthentication: false,
131
+ useCryptoAuthentication: false,
132
+ openapi: {
133
+ summary: 'Delete a connection list',
134
+ tags: ['BrightHub Connections'],
135
+ responses: {
136
+ 204: { schema: 'EmptyResponse', description: 'List deleted' },
137
+ },
138
+ },
139
+ }),
140
+ (0, node_express_suite_1.routeConfig)('post', '/lists/:id/members', {
141
+ handlerKey: 'addMembers',
142
+ useAuthentication: false,
143
+ useCryptoAuthentication: false,
144
+ openapi: {
145
+ summary: 'Add members to a list',
146
+ tags: ['BrightHub Connections'],
147
+ responses: {
148
+ 200: { schema: 'MessageResponse', description: 'Members added' },
149
+ },
150
+ },
151
+ }),
152
+ (0, node_express_suite_1.routeConfig)('delete', '/lists/:id/members', {
153
+ handlerKey: 'removeMembers',
154
+ useAuthentication: false,
155
+ useCryptoAuthentication: false,
156
+ openapi: {
157
+ summary: 'Remove members from a list',
158
+ tags: ['BrightHub Connections'],
159
+ responses: {
160
+ 200: { schema: 'MessageResponse', description: 'Members removed' },
161
+ },
162
+ },
163
+ }),
164
+ (0, node_express_suite_1.routeConfig)('get', '/lists/:id/members', {
165
+ handlerKey: 'getListMembers',
166
+ useAuthentication: false,
167
+ useCryptoAuthentication: false,
168
+ openapi: {
169
+ summary: 'Get list members',
170
+ tags: ['BrightHub Connections'],
171
+ responses: {
172
+ 200: {
173
+ schema: 'PaginatedResponse',
174
+ description: 'Members retrieved',
175
+ },
176
+ },
177
+ },
178
+ }),
179
+ // ── Additional Endpoints (21.4) ──
180
+ (0, node_express_suite_1.routeConfig)('get', '/connections/categories', {
181
+ handlerKey: 'getCategories',
182
+ useAuthentication: false,
183
+ useCryptoAuthentication: false,
184
+ openapi: {
185
+ summary: 'Get connection categories',
186
+ tags: ['BrightHub Connections'],
187
+ responses: {
188
+ 200: {
189
+ schema: 'CategoriesResponse',
190
+ description: 'Categories retrieved',
191
+ },
192
+ },
193
+ },
194
+ }),
195
+ (0, node_express_suite_1.routeConfig)('post', '/connections/:id/note', {
196
+ handlerKey: 'addNote',
197
+ useAuthentication: false,
198
+ useCryptoAuthentication: false,
199
+ openapi: {
200
+ summary: 'Add a note to a connection',
201
+ tags: ['BrightHub Connections'],
202
+ responses: {
203
+ 200: { schema: 'MessageResponse', description: 'Note added' },
204
+ },
205
+ },
206
+ }),
207
+ (0, node_express_suite_1.routeConfig)('get', '/connections/suggestions', {
208
+ handlerKey: 'getSuggestions',
209
+ useAuthentication: false,
210
+ useCryptoAuthentication: false,
211
+ openapi: {
212
+ summary: 'Get connection suggestions',
213
+ tags: ['BrightHub Connections'],
214
+ responses: {
215
+ 200: {
216
+ schema: 'SuggestionsResponse',
217
+ description: 'Suggestions retrieved',
218
+ },
219
+ },
220
+ },
221
+ }),
222
+ (0, node_express_suite_1.routeConfig)('get', '/connections/mutual/:userId', {
223
+ handlerKey: 'getMutualConnections',
224
+ useAuthentication: false,
225
+ useCryptoAuthentication: false,
226
+ openapi: {
227
+ summary: 'Get mutual connections',
228
+ tags: ['BrightHub Connections'],
229
+ responses: {
230
+ 200: {
231
+ schema: 'PaginatedResponse',
232
+ description: 'Mutual connections retrieved',
233
+ },
234
+ },
235
+ },
236
+ }),
237
+ (0, node_express_suite_1.routeConfig)('post', '/connections/:id/priority', {
238
+ handlerKey: 'setPriority',
239
+ useAuthentication: false,
240
+ useCryptoAuthentication: false,
241
+ openapi: {
242
+ summary: 'Set connection priority',
243
+ tags: ['BrightHub Connections'],
244
+ responses: {
245
+ 200: { schema: 'MessageResponse', description: 'Priority updated' },
246
+ },
247
+ },
248
+ }),
249
+ (0, node_express_suite_1.routeConfig)('post', '/connections/:id/quiet', {
250
+ handlerKey: 'setQuietMode',
251
+ useAuthentication: false,
252
+ useCryptoAuthentication: false,
253
+ openapi: {
254
+ summary: 'Set quiet mode for connection',
255
+ tags: ['BrightHub Connections'],
256
+ responses: {
257
+ 200: {
258
+ schema: 'MessageResponse',
259
+ description: 'Quiet mode updated',
260
+ },
261
+ },
262
+ },
263
+ }),
264
+ (0, node_express_suite_1.routeConfig)('post', '/connections/:id/mute/temporary', {
265
+ handlerKey: 'setTemporaryMute',
266
+ useAuthentication: false,
267
+ useCryptoAuthentication: false,
268
+ openapi: {
269
+ summary: 'Set temporary mute for connection',
270
+ tags: ['BrightHub Connections'],
271
+ responses: {
272
+ 200: {
273
+ schema: 'MessageResponse',
274
+ description: 'Temporary mute set',
275
+ },
276
+ },
277
+ },
278
+ }),
279
+ (0, node_express_suite_1.routeConfig)('get', '/connections/export', {
280
+ handlerKey: 'exportConnections',
281
+ useAuthentication: false,
282
+ useCryptoAuthentication: false,
283
+ openapi: {
284
+ summary: 'Export connections',
285
+ tags: ['BrightHub Connections'],
286
+ responses: {
287
+ 200: {
288
+ schema: 'ExportResponse',
289
+ description: 'Connections exported',
290
+ },
291
+ },
292
+ },
293
+ }),
294
+ (0, node_express_suite_1.routeConfig)('post', '/connections/import', {
295
+ handlerKey: 'importConnections',
296
+ useAuthentication: false,
297
+ useCryptoAuthentication: false,
298
+ openapi: {
299
+ summary: 'Import connections',
300
+ tags: ['BrightHub Connections'],
301
+ responses: {
302
+ 200: {
303
+ schema: 'ImportResponse',
304
+ description: 'Connections imported',
305
+ },
306
+ },
307
+ },
308
+ }),
309
+ (0, node_express_suite_1.routeConfig)('post', '/hubs', {
310
+ handlerKey: 'createHub',
311
+ useAuthentication: false,
312
+ useCryptoAuthentication: false,
313
+ openapi: {
314
+ summary: 'Create a hub',
315
+ tags: ['BrightHub Connections'],
316
+ responses: {
317
+ 201: { schema: 'HubResponse', description: 'Hub created' },
318
+ },
319
+ },
320
+ }),
321
+ (0, node_express_suite_1.routeConfig)('get', '/hubs', {
322
+ handlerKey: 'getHubs',
323
+ useAuthentication: false,
324
+ useCryptoAuthentication: false,
325
+ openapi: {
326
+ summary: "Get user's hubs",
327
+ tags: ['BrightHub Connections'],
328
+ responses: {
329
+ 200: {
330
+ schema: 'HubsResponse',
331
+ description: 'Hubs retrieved',
332
+ },
333
+ },
334
+ },
335
+ }),
336
+ (0, node_express_suite_1.routeConfig)('get', '/connections/:id/insights', {
337
+ handlerKey: 'getConnectionInsights',
338
+ useAuthentication: false,
339
+ useCryptoAuthentication: false,
340
+ openapi: {
341
+ summary: 'Get connection insights',
342
+ tags: ['BrightHub Connections'],
343
+ responses: {
344
+ 200: {
345
+ schema: 'InsightsResponse',
346
+ description: 'Insights retrieved',
347
+ },
348
+ },
349
+ },
350
+ }),
351
+ (0, node_express_suite_1.routeConfig)('get', '/follow-requests', {
352
+ handlerKey: 'getFollowRequests',
353
+ useAuthentication: false,
354
+ useCryptoAuthentication: false,
355
+ openapi: {
356
+ summary: 'Get pending follow requests',
357
+ tags: ['BrightHub Connections'],
358
+ responses: {
359
+ 200: {
360
+ schema: 'FollowRequestsResponse',
361
+ description: 'Follow requests retrieved',
362
+ },
363
+ },
364
+ },
365
+ }),
366
+ (0, node_express_suite_1.routeConfig)('post', '/follow-requests/:id/approve', {
367
+ handlerKey: 'approveFollowRequest',
368
+ useAuthentication: false,
369
+ useCryptoAuthentication: false,
370
+ openapi: {
371
+ summary: 'Approve a follow request',
372
+ tags: ['BrightHub Connections'],
373
+ responses: {
374
+ 200: { schema: 'MessageResponse', description: 'Request approved' },
375
+ },
376
+ },
377
+ }),
378
+ (0, node_express_suite_1.routeConfig)('post', '/follow-requests/:id/reject', {
379
+ handlerKey: 'rejectFollowRequest',
380
+ useAuthentication: false,
381
+ useCryptoAuthentication: false,
382
+ openapi: {
383
+ summary: 'Reject a follow request',
384
+ tags: ['BrightHub Connections'],
385
+ responses: {
386
+ 200: { schema: 'MessageResponse', description: 'Request rejected' },
387
+ },
388
+ },
389
+ }),
390
+ ];
391
+ node_express_suite_1.ControllerRegistry.register('/brighthub', 'BrightHubConnectionController', this.routeDefinitions);
392
+ this.handlers = {
393
+ createList: this.handleCreateList.bind(this),
394
+ getUserLists: this.handleGetUserLists.bind(this),
395
+ updateList: this.handleUpdateList.bind(this),
396
+ deleteList: this.handleDeleteList.bind(this),
397
+ addMembers: this.handleAddMembers.bind(this),
398
+ removeMembers: this.handleRemoveMembers.bind(this),
399
+ getListMembers: this.handleGetListMembers.bind(this),
400
+ getCategories: this.handleGetCategories.bind(this),
401
+ addNote: this.handleAddNote.bind(this),
402
+ getSuggestions: this.handleGetSuggestions.bind(this),
403
+ getMutualConnections: this.handleGetMutualConnections.bind(this),
404
+ setPriority: this.handleSetPriority.bind(this),
405
+ setQuietMode: this.handleSetQuietMode.bind(this),
406
+ setTemporaryMute: this.handleSetTemporaryMute.bind(this),
407
+ exportConnections: this.handleExportConnections.bind(this),
408
+ importConnections: this.handleImportConnections.bind(this),
409
+ createHub: this.handleCreateHub.bind(this),
410
+ getHubs: this.handleGetHubs.bind(this),
411
+ getConnectionInsights: this.handleGetConnectionInsights.bind(this),
412
+ getFollowRequests: this.handleGetFollowRequests.bind(this),
413
+ approveFollowRequest: this.handleApproveFollowRequest.bind(this),
414
+ rejectFollowRequest: this.handleRejectFollowRequest.bind(this),
415
+ };
416
+ }
417
+ // ═══════════════════════════════════════════════════════
418
+ // List Management Handlers (21.3)
419
+ // ═══════════════════════════════════════════════════════
420
+ async handleCreateList(req) {
421
+ try {
422
+ const { ownerId, name, description, visibility } = req.body;
423
+ if (!ownerId)
424
+ return (0, errorResponse_1.validationError)('Missing required field: ownerId');
425
+ if (!name)
426
+ return (0, errorResponse_1.validationError)('Missing required field: name');
427
+ const list = await this.getConnectionService().createList(ownerId, name, {
428
+ description,
429
+ visibility: visibility,
430
+ });
431
+ return {
432
+ statusCode: 201,
433
+ response: { message: 'List created', data: list },
434
+ };
435
+ }
436
+ catch (error) {
437
+ if (error instanceof brighthub_lib_1.ConnectionServiceError)
438
+ return this.mapConnectionError(error);
439
+ return (0, errorResponse_1.handleError)(error);
440
+ }
441
+ }
442
+ async handleGetUserLists(req) {
443
+ try {
444
+ const typedReq = req;
445
+ const userId = typedReq.query['userId'];
446
+ if (!userId)
447
+ return (0, errorResponse_1.validationError)('Missing required query parameter: userId');
448
+ const options = this.parsePaginationOptions(typedReq.query);
449
+ const result = await this.getConnectionService().getUserLists(userId, options);
450
+ return {
451
+ statusCode: 200,
452
+ response: {
453
+ message: 'OK',
454
+ data: {
455
+ lists: result.items,
456
+ cursor: result.cursor,
457
+ hasMore: result.hasMore,
458
+ },
459
+ },
460
+ };
461
+ }
462
+ catch (error) {
463
+ if (error instanceof brighthub_lib_1.ConnectionServiceError)
464
+ return this.mapConnectionError(error);
465
+ return (0, errorResponse_1.handleError)(error);
466
+ }
467
+ }
468
+ async handleUpdateList(req) {
469
+ try {
470
+ const { id } = req.params;
471
+ const { ownerId, name, description, visibility } = req.body;
472
+ if (!id)
473
+ return (0, errorResponse_1.validationError)('Missing required parameter: id');
474
+ if (!ownerId)
475
+ return (0, errorResponse_1.validationError)('Missing required field: ownerId');
476
+ const updates = {};
477
+ if (name !== undefined)
478
+ updates['name'] = name;
479
+ if (description !== undefined)
480
+ updates['description'] = description;
481
+ if (visibility !== undefined)
482
+ updates['visibility'] = visibility;
483
+ const list = await this.getConnectionService().updateList(id, ownerId, updates);
484
+ return {
485
+ statusCode: 200,
486
+ response: { message: 'List updated', data: list },
487
+ };
488
+ }
489
+ catch (error) {
490
+ if (error instanceof brighthub_lib_1.ConnectionServiceError)
491
+ return this.mapConnectionError(error);
492
+ return (0, errorResponse_1.handleError)(error);
493
+ }
494
+ }
495
+ async handleDeleteList(req) {
496
+ try {
497
+ const { id } = req.params;
498
+ const { ownerId } = req.body;
499
+ if (!id)
500
+ return (0, errorResponse_1.validationError)('Missing required parameter: id');
501
+ if (!ownerId)
502
+ return (0, errorResponse_1.validationError)('Missing required field: ownerId');
503
+ await this.getConnectionService().deleteList(id, ownerId);
504
+ return { statusCode: 204, response: { message: 'List deleted' } };
505
+ }
506
+ catch (error) {
507
+ if (error instanceof brighthub_lib_1.ConnectionServiceError)
508
+ return this.mapConnectionError(error);
509
+ return (0, errorResponse_1.handleError)(error);
510
+ }
511
+ }
512
+ async handleAddMembers(req) {
513
+ try {
514
+ const { id } = req.params;
515
+ const { ownerId, userIds } = req.body;
516
+ if (!id)
517
+ return (0, errorResponse_1.validationError)('Missing required parameter: id');
518
+ if (!ownerId)
519
+ return (0, errorResponse_1.validationError)('Missing required field: ownerId');
520
+ if (!userIds || !Array.isArray(userIds))
521
+ return (0, errorResponse_1.validationError)('Missing required field: userIds (array)');
522
+ await this.getConnectionService().addMembersToList(id, ownerId, userIds);
523
+ return { statusCode: 200, response: { message: 'Members added' } };
524
+ }
525
+ catch (error) {
526
+ if (error instanceof brighthub_lib_1.ConnectionServiceError)
527
+ return this.mapConnectionError(error);
528
+ return (0, errorResponse_1.handleError)(error);
529
+ }
530
+ }
531
+ async handleRemoveMembers(req) {
532
+ try {
533
+ const { id } = req.params;
534
+ const { ownerId, userIds } = req.body;
535
+ if (!id)
536
+ return (0, errorResponse_1.validationError)('Missing required parameter: id');
537
+ if (!ownerId)
538
+ return (0, errorResponse_1.validationError)('Missing required field: ownerId');
539
+ if (!userIds || !Array.isArray(userIds))
540
+ return (0, errorResponse_1.validationError)('Missing required field: userIds (array)');
541
+ await this.getConnectionService().removeMembersFromList(id, ownerId, userIds);
542
+ return { statusCode: 200, response: { message: 'Members removed' } };
543
+ }
544
+ catch (error) {
545
+ if (error instanceof brighthub_lib_1.ConnectionServiceError)
546
+ return this.mapConnectionError(error);
547
+ return (0, errorResponse_1.handleError)(error);
548
+ }
549
+ }
550
+ async handleGetListMembers(req) {
551
+ try {
552
+ const { id } = req.params;
553
+ if (!id)
554
+ return (0, errorResponse_1.validationError)('Missing required parameter: id');
555
+ const typedReq = req;
556
+ const options = this.parsePaginationOptions(typedReq.query);
557
+ const result = await this.getConnectionService().getListMembers(id, options);
558
+ return {
559
+ statusCode: 200,
560
+ response: { message: 'OK', data: result },
561
+ };
562
+ }
563
+ catch (error) {
564
+ if (error instanceof brighthub_lib_1.ConnectionServiceError)
565
+ return this.mapConnectionError(error);
566
+ return (0, errorResponse_1.handleError)(error);
567
+ }
568
+ }
569
+ // ═══════════════════════════════════════════════════════
570
+ // Additional Endpoint Handlers (21.4)
571
+ // ═══════════════════════════════════════════════════════
572
+ async handleGetCategories(req) {
573
+ try {
574
+ const typedReq = req;
575
+ const userId = typedReq.query['userId'];
576
+ if (!userId)
577
+ return (0, errorResponse_1.validationError)('Missing required query parameter: userId');
578
+ const categories = await this.getConnectionService().getDefaultCategories(userId);
579
+ return {
580
+ statusCode: 200,
581
+ response: { message: 'OK', data: categories },
582
+ };
583
+ }
584
+ catch (error) {
585
+ if (error instanceof brighthub_lib_1.ConnectionServiceError)
586
+ return this.mapConnectionError(error);
587
+ return (0, errorResponse_1.handleError)(error);
588
+ }
589
+ }
590
+ async handleAddNote(req) {
591
+ try {
592
+ const { id } = req.params;
593
+ const { userId, note } = req.body;
594
+ if (!id)
595
+ return (0, errorResponse_1.validationError)('Missing required parameter: id');
596
+ if (!userId)
597
+ return (0, errorResponse_1.validationError)('Missing required field: userId');
598
+ if (!note)
599
+ return (0, errorResponse_1.validationError)('Missing required field: note');
600
+ await this.getConnectionService().addNote(userId, id, note);
601
+ return { statusCode: 200, response: { message: 'Note added' } };
602
+ }
603
+ catch (error) {
604
+ if (error instanceof brighthub_lib_1.ConnectionServiceError)
605
+ return this.mapConnectionError(error);
606
+ return (0, errorResponse_1.handleError)(error);
607
+ }
608
+ }
609
+ async handleGetSuggestions(req) {
610
+ try {
611
+ const typedReq = req;
612
+ const userId = typedReq.query['userId'];
613
+ if (!userId)
614
+ return (0, errorResponse_1.validationError)('Missing required query parameter: userId');
615
+ const limit = typedReq.query['limit']
616
+ ? parseInt(typedReq.query['limit'], 10)
617
+ : undefined;
618
+ const cursor = typedReq.query['cursor'];
619
+ const result = await this.getDiscoveryService().getSuggestions(userId, {
620
+ limit,
621
+ cursor,
622
+ });
623
+ return {
624
+ statusCode: 200,
625
+ response: { message: 'OK', data: result },
626
+ };
627
+ }
628
+ catch (error) {
629
+ return (0, errorResponse_1.handleError)(error);
630
+ }
631
+ }
632
+ async handleGetMutualConnections(req) {
633
+ try {
634
+ const { userId: targetUserId } = req
635
+ .params;
636
+ const typedReq = req;
637
+ const userId = typedReq.query['userId'];
638
+ if (!userId)
639
+ return (0, errorResponse_1.validationError)('Missing required query parameter: userId');
640
+ if (!targetUserId)
641
+ return (0, errorResponse_1.validationError)('Missing required parameter: userId');
642
+ const options = this.parsePaginationOptions(typedReq.query);
643
+ const result = await this.getConnectionService().getMutualConnections(userId, targetUserId, options);
644
+ return {
645
+ statusCode: 200,
646
+ response: { message: 'OK', data: result },
647
+ };
648
+ }
649
+ catch (error) {
650
+ if (error instanceof brighthub_lib_1.ConnectionServiceError)
651
+ return this.mapConnectionError(error);
652
+ return (0, errorResponse_1.handleError)(error);
653
+ }
654
+ }
655
+ async handleSetPriority(req) {
656
+ try {
657
+ const { id } = req.params;
658
+ const { userId, isPriority } = req.body;
659
+ if (!id)
660
+ return (0, errorResponse_1.validationError)('Missing required parameter: id');
661
+ if (!userId)
662
+ return (0, errorResponse_1.validationError)('Missing required field: userId');
663
+ if (isPriority === undefined)
664
+ return (0, errorResponse_1.validationError)('Missing required field: isPriority');
665
+ await this.getConnectionService().setPriority(userId, id, isPriority);
666
+ return {
667
+ statusCode: 200,
668
+ response: { message: isPriority ? 'Priority set' : 'Priority removed' },
669
+ };
670
+ }
671
+ catch (error) {
672
+ if (error instanceof brighthub_lib_1.ConnectionServiceError)
673
+ return this.mapConnectionError(error);
674
+ return (0, errorResponse_1.handleError)(error);
675
+ }
676
+ }
677
+ async handleSetQuietMode(req) {
678
+ try {
679
+ const { id } = req.params;
680
+ const { userId, isQuiet } = req.body;
681
+ if (!id)
682
+ return (0, errorResponse_1.validationError)('Missing required parameter: id');
683
+ if (!userId)
684
+ return (0, errorResponse_1.validationError)('Missing required field: userId');
685
+ if (isQuiet === undefined)
686
+ return (0, errorResponse_1.validationError)('Missing required field: isQuiet');
687
+ await this.getConnectionService().setQuietMode(userId, id, isQuiet);
688
+ return {
689
+ statusCode: 200,
690
+ response: {
691
+ message: isQuiet ? 'Quiet mode enabled' : 'Quiet mode disabled',
692
+ },
693
+ };
694
+ }
695
+ catch (error) {
696
+ if (error instanceof brighthub_lib_1.ConnectionServiceError)
697
+ return this.mapConnectionError(error);
698
+ return (0, errorResponse_1.handleError)(error);
699
+ }
700
+ }
701
+ async handleSetTemporaryMute(req) {
702
+ try {
703
+ const { id } = req.params;
704
+ const { userId, duration } = req.body;
705
+ if (!id)
706
+ return (0, errorResponse_1.validationError)('Missing required parameter: id');
707
+ if (!userId)
708
+ return (0, errorResponse_1.validationError)('Missing required field: userId');
709
+ if (!duration)
710
+ return (0, errorResponse_1.validationError)('Missing required field: duration');
711
+ await this.getConnectionService().setTemporaryMute(userId, id, duration);
712
+ return { statusCode: 200, response: { message: 'Temporary mute set' } };
713
+ }
714
+ catch (error) {
715
+ if (error instanceof brighthub_lib_1.ConnectionServiceError)
716
+ return this.mapConnectionError(error);
717
+ return (0, errorResponse_1.handleError)(error);
718
+ }
719
+ }
720
+ async handleExportConnections(req) {
721
+ try {
722
+ const typedReq = req;
723
+ const userId = typedReq.query['userId'];
724
+ if (!userId)
725
+ return (0, errorResponse_1.validationError)('Missing required query parameter: userId');
726
+ const exportData = await this.getConnectionService().exportConnections(userId);
727
+ return {
728
+ statusCode: 200,
729
+ response: { message: 'OK', data: exportData },
730
+ };
731
+ }
732
+ catch (error) {
733
+ if (error instanceof brighthub_lib_1.ConnectionServiceError)
734
+ return this.mapConnectionError(error);
735
+ return (0, errorResponse_1.handleError)(error);
736
+ }
737
+ }
738
+ async handleImportConnections(req) {
739
+ try {
740
+ const { userId, data, format } = req.body;
741
+ if (!userId)
742
+ return (0, errorResponse_1.validationError)('Missing required field: userId');
743
+ if (!data)
744
+ return (0, errorResponse_1.validationError)('Missing required field: data');
745
+ const result = await this.getConnectionService().importConnections(userId, data, format ?? 'json');
746
+ return {
747
+ statusCode: 200,
748
+ response: {
749
+ message: 'Import complete',
750
+ data: result,
751
+ },
752
+ };
753
+ }
754
+ catch (error) {
755
+ if (error instanceof brighthub_lib_1.ConnectionServiceError)
756
+ return this.mapConnectionError(error);
757
+ return (0, errorResponse_1.handleError)(error);
758
+ }
759
+ }
760
+ async handleCreateHub(req) {
761
+ try {
762
+ const { ownerId, name } = req.body;
763
+ if (!ownerId)
764
+ return (0, errorResponse_1.validationError)('Missing required field: ownerId');
765
+ if (!name)
766
+ return (0, errorResponse_1.validationError)('Missing required field: name');
767
+ const hub = await this.getConnectionService().createHub(ownerId, name);
768
+ return {
769
+ statusCode: 201,
770
+ response: {
771
+ message: 'Hub created',
772
+ data: hub,
773
+ },
774
+ };
775
+ }
776
+ catch (error) {
777
+ if (error instanceof brighthub_lib_1.ConnectionServiceError)
778
+ return this.mapConnectionError(error);
779
+ return (0, errorResponse_1.handleError)(error);
780
+ }
781
+ }
782
+ async handleGetHubs(req) {
783
+ try {
784
+ const typedReq = req;
785
+ const userId = typedReq.query['userId'];
786
+ if (!userId)
787
+ return (0, errorResponse_1.validationError)('Missing required query parameter: userId');
788
+ const result = await this.getConnectionService().getHubs(userId);
789
+ return {
790
+ statusCode: 200,
791
+ response: { message: 'OK', data: result },
792
+ };
793
+ }
794
+ catch (error) {
795
+ if (error instanceof brighthub_lib_1.ConnectionServiceError)
796
+ return this.mapConnectionError(error);
797
+ return (0, errorResponse_1.handleError)(error);
798
+ }
799
+ }
800
+ async handleGetConnectionInsights(req) {
801
+ try {
802
+ const { id } = req.params;
803
+ const typedReq = req;
804
+ const userId = typedReq.query['userId'];
805
+ if (!id)
806
+ return (0, errorResponse_1.validationError)('Missing required parameter: id');
807
+ if (!userId)
808
+ return (0, errorResponse_1.validationError)('Missing required query parameter: userId');
809
+ const period = typedReq.query['period'] || '30d';
810
+ const insights = await this.getDiscoveryService().getConnectionInsights(userId, id, period);
811
+ return {
812
+ statusCode: 200,
813
+ response: { message: 'OK', data: insights },
814
+ };
815
+ }
816
+ catch (error) {
817
+ return (0, errorResponse_1.handleError)(error);
818
+ }
819
+ }
820
+ async handleGetFollowRequests(req) {
821
+ try {
822
+ const typedReq = req;
823
+ const userId = typedReq.query['userId'];
824
+ if (!userId)
825
+ return (0, errorResponse_1.validationError)('Missing required query parameter: userId');
826
+ const options = this.parsePaginationOptions(typedReq.query);
827
+ const result = await this.getUserProfileService().getFollowRequests(userId, options);
828
+ return {
829
+ statusCode: 200,
830
+ response: { message: 'OK', data: result },
831
+ };
832
+ }
833
+ catch (error) {
834
+ if (error instanceof brighthub_lib_1.UserProfileServiceError) {
835
+ if (error.code === brighthub_lib_1.UserProfileErrorCode.UserNotFound)
836
+ return (0, errorResponse_1.notFoundError)('User', 'unknown');
837
+ return (0, errorResponse_1.validationError)(error.message);
838
+ }
839
+ return (0, errorResponse_1.handleError)(error);
840
+ }
841
+ }
842
+ async handleApproveFollowRequest(req) {
843
+ const { id } = req.params;
844
+ try {
845
+ const { userId } = req.body;
846
+ if (!id)
847
+ return (0, errorResponse_1.validationError)('Missing required parameter: id');
848
+ if (!userId)
849
+ return (0, errorResponse_1.validationError)('Missing required field: userId');
850
+ await this.getUserProfileService().approveFollowRequest(userId, id);
851
+ return {
852
+ statusCode: 200,
853
+ response: { message: 'Follow request approved' },
854
+ };
855
+ }
856
+ catch (error) {
857
+ if (error instanceof brighthub_lib_1.UserProfileServiceError) {
858
+ if (error.code === brighthub_lib_1.UserProfileErrorCode.FollowRequestNotFound)
859
+ return (0, errorResponse_1.notFoundError)('FollowRequest', id);
860
+ return (0, errorResponse_1.validationError)(error.message);
861
+ }
862
+ return (0, errorResponse_1.handleError)(error);
863
+ }
864
+ }
865
+ async handleRejectFollowRequest(req) {
866
+ const { id } = req.params;
867
+ try {
868
+ const { userId } = req.body;
869
+ if (!id)
870
+ return (0, errorResponse_1.validationError)('Missing required parameter: id');
871
+ if (!userId)
872
+ return (0, errorResponse_1.validationError)('Missing required field: userId');
873
+ await this.getUserProfileService().rejectFollowRequest(userId, id);
874
+ return {
875
+ statusCode: 200,
876
+ response: { message: 'Follow request rejected' },
877
+ };
878
+ }
879
+ catch (error) {
880
+ if (error instanceof brighthub_lib_1.UserProfileServiceError) {
881
+ if (error.code === brighthub_lib_1.UserProfileErrorCode.FollowRequestNotFound)
882
+ return (0, errorResponse_1.notFoundError)('FollowRequest', id);
883
+ return (0, errorResponse_1.validationError)(error.message);
884
+ }
885
+ return (0, errorResponse_1.handleError)(error);
886
+ }
887
+ }
888
+ }
889
+ exports.BrightHubConnectionController = BrightHubConnectionController;
890
+ //# sourceMappingURL=connectionController.js.map