You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The browser based SSE implementation is based on EventEmitter interface and I think its a good idea to stick to that, would async/await being common we should support that too.
We could expose a cdc property with on(...) method for supported events insert | update | delete.
constturso=createClient({url: process.env.TURSO_DATABASE_URL,authToken: process.env.TURSO_AUTH_TOKEN,});// non-asyncturso.cdc.on("insert","myTable",(event)=>{// user code here});// asyncturso.cdc.on("insert","myTable",async(event)=>{// user code here});
Small problem is that current implementation doesn't provide information about what's actually changed, it's just a signal to say an event of insert | update | delete as occurred.
User on discord notrab suggested using triggers to track changes and manage a audit log table. I had a similar idea in previous discussion of CDC and think its clever and probably easiest to implement.
Decision now becomes, does this belong in the SDK as a plugin/extension that allows the user to install the triggers and audit log table OR should this be in documentation that a user will need to manually install ?
My two cents would be that we manage this as some sort of plugin/extension that is opt-in and is an optional configuration property. I think it could work like this:
configure plugin in createClient constructor
createClient would install triggers and name spaced audit log table
consumer can register turso.cdc.on(...) handlers and listen for events
"closing" the client should uninstall triggers and audit log table
Let me know your thoughts. I would also be happy to start on a prototype to get a feel for what works well internally and is easy to manage from consumer side.
Cheers.
The text was updated successfully, but these errors were encountered:
I've been looking into the new beta
/listen
endpoint and wondering how consumers would be using this from Typescript SDK.There is currently no "native" support for SSE on the server side (nodejs process) for SSE that supports authorization headers.
I did manage to find a polly-fill of sorts that adds support for headers and usable from nodejs
API Suggestion
The browser based SSE implementation is based on
EventEmitter
interface and I think its a good idea to stick to that, would async/await being common we should support that too.We could expose a
cdc
property withon(...)
method for supported eventsinsert | update | delete
.Small problem is that current implementation doesn't provide information about what's actually changed, it's just a signal to say an event of
insert | update | delete
as occurred.User on discord notrab suggested using triggers to track changes and manage a audit log table. I had a similar idea in previous discussion of CDC and think its clever and probably easiest to implement.
Decision now becomes, does this belong in the SDK as a plugin/extension that allows the user to install the triggers and audit log table OR should this be in documentation that a user will need to manually install ?
My two cents would be that we manage this as some sort of plugin/extension that is opt-in and is an optional configuration property. I think it could work like this:
createClient
constructorcreateClient
would install triggers and name spaced audit log tableturso.cdc.on(...)
handlers and listen for eventsLet me know your thoughts. I would also be happy to start on a prototype to get a feel for what works well internally and is easy to manage from consumer side.
Cheers.
The text was updated successfully, but these errors were encountered: