From c4eecfdc6932c4886689ef9ec2bedaf0ff90949a Mon Sep 17 00:00:00 2001 From: bigint <69431456+bigint@users.noreply.github.com> Date: Mon, 26 Feb 2024 22:47:00 +0530 Subject: [PATCH] chore: remove notion again --- apps/api/.env.example | 1 - apps/api/package.json | 1 - apps/api/src/lib/notion/createNotionClient.ts | 9 --------- apps/api/src/lib/notion/notionBlocks.ts | 10 ---------- .../src/lib/notion/pushToNotionDatabase.ts | 20 ------------------- apps/api/src/routes/leafwatch/events.ts | 14 ------------- pnpm-lock.yaml | 20 ------------------- 7 files changed, 75 deletions(-) delete mode 100644 apps/api/src/lib/notion/createNotionClient.ts delete mode 100644 apps/api/src/lib/notion/notionBlocks.ts delete mode 100644 apps/api/src/lib/notion/pushToNotionDatabase.ts diff --git a/apps/api/.env.example b/apps/api/.env.example index dd7852c036c9..a4bf4820d3cf 100644 --- a/apps/api/.env.example +++ b/apps/api/.env.example @@ -11,4 +11,3 @@ IMAGEKIT_URL="" ZENDESK_API_KEY="" RAILWAY_TOKEN="" RELAYER_PRIVATE_KEYS="" -NOTION_TOKEN="" diff --git a/apps/api/package.json b/apps/api/package.json index 889483dc13a2..834b98ea107e 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -28,7 +28,6 @@ "@hey/data": "workspace:*", "@hey/lib": "workspace:*", "@irys/sdk": "^0.1.9", - "@notionhq/client": "^2.2.14", "@prisma/client": "^5.10.2", "axios": "^1.6.7", "cors": "^2.8.5", diff --git a/apps/api/src/lib/notion/createNotionClient.ts b/apps/api/src/lib/notion/createNotionClient.ts deleted file mode 100644 index cfd14501aaa8..000000000000 --- a/apps/api/src/lib/notion/createNotionClient.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Client } from '@notionhq/client'; - -const createNotionClient = () => { - return new Client({ - auth: process.env.NOTION_TOKEN - }); -}; - -export default createNotionClient; diff --git a/apps/api/src/lib/notion/notionBlocks.ts b/apps/api/src/lib/notion/notionBlocks.ts deleted file mode 100644 index 5e0ee7a7e636..000000000000 --- a/apps/api/src/lib/notion/notionBlocks.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const notionTitle = (content: string) => { - return { title: [{ text: { content }, type: 'text' }], type: 'title' }; -}; - -export const notionText = (content: string) => { - return { - rich_text: [{ text: { content }, type: 'text' }], - type: 'rich_text' - }; -}; diff --git a/apps/api/src/lib/notion/pushToNotionDatabase.ts b/apps/api/src/lib/notion/pushToNotionDatabase.ts deleted file mode 100644 index 93ac58e83481..000000000000 --- a/apps/api/src/lib/notion/pushToNotionDatabase.ts +++ /dev/null @@ -1,20 +0,0 @@ -import logger from '@hey/lib/logger'; - -import createNotionClient from './createNotionClient'; - -const notion = createNotionClient(); - -const pushToNotionDatabase = async (database_id: string, properties: any) => { - try { - const newPage = await notion.pages.create({ - parent: { database_id }, - properties - }); - - return newPage; - } catch { - logger.error('Failed to push to Notion database'); - } -}; - -export default pushToNotionDatabase; diff --git a/apps/api/src/routes/leafwatch/events.ts b/apps/api/src/routes/leafwatch/events.ts index ad62a5a90a68..9748dc2d3eb2 100644 --- a/apps/api/src/routes/leafwatch/events.ts +++ b/apps/api/src/routes/leafwatch/events.ts @@ -6,8 +6,6 @@ import requestIp from 'request-ip'; import catchedError from 'src/lib/catchedError'; import createClickhouseClient from 'src/lib/createClickhouseClient'; import checkEventExistence from 'src/lib/leafwatch/checkEventExistence'; -import { notionText, notionTitle } from 'src/lib/notion/notionBlocks'; -import pushToNotionDatabase from 'src/lib/notion/pushToNotionDatabase'; import { invalidBody, noBody } from 'src/lib/responses'; import UAParser from 'ua-parser-js'; import urlcat from 'urlcat'; @@ -113,18 +111,6 @@ export const post: Handler = async (req, res) => { ] }); - // Ingest to Notion for auditing with some retention policy - pushToNotionDatabase('ebebaad1899a43f5a707d7739f3c46ac', { - Actor: notionText(actor || 'N/A'), - Country: notionText(ipData?.country || 'N/A'), - Event: notionText(name), - ID: notionTitle('#'), - IP: notionText(ip || 'N/A'), - Properties: notionText(JSON.stringify(properties) || 'N/A'), - Referrer: notionText(referrer || 'N/A'), - URL: notionText(url || 'N/A') - }); - logger.info('Ingested event to Leafwatch'); return res.status(200).json({ id: result.query_id, success: true }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0bd06d882c07..f9f4b68a8fab 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -44,9 +44,6 @@ importers: '@irys/sdk': specifier: ^0.1.9 version: 0.1.9(arweave@1.14.4) - '@notionhq/client': - specifier: ^2.2.14 - version: 2.2.14 '@prisma/client': specifier: ^5.10.2 version: 5.10.2(prisma@5.10.2) @@ -6016,16 +6013,6 @@ packages: '@nomicfoundation/solidity-analyzer-win32-x64-msvc': 0.1.1 dev: true - /@notionhq/client@2.2.14: - resolution: {integrity: sha512-oqUefZtCiJPCX+74A1Os9OVTef3fSnVWe2eVQtU1HJSD+nsfxfhwvDKnzJTh2Tw1ZHKLxpieHB/nzGdY+Uo12A==} - engines: {node: '>=12'} - dependencies: - '@types/node-fetch': 2.6.11 - node-fetch: 2.7.0 - transitivePeerDependencies: - - encoding - dev: false - /@openzeppelin/contracts-upgradeable@5.0.1(@openzeppelin/contracts@5.0.1): resolution: {integrity: sha512-MvaLoPnVcoZr/qqZP+4cl9piuR4gg0iIGgxVSZ/AL1iId3M6IdEHzz9Naw5Lirl4KKBI6ciTVnX07yL4dOMIJg==} peerDependencies: @@ -8715,13 +8702,6 @@ packages: /@types/ms@0.7.34: resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==} - /@types/node-fetch@2.6.11: - resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==} - dependencies: - '@types/node': 20.11.20 - form-data: 4.0.0 - dev: false - /@types/node@10.17.60: resolution: {integrity: sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==} dev: true