Skip to content
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

fix(firestore): add conversations support #177

Conversation

arthurgubaidullin
Copy link
Contributor

I fixed data serialization/deserialization to Firestore document.

The conversation plugin uses an array of arrays structure. This data type is not supported by Firestore.

After my changes, the data will be stored in binary form in the document field.

I also removed the dependency on the package, since they are not needed.

Also this will fix the issue #167.

BREAKING CHANGES: this will most likely reset all sessions.

@Satont
Copy link
Member

Satont commented May 22, 2023

Why would you store binary in nosql database?

I'm not familiar with firestore, insteresting what @KnorpelSenf think, sincw he's author of this adapter.

@arthurgubaidullin
Copy link
Contributor Author

@Satont There are several reasons:

  1. This solves the problem with the Array<Array<_>> structure in all sessions at once.
  2. Sessions usually do not participate in queries and do not require indexes, which are created automatically for all fields in Firestore. For one field, it is easy to set up a ban on creating an index.
  3. Binary data takes up less space and consumes less traffic.
  4. The conversations plugin data can grow quite quickly due to its nature. Compact data will delay exceeding the limit.

@arthurgubaidullin arthurgubaidullin force-pushed the fix/firestore/add-conversations-support branch from 23fc91c to 40094ec Compare May 23, 2023 13:42
@Satont Satont requested a review from KnorpelSenf May 26, 2023 10:24
Copy link
Member

@KnorpelSenf KnorpelSenf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the reasoning behind serialisation and I agree that JSON is the right format here, but why do you want to add all the complexity? This basically is a rewrite of the adapter, and I'd like to understand why :)

@arthurgubaidullin
Copy link
Contributor Author

@KnorpelSenf, I took the initiative to revise the adapter due to its incompatibility with the conversation plugin, as its usage causes the entire application to crash.

If you don't mind, could you please elaborate on the specific challenges you are facing? I would greatly appreciate a detailed explanation.

Copy link
Member

@KnorpelSenf KnorpelSenf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I would've taken the simple path of merely adding (de)serialisation to packages/firestore/src/index.ts just like that. I was just wondering why you didn't—but then again, it's definitely a cleaner abstraction to add more interfaces etc.

I assume that you use this adapter actively (in contrast to me)? Would you be available in the future if we need to change something? :)

@arthurgubaidullin
Copy link
Contributor Author

Oh I would've taken the simple path of merely adding (de)serialisation to packages/firestore/src/index.ts just like that. I was just wondering why you didn't—but then again, it's definitely a cleaner abstraction to add more interfaces etc.

I prefer more explicit code, less room for error.

I assume that you use this adapter actively (in contrast to me)?

Right now I'm using my own version of the adapter.

Would you be available in the future if we need to change something?

I don't know.

@KnorpelSenf
Copy link
Member

I'll leave it up to @Satont if he wants to deal with the complexity you introduce. The motivation behind this pull request is reasonable.

@KnorpelSenf KnorpelSenf requested a review from Satont October 3, 2023 06:14
@Satont
Copy link
Member

Satont commented Oct 3, 2023

@arthurgubaidullin rebase please

@arthurgubaidullin arthurgubaidullin force-pushed the fix/firestore/add-conversations-support branch from 40094ec to c52f7d9 Compare October 3, 2023 14:46
@arthurgubaidullin
Copy link
Contributor Author

@Satont Something has gone wrong. I don't want to fix it. I do not have time. You can delete PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants