haydnv / tinychain

A next-gen database + SaaS framework for rapid development and integration of enterprise services
Apache License 2.0
46 stars 10 forks source link

Design & implement JavaScript client #187

Open haydnv opened 1 year ago

ansarizafar commented 10 months ago

Is there any progress on Javascript client?

haydnv commented 10 months ago

Hi @ansarizafar this is coming up as a top priority soon (next 1-2 months). The current thinking is that the JavaScript client will use eager execution instead of deferred execution but otherwise will work like the Python client and will be packaged and distributed with npm. Do you have any specific needs you'd like to see addressed?

ansarizafar commented 10 months ago

I am trying to understand what is TinyChain? Is it a database, a blockchain or an application platform? Is three any video introduction/tutorial on youtube? Discord link is also not working.

haydnv commented 10 months ago

It's all of the above! TinyChain's Table and Tensor data structures support database and ML applications and you can implement a Service to provide a REST API backed by these data structures, optionally wrapped by a Block chain to provide a tamper-proof record of how your application's state changes over time (useful e.g. in finance or supply chain management where application state is shared between multiple counterparties).

You can see example implementations in the tests: https://github.com/haydnv/tinychain/tree/main/tests/tctest/services

I did make some tutorial videos here but are there other topics you would like to see covered?

haydnv commented 8 months ago

Hi @Naveednyc, thank you again for volunteering to help out!

The JavaScript client should be installable a a node.js package and should provide the same general functionality as the Python client with the one major architectural difference that it should resolve references immediately rather than constructing a deferred-execution graph. This means that all Scalar types should execute locally (e.g. Number(1) + Number(2) should return Number(3) without making a network request). In case it's impractical to implement a method locally, it's OK to raise an exception.

Probably the easiest order to work in is:

Note that implementing OpRef will require parsing the response, which is not implemented in the Python client.

After implementing the Scalar types it should be straightforward to stub out the remaining State types so that they have callable methods (e.g. Collection(URI("/myservice/mycollection")).get("key") should execute a GET request and return either None or a Tuple of values).

Ideally there should be some automated tests for core functionality.

Let me know if any of this is at all unclear and of course please reach out if you need help getting started or understanding implementation details, goals, etc.