'use server'; import { z } from 'zod'; import { AppcondaException } from '../../client'; import { getSDKForCurrentUser } from '../../getSDKForCurrentUser'; import { ListNotionDatabasesSchema, ListNotionColumnsSchema, CreateNotionRowSchema } from './schema'; export const ListNotionDatabases = async (parsedInput: z.infer) => { try { const { notion } = await getSDKForCurrentUser(); //@ts-ignore const app = await notion.ListDatabases(parsedInput); return app; } catch (error) { if (error instanceof AppcondaException) { throw new Error(error.message); } throw error; } }; export const ListNotionColumns = async (parsedInput: z.infer) => { try { const { notion } = await getSDKForCurrentUser(); //@ts-ignore const app = await notion.ListColumns(parsedInput); return app; } catch (error) { if (error instanceof AppcondaException) { throw new Error(error.message); } throw error; } }; export const CreateNotionRow = async (parsedInput: z.infer) => { try { const { notion } = await getSDKForCurrentUser(); //@ts-ignore const app = await notion.CreateRow(parsedInput); return app; } catch (error) { if (error instanceof AppcondaException) { throw new Error(error.message); } throw error; } };