@dxos/echo-db 2.33.5-dev.22471d71 → 2.33.5-dev.33d2877e

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 (359) hide show
  1. package/dist/src/api/index.d.ts +0 -5
  2. package/dist/src/api/index.d.ts.map +1 -1
  3. package/dist/src/api/index.js +0 -5
  4. package/dist/src/api/index.js.map +1 -1
  5. package/dist/src/api/schema.test.js +1 -1
  6. package/dist/src/api/schema.test.js.map +1 -1
  7. package/dist/src/echo.d.ts +1 -0
  8. package/dist/src/echo.d.ts.map +1 -1
  9. package/dist/src/echo.js +9 -20
  10. package/dist/src/echo.js.map +1 -1
  11. package/dist/src/echo.test.js +12 -0
  12. package/dist/src/echo.test.js.map +1 -1
  13. package/dist/src/halo/contact-manager.d.ts +2 -1
  14. package/dist/src/halo/contact-manager.d.ts.map +1 -1
  15. package/dist/src/halo/contact-manager.js +1 -1
  16. package/dist/src/halo/contact-manager.js.map +1 -1
  17. package/dist/src/halo/halo-factory.d.ts +2 -2
  18. package/dist/src/halo/halo-factory.d.ts.map +1 -1
  19. package/dist/src/halo/halo-factory.js +7 -13
  20. package/dist/src/halo/halo-factory.js.map +1 -1
  21. package/dist/src/halo/halo-party.d.ts +4 -3
  22. package/dist/src/halo/halo-party.d.ts.map +1 -1
  23. package/dist/src/halo/halo-party.js +13 -9
  24. package/dist/src/halo/halo-party.js.map +1 -1
  25. package/dist/src/halo/halo.test.js +4 -3
  26. package/dist/src/halo/halo.test.js.map +1 -1
  27. package/dist/src/halo/identity.js +2 -2
  28. package/dist/src/halo/identity.js.map +1 -1
  29. package/dist/src/halo/party-opener.d.ts +1 -1
  30. package/dist/src/halo/party-opener.d.ts.map +1 -1
  31. package/dist/src/halo/party-opener.js +5 -3
  32. package/dist/src/halo/party-opener.js.map +1 -1
  33. package/dist/src/halo/preferences.d.ts +1 -1
  34. package/dist/src/halo/preferences.d.ts.map +1 -1
  35. package/dist/src/halo/preferences.js +8 -11
  36. package/dist/src/halo/preferences.js.map +1 -1
  37. package/dist/src/index.d.ts +2 -2
  38. package/dist/src/index.d.ts.map +1 -1
  39. package/dist/src/index.js +2 -2
  40. package/dist/src/index.js.map +1 -1
  41. package/dist/src/invitations/greeting-initiator.d.ts +2 -2
  42. package/dist/src/invitations/greeting-initiator.d.ts.map +1 -1
  43. package/dist/src/invitations/greeting-initiator.js +2 -1
  44. package/dist/src/invitations/greeting-initiator.js.map +1 -1
  45. package/dist/src/invitations/greeting-protocol-provider.d.ts.map +1 -1
  46. package/dist/src/invitations/greeting-protocol-provider.js +5 -9
  47. package/dist/src/invitations/greeting-protocol-provider.js.map +1 -1
  48. package/dist/src/invitations/greeting-responder.d.ts +6 -4
  49. package/dist/src/invitations/greeting-responder.d.ts.map +1 -1
  50. package/dist/src/invitations/greeting-responder.js +11 -14
  51. package/dist/src/invitations/greeting-responder.js.map +1 -1
  52. package/dist/src/invitations/halo-recovery-initiator.js +1 -1
  53. package/dist/src/invitations/halo-recovery-initiator.js.map +1 -1
  54. package/dist/src/invitations/invitation-descriptor.js +1 -1
  55. package/dist/src/invitations/invitation-descriptor.js.map +1 -1
  56. package/dist/src/invitations/invitation-factory.d.ts +5 -2
  57. package/dist/src/invitations/invitation-factory.d.ts.map +1 -1
  58. package/dist/src/invitations/invitation-factory.js +4 -3
  59. package/dist/src/invitations/invitation-factory.js.map +1 -1
  60. package/dist/src/invitations/offline-invitation-claimer.d.ts.map +1 -1
  61. package/dist/src/invitations/offline-invitation-claimer.js +6 -8
  62. package/dist/src/invitations/offline-invitation-claimer.js.map +1 -1
  63. package/dist/src/{database → packlets/database}/data-mirror.d.ts +0 -0
  64. package/dist/src/packlets/database/data-mirror.d.ts.map +1 -0
  65. package/dist/src/{database → packlets/database}/data-mirror.js +0 -0
  66. package/dist/src/packlets/database/data-mirror.js.map +1 -0
  67. package/dist/src/{database → packlets/database}/data-mirror.test.d.ts +0 -0
  68. package/dist/src/packlets/database/data-mirror.test.d.ts.map +1 -0
  69. package/dist/src/{database → packlets/database}/data-mirror.test.js +0 -0
  70. package/dist/src/packlets/database/data-mirror.test.js.map +1 -0
  71. package/dist/src/{database → packlets/database}/data-service-host.d.ts +0 -0
  72. package/dist/src/packlets/database/data-service-host.d.ts.map +1 -0
  73. package/dist/src/{database → packlets/database}/data-service-host.js +4 -3
  74. package/dist/src/packlets/database/data-service-host.js.map +1 -0
  75. package/dist/src/{database → packlets/database}/data-service-router.d.ts +0 -0
  76. package/dist/src/packlets/database/data-service-router.d.ts.map +1 -0
  77. package/dist/src/{database → packlets/database}/data-service-router.js +0 -0
  78. package/dist/src/packlets/database/data-service-router.js.map +1 -0
  79. package/dist/src/{database → packlets/database}/database-backend.d.ts +0 -0
  80. package/dist/src/packlets/database/database-backend.d.ts.map +1 -0
  81. package/dist/src/{database → packlets/database}/database-backend.js +0 -0
  82. package/dist/src/packlets/database/database-backend.js.map +1 -0
  83. package/dist/src/{api → packlets/database}/database.d.ts +2 -1
  84. package/dist/src/packlets/database/database.d.ts.map +1 -0
  85. package/dist/src/{api → packlets/database}/database.js +2 -2
  86. package/dist/src/packlets/database/database.js.map +1 -0
  87. package/dist/src/{api → packlets/database}/database.test.d.ts +0 -0
  88. package/dist/src/packlets/database/database.test.d.ts.map +1 -0
  89. package/dist/src/{api → packlets/database}/database.test.js +3 -3
  90. package/dist/src/packlets/database/database.test.js.map +1 -0
  91. package/dist/src/{api → packlets/database}/entity.d.ts +1 -1
  92. package/dist/src/packlets/database/entity.d.ts.map +1 -0
  93. package/dist/src/{api → packlets/database}/entity.js +0 -0
  94. package/dist/src/packlets/database/entity.js.map +1 -0
  95. package/dist/src/{database → packlets/database}/index.d.ts +5 -0
  96. package/dist/src/packlets/database/index.d.ts.map +1 -0
  97. package/dist/src/{database → packlets/database}/index.js +5 -0
  98. package/dist/src/packlets/database/index.js.map +1 -0
  99. package/dist/src/{database → packlets/database}/item-demuxer.d.ts +3 -2
  100. package/dist/src/packlets/database/item-demuxer.d.ts.map +1 -0
  101. package/dist/src/{database → packlets/database}/item-demuxer.js +3 -3
  102. package/dist/src/packlets/database/item-demuxer.js.map +1 -0
  103. package/dist/src/{database → packlets/database}/item-demuxer.test.d.ts +0 -0
  104. package/dist/src/packlets/database/item-demuxer.test.d.ts.map +1 -0
  105. package/dist/src/{database → packlets/database}/item-demuxer.test.js +2 -2
  106. package/dist/src/packlets/database/item-demuxer.test.js.map +1 -0
  107. package/dist/src/{database → packlets/database}/item-manager.d.ts +3 -1
  108. package/dist/src/packlets/database/item-manager.d.ts.map +1 -0
  109. package/dist/src/{database → packlets/database}/item-manager.js +13 -12
  110. package/dist/src/packlets/database/item-manager.js.map +1 -0
  111. package/dist/src/{database → packlets/database}/item-manager.test.d.ts +0 -0
  112. package/dist/src/packlets/database/item-manager.test.d.ts.map +1 -0
  113. package/dist/src/{database → packlets/database}/item-manager.test.js +0 -0
  114. package/dist/src/packlets/database/item-manager.test.js.map +1 -0
  115. package/dist/src/{api → packlets/database}/item.d.ts +1 -1
  116. package/dist/src/packlets/database/item.d.ts.map +1 -0
  117. package/dist/src/{api → packlets/database}/item.js +0 -0
  118. package/dist/src/packlets/database/item.js.map +1 -0
  119. package/dist/src/{api → packlets/database}/link.d.ts +1 -1
  120. package/dist/src/packlets/database/link.d.ts.map +1 -0
  121. package/dist/src/{api → packlets/database}/link.js +0 -0
  122. package/dist/src/packlets/database/link.js.map +1 -0
  123. package/dist/src/{api → packlets/database}/selection/index.d.ts +0 -0
  124. package/dist/src/packlets/database/selection/index.d.ts.map +1 -0
  125. package/dist/src/{api → packlets/database}/selection/index.js +0 -0
  126. package/dist/src/packlets/database/selection/index.js.map +1 -0
  127. package/dist/src/{api → packlets/database}/selection/queries.d.ts +0 -0
  128. package/dist/src/packlets/database/selection/queries.d.ts.map +1 -0
  129. package/dist/src/{api → packlets/database}/selection/queries.js +13 -17
  130. package/dist/src/packlets/database/selection/queries.js.map +1 -0
  131. package/dist/src/{api → packlets/database}/selection/result.d.ts +0 -0
  132. package/dist/src/packlets/database/selection/result.d.ts.map +1 -0
  133. package/dist/src/{api → packlets/database}/selection/result.js +0 -0
  134. package/dist/src/packlets/database/selection/result.js.map +1 -0
  135. package/dist/src/{api → packlets/database}/selection/selection.d.ts +0 -0
  136. package/dist/src/packlets/database/selection/selection.d.ts.map +1 -0
  137. package/dist/src/{api → packlets/database}/selection/selection.js +1 -3
  138. package/dist/src/packlets/database/selection/selection.js.map +1 -0
  139. package/dist/src/{api → packlets/database}/selection/selection.test.d.ts +0 -0
  140. package/dist/src/packlets/database/selection/selection.test.d.ts.map +1 -0
  141. package/dist/src/{api → packlets/database}/selection/selection.test.js +4 -12
  142. package/dist/src/packlets/database/selection/selection.test.js.map +1 -0
  143. package/dist/src/{api → packlets/database}/selection/util.d.ts +0 -0
  144. package/dist/src/packlets/database/selection/util.d.ts.map +1 -0
  145. package/dist/src/{api → packlets/database}/selection/util.js +0 -0
  146. package/dist/src/packlets/database/selection/util.js.map +1 -0
  147. package/dist/src/{database → packlets/database}/testing.d.ts +1 -1
  148. package/dist/src/packlets/database/testing.d.ts.map +1 -0
  149. package/dist/src/{database → packlets/database}/testing.js +4 -4
  150. package/dist/src/packlets/database/testing.js.map +1 -0
  151. package/dist/src/{database → packlets/database}/timeframe-clock.d.ts +0 -0
  152. package/dist/src/packlets/database/timeframe-clock.d.ts.map +1 -0
  153. package/dist/src/{database → packlets/database}/timeframe-clock.js +0 -0
  154. package/dist/src/packlets/database/timeframe-clock.js.map +1 -0
  155. package/dist/src/{errors.d.ts → packlets/errors/index.d.ts} +1 -1
  156. package/dist/src/packlets/errors/index.d.ts.map +1 -0
  157. package/dist/src/{errors.js → packlets/errors/index.js} +1 -1
  158. package/dist/src/packlets/errors/index.js.map +1 -0
  159. package/dist/src/parties/data-party.d.ts +11 -8
  160. package/dist/src/parties/data-party.d.ts.map +1 -1
  161. package/dist/src/parties/data-party.js +18 -13
  162. package/dist/src/parties/data-party.js.map +1 -1
  163. package/dist/src/parties/data-party.test.js +23 -22
  164. package/dist/src/parties/data-party.test.js.map +1 -1
  165. package/dist/src/parties/party-factory.d.ts +2 -8
  166. package/dist/src/parties/party-factory.d.ts.map +1 -1
  167. package/dist/src/parties/party-factory.js +22 -50
  168. package/dist/src/parties/party-factory.js.map +1 -1
  169. package/dist/src/parties/party-manager.d.ts +3 -4
  170. package/dist/src/parties/party-manager.d.ts.map +1 -1
  171. package/dist/src/parties/party-manager.js +4 -5
  172. package/dist/src/parties/party-manager.js.map +1 -1
  173. package/dist/src/parties/party-manager.test.js +14 -13
  174. package/dist/src/parties/party-manager.test.js.map +1 -1
  175. package/dist/src/pipeline/message-selector.d.ts +3 -3
  176. package/dist/src/pipeline/message-selector.d.ts.map +1 -1
  177. package/dist/src/pipeline/message-selector.js +30 -29
  178. package/dist/src/pipeline/message-selector.js.map +1 -1
  179. package/dist/src/pipeline/metadata-store.d.ts +3 -3
  180. package/dist/src/pipeline/metadata-store.d.ts.map +1 -1
  181. package/dist/src/pipeline/metadata-store.js +5 -5
  182. package/dist/src/pipeline/metadata-store.js.map +1 -1
  183. package/dist/src/pipeline/metadata-store.test.js +8 -4
  184. package/dist/src/pipeline/metadata-store.test.js.map +1 -1
  185. package/dist/src/pipeline/party-core.d.ts +21 -6
  186. package/dist/src/pipeline/party-core.d.ts.map +1 -1
  187. package/dist/src/pipeline/party-core.js +14 -17
  188. package/dist/src/pipeline/party-core.js.map +1 -1
  189. package/dist/src/pipeline/party-core.test.js +32 -32
  190. package/dist/src/pipeline/party-core.test.js.map +1 -1
  191. package/dist/src/pipeline/party-processor.d.ts +21 -9
  192. package/dist/src/pipeline/party-processor.d.ts.map +1 -1
  193. package/dist/src/pipeline/party-processor.js +0 -8
  194. package/dist/src/pipeline/party-processor.js.map +1 -1
  195. package/dist/src/pipeline/pipeline.d.ts +3 -5
  196. package/dist/src/pipeline/pipeline.d.ts.map +1 -1
  197. package/dist/src/pipeline/pipeline.js +8 -11
  198. package/dist/src/pipeline/pipeline.js.map +1 -1
  199. package/dist/src/pipeline/pipeline.test.js +4 -5
  200. package/dist/src/pipeline/pipeline.test.js.map +1 -1
  201. package/dist/src/protocol/auth-plugin.d.ts +1 -1
  202. package/dist/src/protocol/auth-plugin.d.ts.map +1 -1
  203. package/dist/src/protocol/auth-plugin.js +1 -3
  204. package/dist/src/protocol/auth-plugin.js.map +1 -1
  205. package/dist/src/protocol/authenticator.d.ts +4 -4
  206. package/dist/src/protocol/authenticator.d.ts.map +1 -1
  207. package/dist/src/protocol/authenticator.js +12 -16
  208. package/dist/src/protocol/authenticator.js.map +1 -1
  209. package/dist/src/protocol/authenticator.test.js +1 -4
  210. package/dist/src/protocol/authenticator.test.js.map +1 -1
  211. package/dist/src/protocol/halo-recovery-plugin.d.ts +1 -1
  212. package/dist/src/protocol/halo-recovery-plugin.d.ts.map +1 -1
  213. package/dist/src/protocol/halo-recovery-plugin.js +1 -3
  214. package/dist/src/protocol/halo-recovery-plugin.js.map +1 -1
  215. package/dist/src/protocol/identity-credentials.d.ts +2 -2
  216. package/dist/src/protocol/identity-credentials.d.ts.map +1 -1
  217. package/dist/src/protocol/identity-credentials.js +4 -4
  218. package/dist/src/protocol/identity-credentials.js.map +1 -1
  219. package/dist/src/protocol/offline-invitation-plugin.d.ts +1 -1
  220. package/dist/src/protocol/offline-invitation-plugin.d.ts.map +1 -1
  221. package/dist/src/protocol/offline-invitation-plugin.js +1 -3
  222. package/dist/src/protocol/offline-invitation-plugin.js.map +1 -1
  223. package/dist/src/protocol/replicator-plugin.d.ts.map +1 -1
  224. package/dist/src/protocol/replicator-plugin.js +4 -6
  225. package/dist/src/protocol/replicator-plugin.js.map +1 -1
  226. package/dist/src/snapshots/snapshot-generator.d.ts +2 -2
  227. package/dist/src/snapshots/snapshot-generator.d.ts.map +1 -1
  228. package/dist/src/snapshots/snapshot-generator.js +13 -15
  229. package/dist/src/snapshots/snapshot-generator.js.map +1 -1
  230. package/dist/src/snapshots/snapshot-store.d.ts +3 -3
  231. package/dist/src/snapshots/snapshot-store.d.ts.map +1 -1
  232. package/dist/src/snapshots/snapshot-store.js +5 -5
  233. package/dist/src/snapshots/snapshot-store.js.map +1 -1
  234. package/dist/src/snapshots/snapshot-store.test.js +1 -1
  235. package/dist/src/snapshots/snapshot-store.test.js.map +1 -1
  236. package/dist/src/snapshots/snapshot.test.js +1 -1
  237. package/dist/src/snapshots/snapshot.test.js.map +1 -1
  238. package/dist/src/testing/testing-factories.d.ts +1 -1
  239. package/dist/src/testing/testing-factories.d.ts.map +1 -1
  240. package/dist/src/testing/testing-factories.js +2 -2
  241. package/dist/src/testing/testing-factories.js.map +1 -1
  242. package/dist/tsconfig.tsbuildinfo +1 -1
  243. package/package.json +18 -18
  244. package/src/api/index.ts +0 -5
  245. package/src/api/schema.test.ts +1 -2
  246. package/src/echo.test.ts +16 -1
  247. package/src/echo.ts +10 -20
  248. package/src/halo/contact-manager.ts +3 -2
  249. package/src/halo/halo-factory.ts +8 -21
  250. package/src/halo/halo-party.ts +16 -9
  251. package/src/halo/halo.test.ts +4 -3
  252. package/src/halo/identity.ts +2 -2
  253. package/src/halo/party-opener.ts +5 -3
  254. package/src/halo/preferences.ts +10 -12
  255. package/src/index.ts +3 -2
  256. package/src/invitations/greeting-initiator.ts +5 -4
  257. package/src/invitations/greeting-protocol-provider.ts +5 -9
  258. package/src/invitations/greeting-responder.ts +15 -17
  259. package/src/invitations/halo-recovery-initiator.ts +1 -1
  260. package/src/invitations/invitation-descriptor.ts +1 -1
  261. package/src/invitations/invitation-factory.ts +8 -5
  262. package/src/invitations/offline-invitation-claimer.ts +6 -8
  263. package/src/{database → packlets/database}/data-mirror.test.ts +1 -1
  264. package/src/{database → packlets/database}/data-mirror.ts +1 -1
  265. package/src/{database → packlets/database}/data-service-host.ts +2 -1
  266. package/src/{database → packlets/database}/data-service-router.ts +0 -0
  267. package/src/{database → packlets/database}/database-backend.ts +0 -0
  268. package/src/{api → packlets/database}/database.test.ts +2 -1
  269. package/src/{api → packlets/database}/database.ts +3 -1
  270. package/src/{api → packlets/database}/entity.ts +1 -1
  271. package/src/{database → packlets/database}/index.ts +5 -0
  272. package/src/{database → packlets/database}/item-demuxer.test.ts +1 -1
  273. package/src/{database → packlets/database}/item-demuxer.ts +5 -3
  274. package/src/{database → packlets/database}/item-manager.test.ts +0 -0
  275. package/src/{database → packlets/database}/item-manager.ts +5 -3
  276. package/src/{api → packlets/database}/item.ts +2 -2
  277. package/src/{api → packlets/database}/link.ts +1 -1
  278. package/src/{api → packlets/database}/selection/index.ts +0 -0
  279. package/src/{api → packlets/database}/selection/queries.ts +14 -18
  280. package/src/{api → packlets/database}/selection/result.ts +0 -0
  281. package/src/{api → packlets/database}/selection/selection.test.ts +4 -12
  282. package/src/{api → packlets/database}/selection/selection.ts +1 -7
  283. package/src/{api → packlets/database}/selection/util.ts +0 -0
  284. package/src/{database → packlets/database}/testing.ts +2 -2
  285. package/src/{database → packlets/database}/timeframe-clock.ts +0 -0
  286. package/src/{errors.ts → packlets/errors/index.ts} +0 -0
  287. package/src/parties/data-party.test.ts +26 -23
  288. package/src/parties/data-party.ts +21 -15
  289. package/src/parties/party-factory.ts +28 -75
  290. package/src/parties/party-manager.test.ts +21 -14
  291. package/src/parties/party-manager.ts +4 -5
  292. package/src/pipeline/message-selector.ts +32 -35
  293. package/src/pipeline/metadata-store.test.ts +8 -4
  294. package/src/pipeline/metadata-store.ts +5 -5
  295. package/src/pipeline/party-core.test.ts +33 -33
  296. package/src/pipeline/party-core.ts +34 -19
  297. package/src/pipeline/party-processor.ts +23 -15
  298. package/src/pipeline/pipeline.test.ts +4 -5
  299. package/src/pipeline/pipeline.ts +12 -15
  300. package/src/protocol/auth-plugin.ts +1 -3
  301. package/src/protocol/authenticator.test.ts +1 -4
  302. package/src/protocol/authenticator.ts +33 -33
  303. package/src/protocol/halo-recovery-plugin.ts +4 -6
  304. package/src/protocol/identity-credentials.ts +4 -4
  305. package/src/protocol/offline-invitation-plugin.ts +4 -6
  306. package/src/protocol/replicator-plugin.ts +4 -6
  307. package/src/snapshots/snapshot-generator.ts +13 -17
  308. package/src/snapshots/snapshot-store.test.ts +1 -1
  309. package/src/snapshots/snapshot-store.ts +5 -6
  310. package/src/snapshots/snapshot.test.ts +1 -1
  311. package/src/testing/testing-factories.ts +3 -3
  312. package/dist/src/api/database.d.ts.map +0 -1
  313. package/dist/src/api/database.js.map +0 -1
  314. package/dist/src/api/database.test.d.ts.map +0 -1
  315. package/dist/src/api/database.test.js.map +0 -1
  316. package/dist/src/api/entity.d.ts.map +0 -1
  317. package/dist/src/api/entity.js.map +0 -1
  318. package/dist/src/api/item.d.ts.map +0 -1
  319. package/dist/src/api/item.js.map +0 -1
  320. package/dist/src/api/link.d.ts.map +0 -1
  321. package/dist/src/api/link.js.map +0 -1
  322. package/dist/src/api/selection/index.d.ts.map +0 -1
  323. package/dist/src/api/selection/index.js.map +0 -1
  324. package/dist/src/api/selection/queries.d.ts.map +0 -1
  325. package/dist/src/api/selection/queries.js.map +0 -1
  326. package/dist/src/api/selection/result.d.ts.map +0 -1
  327. package/dist/src/api/selection/result.js.map +0 -1
  328. package/dist/src/api/selection/selection.d.ts.map +0 -1
  329. package/dist/src/api/selection/selection.js.map +0 -1
  330. package/dist/src/api/selection/selection.test.d.ts.map +0 -1
  331. package/dist/src/api/selection/selection.test.js.map +0 -1
  332. package/dist/src/api/selection/util.d.ts.map +0 -1
  333. package/dist/src/api/selection/util.js.map +0 -1
  334. package/dist/src/database/data-mirror.d.ts.map +0 -1
  335. package/dist/src/database/data-mirror.js.map +0 -1
  336. package/dist/src/database/data-mirror.test.d.ts.map +0 -1
  337. package/dist/src/database/data-mirror.test.js.map +0 -1
  338. package/dist/src/database/data-service-host.d.ts.map +0 -1
  339. package/dist/src/database/data-service-host.js.map +0 -1
  340. package/dist/src/database/data-service-router.d.ts.map +0 -1
  341. package/dist/src/database/data-service-router.js.map +0 -1
  342. package/dist/src/database/database-backend.d.ts.map +0 -1
  343. package/dist/src/database/database-backend.js.map +0 -1
  344. package/dist/src/database/index.d.ts.map +0 -1
  345. package/dist/src/database/index.js.map +0 -1
  346. package/dist/src/database/item-demuxer.d.ts.map +0 -1
  347. package/dist/src/database/item-demuxer.js.map +0 -1
  348. package/dist/src/database/item-demuxer.test.d.ts.map +0 -1
  349. package/dist/src/database/item-demuxer.test.js.map +0 -1
  350. package/dist/src/database/item-manager.d.ts.map +0 -1
  351. package/dist/src/database/item-manager.js.map +0 -1
  352. package/dist/src/database/item-manager.test.d.ts.map +0 -1
  353. package/dist/src/database/item-manager.test.js.map +0 -1
  354. package/dist/src/database/testing.d.ts.map +0 -1
  355. package/dist/src/database/testing.js.map +0 -1
  356. package/dist/src/database/timeframe-clock.d.ts.map +0 -1
  357. package/dist/src/database/timeframe-clock.js.map +0 -1
  358. package/dist/src/errors.d.ts.map +0 -1
  359. package/dist/src/errors.js.map +0 -1
