grammyjs / storages

Storage adapters for grammY sessions.
49 stars 29 forks source link

feat: add Cloudflare Workers KV adapter #169

Closed KnorpelSenf closed 1 year ago

KnorpelSenf commented 1 year ago

I received a rudimentary JS file by someone without a GH account which implements a storage adapter for Cloudflare's key-value store called Workers KV.

This is an early draft. It contains the correct logic for all operations, but neither does it typecheck nor does it follow the right setup for a new adapter. Docs are missing, too.

Ideally, it'd be awesome if you could take over from here, @Satont. I can help with this, of course. Please let me know if you need anything.

Satont commented 1 year ago

Should we release it as npm package?

rojvv commented 1 year ago

Definitely!

Satont commented 1 year ago

Definitely!

I just never worked with cloudflare workers, that's why asked.

rojvv commented 1 year ago

Same, but I thought it’s important to be an NPM package since the development is NPM-powered.

https://grammy.dev/hosting/cloudflare-workers.html

Satont commented 1 year ago

@KnorpelSenf should i mention you as author of npm package?

Also what name should we choose for that storage in npm? Something like @grammyjs/storage-cloudflare?

rojvv commented 1 year ago

@grammyjs/storage-cloudflare could be confusing since Cloudflare has other storage solutions. Maybe @grammyjs/storage-cloudflare-kv, @grammyjs/storage-cloudflare-workers, or @grammyjs/storage-cloudflare-workers-kv?

rojvv commented 1 year ago

I personally prefer @grammyjs/storage-cloudflare-workers-kv.

KnorpelSenf commented 1 year ago

@KnorpelSenf should i mention you as author of npm package?

We do not know the name or username of the original author. Perhaps we use grammyjs?

Also what name should we choose for that storage in npm? Something like @grammyjs/storage-cloudflare?

I'll ask about this. The proprietary name is Workers KV, but I'm not sure if we maybe should include the name cloudflare, too. I'll get back to you.

Satont commented 1 year ago

@KnorpelSenf @roj1512 i think it's ready for review.

KnorpelSenf commented 1 year ago

Approved in https://t.me/grammyjs/118121, feel free to merge.