-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ANNOUNCEMENT: Plans for the next major version 15.0.0 #4994
Comments
If I may suggest a good idea for a premium plugin: Convert a Zod schema to RxSchema. Zod is becoming widely used for marrying TypeScript with runtime validation. I, and many others, already have Zod schemas defined for my data models. This would make adopting RxDB much easier. |
@galaxyblur I see the value in this. But there is already zod-to-json-schema. So wouldnt this be like 5 lines of code that transform the zod schema to json schema? |
@pubkey i paid for premium but i think i want to use surrealdb , can you support surrealdb ? |
Fair enough! I totally missed that RxSchema is just json-schema, which is great. Thanks. |
@gigasource No there is no plan for a surrealdb RxStorage. Last time I checked they where not major enough. This might change in the future. |
Added
|
I mean replication , they supports Change feed, i think it takes not too much time because it is like couchdb . I want to change to surrealdb from couchdb now. |
One thing we have come across that would be useful to be able to have a TTL on records stored locally. In our use case there are certain forms of data we only need to know about the last 14 days. Currently after the application is initialized we pull down the last 14 days, and start to sync future records onto the device but overtime these records eventually stack up. It would be great to have the ability to remove anything older than 14 days without deleting it and having that sync to the backend. |
One other use case we have is the issue of parent and child records, ie one record has a foreign key on the other. When syncing this means that until the parent is synced the child will fail. Ideal there would be a way to specify relationships in the records and the sync of collections could be coordinated. But i have also thought putting a delay on the child could also work. Not sure if anyone else has this issue. |
This is the big tradeoff. RxDB choose to have a simple-as-possible replication protocol, so that it can be implemented on top of any infrastructure. To make this possible, we do not have cross-document transactions and it is not possible to enforce coordinated replications. Most users do not have this problem because they pack everything that belongs together, into the same document. Your code should assume that a linked document can exist, but also might not be there (yet). |
Instrumentation (Measure) RxDB (storage) internals with eventsThis could help identifying performance issues, like missing indices, bad & inefficient queries, manual re-sorts. There are two different types of use for such data points. One is obviously for immediate performance debugging ( Example // When subscribed to events via console -> this is logged via console.warn in development
rxdb.storage.indexeddb.query 01HCHY44REABSK4DK22PVWQ1DN: Manual (slow) resort. Check if adding an index for sort fields could help. sortFields=[category, triage_status] When looking at the event from a structured logging perspective, we create this string from:
rxdb.storage.indexeddb.query 01HCHY44REABSK4DK22PVWQ1DN loaded=322, visited=322, results=322, indexEfficiency=1.0, query={
"selector": {
"category": "article",
"triage_status": "shortlist"
},
"sort": [ { "category": "asc" } ],
"skip": 0
} rxdb.storage.indexeddb.index 01HCHY44REABSK4DK22PVWQ1DN index=[_deleted, category, triage_status], index_id=i12, lower_bound=false,61989911,5e-324, upper_bound=false,61989911 The ULID ( I think producing these stats can be implemented w/o having a severe effect on the overall performance. Besides instrumenting the individual storage instances, there might also be other places where eventing could be helpful. Query and Doc cache is one I can think of. Not sure how this should be implemented, there might be other popular libraries that already do that. The Rails |
checkpointsIn order to keep track of document changes in scenarios like Undo/Redo stacks or version control in general, it would be a very pleasant DX if we could have a native checkpoints plugin. Here's a rough example API I can imagine: const collectionCreator = {
// schema, migrations, etc.
checkpoints: true,
methods: {
someFn: function(this) {
// incremental modify/patch, etc.
this.setCheckpoint('someFn', {/*optional context information*/})
}
}
} then when working with a document we could have methods like |
@ShahriarHD RxDB only stores the latest known document state. |
@pubkey totally agree it's a good fit for the CRDT plugin, I think building this on top of the CRDT plugin can also help with even more complex scenarios, for example: a multiplayer undo stack where each user can undo their own actions, not affecting changes made by others. |
Could we add support for JSON Type Definition, a new RFC8927 that offers a much simpler alternative to JSON Schema? It is designed to be well-aligned with type systems and has tools for both validation and type code generation for multiple languages. Secondly, are there guidelines and API docs for developing plugins for RxDB? I would personally like to contribute my DBML - RxDB plugin, which manages server-client schema sync, partial schema sync, and generates some scaffolding in a given directory. It also can support ORMs like Prisma with a DBML generator plugin. I have only tried it with Prisma due to its flexible schema AST-as-JSON, which they internally call DMMF. When putting this together, I had to work with JSON Schema and I personally found it too verbose and cumbersome. Now that JTD is there, adding support for it might help with RxDB's DX. The aforementioned library (not currently an RXDB plugin) doesn't require JTD so it can come in as a PR, if welcome, regardless of JTD support. Seems like a move to JTD or even a second class support for JTD might help with type mixing issues. Unlike JSON Schema, JTD does not allow defining values that can take one of several types. There is a workaround using |
@risavkarna Is it possible to define maxLength and maximum for strings and integers in JSON Type Definition? |
Not natively. But using We would need a custom validator function to check if the data matches the metadata. More flexibility for other complex requirements can be had this way. As I am not yet familiar enough with RxDB internals, perhaps you could advise if this is a worthwhile tradeoff in the context of RxDB. |
I do not really see the benefits here. But anyway this should be a simple functions which transfrom JDT to a valid JsonSchema. Similiar to this #4994 (comment) |
Thank you for your great ideas. Most of them can be implemented without any breaking change, so I will not add them to the todo list. RxDB v15 beta has been released. Please help testing: #5155 |
@eliias Thank you for that great proposal. I added a logging plugin to the premium plugins. |
I started working on the next major RxDB version 15
The biggest changes will be:
"type": "module"
see hereOther planned changes can be found here.
Current changes in the v15 can be found here
If you have any idea or proposal on how to improve RxDB (even with breaking changes), please propose them here.
The text was updated successfully, but these errors were encountered: