From 8ee97f39707ae179208b8ecd37cffcf6c74d5362 Mon Sep 17 00:00:00 2001 From: Artur Gubaidullin Date: Tue, 23 May 2023 01:55:55 +0400 Subject: [PATCH] fix(firestore)!: replace old adapter with new add conversation support fixes INVALID_ARGUMENT #167 --- packages/firestore/src/index.ts | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/packages/firestore/src/index.ts b/packages/firestore/src/index.ts index 4f626a003..c2bda88ad 100644 --- a/packages/firestore/src/index.ts +++ b/packages/firestore/src/index.ts @@ -1,16 +1,4 @@ -import type { CollectionReference } from '@google-cloud/firestore'; +import { createAdapter } from './adapter'; +import { getBinaryEncoder } from './binary-encoder'; -export function adapter(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(); - }, - }; -} \ No newline at end of file +export const adapter = createAdapter(getBinaryEncoder()); \ No newline at end of file