@@ -9,7 +9,6 @@ import {
9
9
  createEnvelopeMessage,
10
10
  createFeedAdmitMessage,
11
11
  createPartyGenesisMessage,
12
- KeyHint,
13
12
  KeyType,
14
13
  SecretProvider,
15
14
  wrapMessage
@@ -21,11 +20,11 @@ import { ModelFactory } from '@dxos/model-factory';
21
20
  import { NetworkManager } from '@dxos/network-manager';
22
21
  import { ObjectModel } from '@dxos/object-model';
23
22
 
24
- import { IdentityNotInitializedError } from '../errors';
25
23
  import {
26
24
  createDataPartyAdmissionMessages,
27
25
  GreetingInitiator, InvitationDescriptor, InvitationDescriptorType, OfflineInvitationClaimer
28
26
  } from '../invitations';
27
+ import { IdentityNotInitializedError } from '../packlets/errors';
29
28
  import { PartyFeedProvider, PartyOptions } from '../pipeline';
30
29
  import { IdentityCredentialsProvider } from '../protocol/identity-credentials';
31
30
  import { SnapshotStore } from '../snapshots';
@@ -60,10 +59,10 @@ export class PartyFactory {
60
59
  // Connect the pipeline.
61
60
  await party.open();
62
61
 
63
- const writableFeed = await party.feedProvider.createOrOpenWritableFeed();
62
+ const writableFeed = await party.getWriteFeed();
64
63
 
65
64
  // PartyGenesis (self-signed by Party).
66
- await party.processor.writeHaloMessage(createPartyGenesisMessage(
65
+ await party.credentialsWriter.write(createPartyGenesisMessage(
67
66
  identity.keyring,
68
67
  partyKey,
69
68
  writableFeed.key,
@@ -71,7 +70,7 @@ export class PartyFactory {
71
70
  );
72
71
 
73
72
  // KeyAdmit (IdentityGenesis in an Envelope signed by Party).
74
- await party.processor.writeHaloMessage(createEnvelopeMessage(
73
+ await party.credentialsWriter.write(createEnvelopeMessage(
75
74
  identity.keyring,
76
75
  partyKey.publicKey,
77
76
  wrapMessage(identity.identityGenesis),
@@ -80,7 +79,7 @@ export class PartyFactory {
80
79
 
81
80
  // FeedAdmit (signed by the Device KeyChain).
82
81
  // TODO(dmaretskyi): Is this really needed since a feed is already admitted by party genesis message.
83
- await party.processor.writeHaloMessage(createFeedAdmitMessage(
82
+ await party.credentialsWriter.write(createFeedAdmitMessage(
84
83
  identity.keyring,
85
84
  partyKey.publicKey,
86
85
  writableFeed.key,
@@ -89,7 +88,7 @@ export class PartyFactory {
89
88
 
90
89
  // IdentityInfo in an Envelope signed by the Device KeyChain.
91
90
  if (identity.identityInfo) {
92
- await party.processor.writeHaloMessage(createEnvelopeMessage(
91
+ await party.credentialsWriter.write(createEnvelopeMessage(
93
92
  identity.keyring,
94
93
  partyKey.publicKey,
95
94
  wrapMessage(identity.identityInfo),
@@ -106,56 +105,12 @@ export class PartyFactory {
106
105
  return party;
107
106
  }
108
107
 
109
- /**
110
- * Constructs a party object and creates a local write feed for it.
111
- * @param partyKey
112
- * @param hints
113
- */
114
- async addParty (partyKey: PartyKey, hints: KeyHint[] = []) {
115
- const identity = this._identityProvider() ?? raise(new IdentityNotInitializedError());
116
-
117
- /*
118
- * TODO(telackey): We shouldn't have to add our key here, it should be in the hints, but our hint
119
- * mechanism is broken by not waiting on the messages to be processed before returning.
120
- */
121
-
122
- const feedProvider = this._feedProviderFactory(partyKey);
123
- const { feed } = await feedProvider.createOrOpenWritableFeed();
124
- const feedKeyPair = identity.keyring.getKey(feed.key);
125
- assert(feedKeyPair, 'Keypair for writable feed not found.');
126
- const party = new DataParty(
127
- partyKey,
128
- this._modelFactory,
129
- this._snapshotStore,
130
- feedProvider,
131
- identity.createCredentialsSigner(),
132
- identity.preferences,
133
- this._networkManager,
134
- hints,
135
- undefined,
136
- this._options
137
- );
138
-
139
- await party.open();
140
- const isHalo = identity.identityKey.publicKey.equals(partyKey);
141
- const signingKey = isHalo ? identity.deviceKey : identity.deviceKeyChain;
142
- assert(signingKey, 'No device key or keychain.');
143
- // Write the Feed genesis message.
144
- await party.processor.writeHaloMessage(createFeedAdmitMessage(
145
- identity.keyring,
146
- partyKey,
147
- feedKeyPair.publicKey,
148
- [signingKey]
149
- ));
150
- return party;
151
- }
152
-
153
108
  /**
154
109
  * Constructs a party object from an existing set of feeds.
155
110
  * @param partyKey
156
111
  * @param hints
157
112
  */
158
- async constructParty (partyKey: PartyKey, hints: KeyHint[] = [], initialTimeframe?: Timeframe) {
113
+ async constructParty (partyKey: PartyKey, feedHints: PublicKey[] = [], initialTimeframe?: Timeframe) {
159
114
  const identity = this._identityProvider() ?? raise(new IdentityNotInitializedError());
160
115
 
161
116
  // TODO(marik-d): Support read-only parties if this feed doesn't exist?
@@ -172,7 +127,7 @@ export class PartyFactory {
172
127
  identity.createCredentialsSigner(),
173
128
  identity.preferences,
174
129
  this._networkManager,
175
- hints,
130
+ feedHints,
176
131
  initialTimeframe,
177
132
  this._options
178
133
  );
@@ -190,7 +145,6 @@ export class PartyFactory {
190
145
  }
191
146
 
192
147
  async joinParty (invitationDescriptor: InvitationDescriptor, secretProvider: SecretProvider): Promise<DataParty> {
193
- const haloInvitation = !!invitationDescriptor.identityKey;
194
148
  const originalInvitation = invitationDescriptor;
195
149
 
196
150
  const identity = this._identityProvider() ?? raise(new IdentityNotInitializedError());
@@ -218,19 +172,18 @@ export class PartyFactory {
218
172
 
219
173
  await initiator.connect();
220
174
  const { partyKey, hints } = await initiator.redeemInvitation(secretProvider);
221
- const party = await this.addParty(partyKey, hints);
175
+ const party = await this.constructParty(partyKey, hints);
176
+ await party.open();
222
177
  await initiator.destroy();
223
- if (!haloInvitation) {
224
- // Copy our signed IdentityInfo into the new Party.
225
- const infoMessage = identity.identityInfo;
226
- if (infoMessage) {
227
- await party.processor.writeHaloMessage(createEnvelopeMessage(
228
- identity.keyring,
229
- partyKey,
230
- wrapMessage(infoMessage),
231
- [identity.deviceKeyChain]
232
- ));
233
- }
178
+
179
+ // Copy our signed IdentityInfo into the new Party.
180
+ if (identity.identityInfo) {
181
+ await party.credentialsWriter.write(createEnvelopeMessage(
182
+ identity.keyring,
183
+ partyKey,
184
+ wrapMessage(identity.identityInfo),
185
+ [identity.deviceKeyChain]
186
+ ));
234
187
  }
235
188
 
236
189
  return party;
@@ -247,10 +200,10 @@ export class PartyFactory {
247
200
  // Connect the pipeline.
248
201
  await party.open();
249
202
 
250
- const writableFeed = await party.feedProvider.createOrOpenWritableFeed();
203
+ const writableFeed = await party.getWriteFeed();
251
204
 
252
205
  // PartyGenesis (self-signed by Party).
253
- await party.processor.writeHaloMessage(createPartyGenesisMessage(
206
+ await party.credentialsWriter.write(createPartyGenesisMessage(
254
207
  identity.keyring,
255
208
  partyKey,
256
209
  writableFeed.key,
@@ -258,7 +211,7 @@ export class PartyFactory {
258
211
  );
259
212
 
260
213
  // KeyAdmit (IdentityGenesis in an Envelope signed by Party).
261
- await party.processor.writeHaloMessage(createEnvelopeMessage(
214
+ await party.credentialsWriter.write(createEnvelopeMessage(
262
215
  identity.keyring,
263
216
  partyKey.publicKey,
264
217
  wrapMessage(identity.identityGenesis),
@@ -266,7 +219,7 @@ export class PartyFactory {
266
219
  ));
267
220
 
268
221
  // FeedAdmit (signed by the Device KeyChain).
269
- await party.processor.writeHaloMessage(createFeedAdmitMessage(
222
+ await party.credentialsWriter.write(createFeedAdmitMessage(
270
223
  identity.keyring,
271
224
  partyKey.publicKey,
272
225
  writableFeed.key,
@@ -275,7 +228,7 @@ export class PartyFactory {
275
228
 
276
229
  // IdentityInfo in an Envelope signed by the Device KeyChain.
277
230
  if (identity.identityInfo) {
278
- await party.processor.writeHaloMessage(createEnvelopeMessage(
231
+ await party.credentialsWriter.write(createEnvelopeMessage(
279
232
  identity.keyring,
280
233
  partyKey.publicKey,
281
234
  wrapMessage(identity.identityInfo),
@@ -285,7 +238,7 @@ export class PartyFactory {
285
238
 
286
239
  // const keyAdmitMessage = snapshot.halo?.messages?.[1];
287
240
  // assert(keyAdmitMessage);
288
- // await party.processor.writeHaloMessage(createEnvelopeMessage(
241
+ // await party.writeCredentialsMessage(createEnvelopeMessage(
289
242
  // identity.signer,
290
243
  // partyKey.publicKey,
291
244
  // keyAdmitMessage,
@@ -293,13 +246,14 @@ export class PartyFactory {
293
246
  // ));
294
247
 
295
248
  // for(const message of snapshot.halo?.messages?.slice(2) || []) {
296
- // await party.processor.writeHaloMessage(message);
249
+ // await party.writeCredentialsMessage(message);
297
250
  // }
298
251
 
299
252
  // Write messages to create ECHO items.
300
253
  const feedWriter = createFeedWriter(writableFeed.feed);
301
254
  for (const item of snapshot.database?.items || []) {
302
255
  const message: FeedMessage = {
256
+ timeframe: new Timeframe(),
303
257
  echo: {
304
258
  itemId: item.itemId ?? failUndefined(),
305
259
  genesis: {
@@ -310,8 +264,7 @@ export class PartyFactory {
310
264
  itemMutation: {
311
265
  parentId: item.parentId
312
266
  },
313
- snapshot: item.model,
314
- timeframe: new Timeframe()
267
+ snapshot: item.model
315
268
  }
316
269
  };
317
270
  await feedWriter.write(message);
@@ -32,8 +32,8 @@ import { ObjectModel } from '@dxos/object-model';
32
32
  import { createStorage, StorageType } from '@dxos/random-access-multi-storage';
33
33
  import { afterTest, testTimeout } from '@dxos/testutils';
34
34
 
35
- import { Item } from '../api';
36
35
  import { defaultInvitationAuthenticator, OfflineInvitationClaimer } from '../invitations';
36
+ import { Item } from '../packlets/database';
37
37
  import { MetadataStore, PartyFeedProvider } from '../pipeline';
38
38
  import { createTestIdentityCredentials } from '../protocol/identity-credentials';
39
39
  import { SnapshotStore } from '../snapshots';
@@ -55,9 +55,11 @@ const log = debug('dxos:echo:parties:party-manager:test');
55
55
  */
56
56
  const setup = async () => {
57
57
  const keyring = new Keyring();
58
- const metadataStore = new MetadataStore(createStorage('metadata', StorageType.RAM));
59
- const feedStore = new FeedStore(createStorage('feed', StorageType.RAM), { valueEncoding: codec });
60
- const snapshotStore = new SnapshotStore(createStorage('snapshots', StorageType.RAM));
58
+
59
+ const storage = createStorage('', StorageType.RAM);
60
+ const snapshotStore = new SnapshotStore(storage.directory('snapshots'));
61
+ const metadataStore = new MetadataStore(storage.directory('metadata'));
62
+ const feedStore = new FeedStore(storage.directory('feed'), { valueEncoding: codec });
61
63
  const modelFactory = new ModelFactory().registerModel(ObjectModel);
62
64
  const networkManager = new NetworkManager();
63
65
  const feedProviderFactory = (partyKey: PublicKey) => new PartyFeedProvider(metadataStore, keyring, feedStore, partyKey);
@@ -138,21 +140,18 @@ describe('Party manager', () => {
138
140
  const feedStream = createWritableFeedStream(feed);
139
141
  feedStream.write(createPartyGenesisMessage(keyring, partyKey, feedKey.publicKey, identityKey));
140
142
 
141
- await partyManager.addParty(partyKey.publicKey, [{
142
- type: KeyType.FEED,
143
- publicKey: PublicKey.from(feed.key)
144
- }]);
143
+ await partyManager.addParty(partyKey.publicKey, [PublicKey.from(feed.key)]);
145
144
 
146
145
  await update;
147
146
  });
148
147
 
149
148
  test('Create from cold start', async () => {
150
149
  const storage = createStorage('', StorageType.RAM);
151
- const feedStore = new FeedStore(storage, { valueEncoding: codec });
150
+ const feedStore = new FeedStore(storage.directory('feed'), { valueEncoding: codec });
152
151
  const keyring = new Keyring();
153
- const metadataStore = new MetadataStore(createStorage('metadata', StorageType.RAM));
152
+ const snapshotStore = new SnapshotStore(storage.directory('snapshots'));
153
+ const metadataStore = new MetadataStore(storage.directory('metadata'));
154
154
  const modelFactory = new ModelFactory().registerModel(ObjectModel);
155
- const snapshotStore = new SnapshotStore(createStorage('snapshots', StorageType.RAM));
156
155
  const networkManager = new NetworkManager();
157
156
  const feedProviderFactory = (partyKey: PublicKey) => new PartyFeedProvider(metadataStore, keyring, feedStore, partyKey);
158
157
 
@@ -188,15 +187,23 @@ describe('Party manager', () => {
188
187
  assert(feedKey);
189
188
 
190
189
  const feedStream = createWritableFeedStream(feed);
191
- feedStream.write({ halo: createPartyGenesisMessage(keyring, partyKey, feedKey.publicKey, identity.identityKey) });
192
190
  feedStream.write({
191
+ timeframe: new Timeframe(),
192
+ halo: createPartyGenesisMessage(
193
+ keyring,
194
+ partyKey,
195
+ feedKey.publicKey,
196
+ identity.identityKey
197
+ )
198
+ });
199
+ feedStream.write({
200
+ timeframe: new Timeframe(),
193
201
  echo: checkType<EchoEnvelope>({
194
202
  itemId: 'foo',
195
203
  genesis: {
196
204
  itemType: PARTY_ITEM_TYPE,
197
205
  modelType: ObjectModel.meta.type
198
- },
199
- timeframe: new Timeframe()
206
+ }
200
207
  })
201
208
  });
202
209
  }
@@ -157,11 +157,9 @@ export class PartyManager {
157
157
 
158
158
  /**
159
159
  * Construct a party object and start replicating with the remote peer that created that party.
160
- * @param partyKey
161
- * @param hints
162
160
  */
163
161
  @synchronized
164
- async addParty (partyKey: PartyKey, hints: KeyHint[] = []) {
162
+ async addParty (partyKey: PartyKey, feedHints: PublicKey[] = []) {
165
163
  assert(this._open, 'PartyManager is not open.');
166
164
 
167
165
  /*
@@ -174,8 +172,9 @@ export class PartyManager {
174
172
  return this._parties.get(partyKey);
175
173
  }
176
174
 
177
- log(`Adding party partyKey=${partyKey.toHex()} hints=${hints.length}`);
178
- const party = await this._partyFactory.addParty(partyKey, hints);
175
+ log(`Adding party partyKey=${partyKey.toHex()} hints=${feedHints.length}`);
176
+ const party = await this._partyFactory.constructParty(partyKey, feedHints);
177
+ await party.open();
179
178
  await this._metadataStore.addParty(party.key);
180
179
  this._setParty(party);
181
180
  return party;
@@ -9,8 +9,8 @@ import { getPartyCredentialMessageType, PartyCredential } from '@dxos/credential
9
9
  import { PublicKey } from '@dxos/crypto';
10
10
  import { MessageSelector } from '@dxos/echo-protocol';
11
11
 
12
- import { TimeframeClock } from '../database';
13
- import { PartyProcessor } from './party-processor';
12
+ import { TimeframeClock } from '../packlets/database';
13
+ import { PartyStateProvider } from './party-processor';
14
14
 
15
15
  const log = debug('dxos:echo-db:message-selector');
16
16
 
@@ -23,47 +23,44 @@ const log = debug('dxos:echo-db:message-selector');
23
23
  * @param partyProcessor
24
24
  * @param timeframeClock
25
25
  */
26
- export function createMessageSelector (
27
- partyProcessor: PartyProcessor,
28
- timeframeClock: TimeframeClock
29
- ): MessageSelector {
30
- // TODO(telackey): Add KeyAdmit checks.
31
- return candidates => {
32
- // Check ECHO message candidates first since they are less expensive than HALO cancidates.
33
- for (let i = 0; i < candidates.length; i++) {
34
- const { data: { echo } } = candidates[i];
35
- const feedKey = PublicKey.from(candidates[i].key);
36
- if (!echo) {
37
- continue;
38
- }
26
+ export const createMessageSelector = (partyProcessor: PartyStateProvider, timeframeClock: TimeframeClock): MessageSelector => candidates => {
27
+ // Check ECHO message candidates first since they are less expensive than HALO cancidates.
28
+ for (let i = 0; i < candidates.length; i++) {
29
+ const { data: { timeframe, echo } } = candidates[i];
30
+ const feedKey = PublicKey.from(candidates[i].key);
31
+ if (!echo) {
32
+ continue;
33
+ }
39
34
 
40
- assert(echo.timeframe);
41
- if (partyProcessor.isFeedAdmitted(feedKey) && !timeframeClock.hasGaps(echo.timeframe)) {
42
- return i;
43
- }
35
+ assert(timeframe);
36
+ if (partyProcessor.isFeedAdmitted(feedKey) && !timeframeClock.hasGaps(timeframe)) {
37
+ return i;
44
38
  }
39
+ }
45
40
 
46
- // Check HALO message candidates.
47
- for (let i = 0; i < candidates.length; i++) {
48
- const { data: { halo } } = candidates[i];
49
- const feedKey = PublicKey.from(candidates[i].key);
50
- if (!halo) {
51
- continue;
52
- }
41
+ // Check HALO message candidates.
42
+ for (let i = 0; i < candidates.length; i++) {
43
+ const { data: { timeframe, halo } } = candidates[i];
44
+ const feedKey = PublicKey.from(candidates[i].key);
45
+ if (!halo) {
46
+ continue;
47
+ }
53
48
 
54
- if (partyProcessor.isFeedAdmitted(feedKey)) {
55
- return i;
56
- }
49
+ assert(timeframe);
50
+ if (partyProcessor.isFeedAdmitted(feedKey) && !timeframeClock.hasGaps(timeframe)) {
51
+ return i;
52
+ }
57
53
 
58
- if (partyProcessor.genesisRequired) {
54
+ if (partyProcessor.genesisRequired) {
55
+ try { // TODO(dmaretskyi): Get getPartyCredentialMessageType crashes for some reason.
59
56
  // TODO(telackey): Add check that this is for the right Party.
60
57
  if (getPartyCredentialMessageType(halo) === PartyCredential.Type.PARTY_GENESIS) {
61
58
  return i;
62
59
  }
63
- }
60
+ } catch { }
64
61
  }
62
+ }
65
63
 
66
- // Not ready for this message yet.
67
- log('Skipping...');
68
- };
69
- }
64
+ // Not ready for this message yet.
65
+ log('Skipping...');
66
+ };
@@ -11,7 +11,8 @@ import { MetadataStore } from './metadata-store';
11
11
 
12
12
  describe('MetadataStore in-memory', () => {
13
13
  it('Creates party and adds feeds to it', async () => {
14
- const store = new MetadataStore(createStorage('metadata', StorageType.RAM));
14
+ const storage = createStorage('', StorageType.RAM);
15
+ const store = new MetadataStore(storage.directory('metadata'));
15
16
  await store.load();
16
17
  expect(store.parties?.length).toBe(0);
17
18
 
@@ -33,7 +34,8 @@ describe('MetadataStore in-memory', () => {
33
34
  });
34
35
 
35
36
  it('Creates party when adding feed', async () => {
36
- const store = new MetadataStore(createStorage('metadata', StorageType.RAM));
37
+ const storage = createStorage('', StorageType.RAM);
38
+ const store = new MetadataStore(storage.directory('metadata'));
37
39
  await store.load();
38
40
 
39
41
  const partyKey = PublicKey.random();
@@ -45,7 +47,8 @@ describe('MetadataStore in-memory', () => {
45
47
  });
46
48
 
47
49
  it('Doesn\'t add same feed twice', async () => {
48
- const store = new MetadataStore(createStorage('metadata', StorageType.RAM));
50
+ const storage = createStorage('', StorageType.RAM);
51
+ const store = new MetadataStore(storage.directory('metadata'));
49
52
  await store.load();
50
53
 
51
54
  const partyKey = PublicKey.random();
@@ -60,7 +63,8 @@ describe('MetadataStore in-memory', () => {
60
63
 
61
64
  // TODO(yivlad): Doesn't work for now.
62
65
  it.skip('Resets storage', async () => {
63
- const store = new MetadataStore(createStorage('snapshots', StorageType.RAM));
66
+ const storage = createStorage('snapshots', StorageType.RAM);
67
+ const store = new MetadataStore(storage.directory(''));
64
68
 
65
69
  const partyKey = PublicKey.random();
66
70
  const feedKey = PublicKey.random();
@@ -8,7 +8,7 @@ import debug from 'debug';
8
8
  import { PublicKey } from '@dxos/crypto';
9
9
  import { failUndefined } from '@dxos/debug';
10
10
  import { EchoMetadata, PartyMetadata, schema } from '@dxos/echo-protocol';
11
- import { Storage } from '@dxos/random-access-multi-storage';
11
+ import { Directory } from '@dxos/random-access-multi-storage';
12
12
 
13
13
  /**
14
14
  * Version for the schema of the stored data as defined in dxos.echo.metadata.EchoMetadata.
@@ -28,7 +28,7 @@ export class MetadataStore {
28
28
  };
29
29
 
30
30
  constructor (
31
- private readonly _storage: Storage
31
+ private readonly _directory: Directory
32
32
  ) {}
33
33
 
34
34
  get version (): number {
@@ -47,7 +47,7 @@ export class MetadataStore {
47
47
  * Loads metadata from persistent storage.
48
48
  */
49
49
  async load (): Promise<void> {
50
- const file = this._storage.createOrOpen('EchoMetadata');
50
+ const file = this._directory.createOrOpen('EchoMetadata');
51
51
  try {
52
52
  const { size } = await file.stat();
53
53
  if (size === 0) {
@@ -75,7 +75,7 @@ export class MetadataStore {
75
75
  updated: new Date()
76
76
  };
77
77
 
78
- const file = this._storage.createOrOpen('EchoMetadata');
78
+ const file = this._directory.createOrOpen('EchoMetadata');
79
79
 
80
80
  try {
81
81
  const encoded = Buffer.from(schema.getCodecForType('dxos.echo.metadata.EchoMetadata').encode(data));
@@ -90,7 +90,7 @@ export class MetadataStore {
90
90
  */
91
91
  async clear (): Promise<void> {
92
92
  log('Clearing all echo metadata...');
93
- await this._storage.destroy();
93
+ await this._directory.delete();
94
94
  }
95
95
 
96
96
  /**