automerge / automerge-classic

A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.
http://automerge.org/
MIT License
14.76k stars 467 forks source link

Proxy Free API #439

Open camiboj opened 2 years ago

camiboj commented 2 years ago

This is the PR created to start the iteration for including a new API without a proxy as discussed on #438 (cc @zhang123cnn @ept). *

Proxy Free API

Automerge uses JS Proxy extensively for its front-end API. However, to be able to support multiple JS runtime which does not support Proxy you can use the Proxy Free API.

This API does not modify the way automerge handles conflict or nested objects. It is only modifies the Object and Array APIs.

You can find documentation on this new API on proxy_free.md

zhang123cnn commented 2 years ago

@ept as discussed, would be great to get you folks to review this PR :) Many thanks

ept commented 2 years ago

Hi @camiboj, thank you very much for this contribution! As I mentioned on #438, we currently have a project underway to redesign the API between Automerge's frontend and backend, and this should allow the frontend to be substantially simplified. It might allow us to avoid using a proxy polyfill, and instead have a more straightforward proxy-free frontend that is a thin wrapper around the frontend-backend API.

If it's okay with you, I would like to keep this PR open and wait for the backend API redesign to land first. In that redesign we will keep in mind the desire for a proxy-free API. Once that redesign has landed, we will return to this PR and determine how best to structure the code to provide a choice between the current proxy-based API and the proxy-free API.

Sorry if that means you need to maintain a fork for a little while longer, but I think that approach will lead to the best results.

zhang123cnn commented 2 years ago

Hey @ept thanks for your comment. I think that makes sense to us. We can wait until the redesign is finished to review this PR. (Do you have a ETA on the redesign timeline? Last time I remember you said a couple of weeks. It would be great to be able to track this externally)

At the same time, do you mind if we create a public fork in our facebook github organization? We need to host this forked code in github for our upcoming release. Having a public fork would unlock us right now. We will delete that fork once this PR is merged back to original repo though.

Please let us know what you think. Many thanks

CC @jtannady

ept commented 2 years ago

No problem @zhang123cnn, feel free to make a fork!

jtannady commented 2 years ago

New fork created under the facebookincubator org. You can find it here.

https://github.com/facebookincubator/automerge

Thanks for all your support, @ept! 🎉