Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
fix(firestore)!: replace old adapter with new
Browse files Browse the repository at this point in the history
add conversation support
fixes INVALID_ARGUMENT grammyjs#167
  • Loading branch information
arthurgubaidullin committed May 22, 2023
1 parent b62412a commit 79f07cc
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions packages/firestore/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
import type { CollectionReference } from '@google-cloud/firestore';
import { createAdapter } from './adapter';
import { getBinaryEncoder } from './binary-encoder';

export function adapter<T>(collection: CollectionReference) {
return {
read: async (key: string) => {
const snapshot = await collection.doc(key).get();
return snapshot.data() as T | undefined;
},
write: async (key: string, value: T) => {
await collection.doc(key).set(value);
},
delete: async (key: string) => {
await collection.doc(key).delete();
},
};
}
export const adapter = createAdapter(getBinaryEncoder());

0 comments on commit 79f07cc

Please sign in to comment.