yorkie-js-sdk icon indicating copy to clipboard operation
yorkie-js-sdk copied to clipboard

Move presence into document

Open Eithea opened this issue 1 year ago • 1 comments

What this PR does / why we need it?

Presence maps (that is the presence data of document's actors) exists only on the client. It may make not good userbility. This commit moves SOT of presence from client to document and add doc event about actor presence. After applying, user can get presence from doc event.

  • [x] define class Presence
  • [ ] add Presece to Document's field and create required methods
  • [ ] ~~remove SOT of presence in Client and replace that with Document's~~
  • [ ] deliver custom presence initial info in ClientOptions to doc when a doc attached
  • [ ] define doc events corresponding to ClientEventType.PeersChanged and add that to doc.eventStreamObserver
  • [ ] define a client method which sync presence (corresponding to syncInternal) and use that to runSyncLoop's promise
  • [ ] (if necessary) rename Document to an appropriate name like Room, Workspace ...
  • [ ] (in additional) move selection logic from operation to presence to solve storing issue (#379)

Any background context you want to provide?

What are the relevant tickets?

Fixes #302

Checklist

  • [ ] Added relevant tests or not required
  • [ ] Didn't break anything

Eithea avatar Aug 23 '22 04:08 Eithea

Codecov Report

Merging #382 (2d2b28f) into main (893b2c9) will increase coverage by 0.04%. The diff coverage is 100.00%.

:exclamation: Current head 2d2b28f differs from pull request most recent head a6c5c7c. Consider uploading reports for the commit a6c5c7c to get more accurate results

@@            Coverage Diff             @@
##             main     #382      +/-   ##
==========================================
+ Coverage   89.04%   89.09%   +0.04%     
==========================================
  Files          73       74       +1     
  Lines        5487     5509      +22     
  Branches      544      544              
==========================================
+ Hits         4886     4908      +22     
  Misses        410      410              
  Partials      191      191              
Impacted Files Coverage Δ
src/document/crdt/array.ts 83.72% <ø> (ø)
src/document/crdt/rga_tree_list.ts 85.83% <ø> (ø)
src/core/client.ts 76.26% <100.00%> (-0.19%) :arrow_down:
src/document/document.ts 80.90% <100.00%> (+1.90%) :arrow_up:
src/document/presence.ts 100.00% <100.00%> (ø)
test/integration/client_test.ts 100.00% <100.00%> (ø)
test/integration/primitive_test.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Aug 23 '22 04:08 codecov[bot]