diff --git a/index.js b/index.js index b42a9b3..8c75881 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ +import "isomorphic-fetch"; // Automatically polyfills fetch import dotenv from "dotenv"; import DiscordJS, { ActionRowBuilder, ApplicationCommandOptionType, ChannelType, GatewayIntentBits, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, } from "discord.js"; -import axios from "axios"; import express from "express"; import { GoogleAuth } from "google-auth-library"; import { google } from "googleapis"; @@ -8,6 +8,8 @@ import bodyParser from "body-parser"; import OpenAI from "openai"; import { sleep } from "openai/core"; import dayjs from "dayjs"; +import pino from "pino"; +import { createPinoBrowserSend, createWriteStream } from "pino-logflare"; dotenv.config(); const app = express(); const PORT = process.env.PORT || 3000; @@ -18,40 +20,6 @@ app.listen(PORT, () => { console.log(`Server is listening on port ${PORT}`); }); const spreadsheetId = process.env.SPREADSHEET_ID || ""; -const categoryPrompt = `You are an intelligent AI assistant built by Glific team to help Glific"s team analyze the incoming queries on Glific"s NGO-support channel on discord. Glific is a chatbot platform and the discord channel for NGOs using the chatbot to share their issues and seek support. You will get NGO query as input, your main purpose is to analyze the query and categorize or tag the query raised in top 3 most relevant categories and also share your thinking for choosing the most relevant tag in the Reason attribute - -Generate the output in following JSON format and don't add any other words apart from the output in the following format - -{ -"Most relevant tag": "Tag 1", -"2nd most relevant tag": " Tag 2", -"3rd most relevant tag": "Tag 3", -"Reason": " Reason for selecting the tags" -} - -Here are a few examples for few NGO queries -Example 1: -{ -"Most relevant tag": "Knowledge", -"2nd most relevant tag":"Whatsapp Manager", -"3rd most relevant tag":"", -"Reason":"" -} -Example 2: -{ -"Most relevant tag": "Fb verification", -"2nd most relevant tag":"1-1 support", -"3rd most relevant tag":"", -"Reason":"", -} -Example 3: -{ -"Most relevant tag": "Bug", -"2nd most relevant tag":"Profiles", -"3rd most relevant tag":"Not urgent", -"Reason":"" -} -`; const tagIds = [ { id: "1037985352536830013", name: "Knowledge Gap" }, { id: "1037985383465627679", name: "Bug" }, @@ -74,6 +42,29 @@ const tagIds = [ { id: "1280027263685099604", name: "Sept" }, { id: "1290533381821567030", name: "Oct" }, ]; +const setLogs = (error) => { + const sourceToken = process.env.LOG_FLARE_SOURCE; + const apiKey = process.env.LOG_FLARE_API; + if (sourceToken && apiKey) { + const stream = createWriteStream({ + apiKey, + sourceToken, + }); + const send = createPinoBrowserSend({ + apiKey, + sourceToken, + }); + const logger = pino({ + browser: { + transmit: { + // @ts-ignore + send, + }, + }, + }, stream); + logger.error(error); + } +}; const writeToSheets = async (values) => { const requestBody = { values, @@ -98,7 +89,7 @@ const writeToSheets = async (values) => { return result; } catch (err) { - // TODO (Developer) - Handle exception + setLogs(err); throw err; } }; @@ -121,18 +112,24 @@ const updateSheets = async (id, values) => { const header = rows[0]; const idIndex = header.indexOf("thread_id"); if (idIndex === -1) { - console.log("thread id not found"); + setLogs({ message: "thread column not found", threadId: id }); return; } // Find the row with the matching ID const rowIndex = rows.findIndex((row) => row[idIndex] === id); if (rowIndex === -1) { - console.log("Row with the specified ID not found"); + setLogs({ + message: "Row with the specified ID not found", + threadId: id, + }); } const updatePromises = Object.entries(values).map(async ([column, newValue]) => { const columnIndex = header.indexOf(column); if (columnIndex === -1) { - console.log(`Column "${column}" not found`); + setLogs({ + message: "Column not found", + threadId: id, + }); return; } const cellRange = `${String.fromCharCode(65 + columnIndex)}${rowIndex + 1}`; @@ -150,7 +147,11 @@ const updateSheets = async (id, values) => { return results; } catch (err) { - console.error("Error updating sheet:", err); + setLogs({ + error: err, + message: "Error updating sheet", + threadId: id, + }); throw err; } }; @@ -158,25 +159,6 @@ app.post("/chat", async (req, res) => { const user_input = req.body.user_input; res(getAnswerFromOpenAIAssistant(user_input, "")); }); -const getAnswerFromJugalbandi = async (message, prompt) => { - const apiUrl = process.env.API_URL; - const params = { - uuid_number: process.env.GLIFIC_DOC_UUID || "", - query_string: encodeURIComponent(message), - prompt: encodeURIComponent(prompt), - }; - // Convert the params object into a query string - const queryParams = new URLSearchParams(params).toString(); - try { - const result = await axios.get(`${apiUrl}?${queryParams}`, { - timeout: 120000, - }); - return result.data.answer; - } - catch (e) { - return "Sorry, I am not able to answer this question due to timeout in API. Please try again later."; - } -}; const getAnswerFromOpenAIAssistant = async (message, prompt) => { const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY, @@ -202,6 +184,7 @@ const getAnswerFromOpenAIAssistant = async (message, prompt) => { "incomplete", "expired", ].includes(run.status)) { + setLogs(JSON.stringify(run)); return "Sorry, I am not able to answer this question due to timeout in API. Please try again later."; } await sleep(1000); @@ -212,10 +195,12 @@ const getAnswerFromOpenAIAssistant = async (message, prompt) => { return message.content[0].text.value; } } + setLogs(JSON.stringify({ run, message })); return "Sorry, I am not able to answer this question due to timeout in API. Please try again later."; } catch (e) { - return "Sorry, I am not able to answer this question due to timeout in API. Please try again later"; + setLogs(JSON.stringify(e)); + return "Sorry, I am not able to answer this question due to timeout in API. Please try again later."; } }; const client = new DiscordJS.Client({ @@ -257,6 +242,10 @@ async function registerCommand() { } catch (error) { console.error("Error registering command:", error); + setLogs({ + message: "Error registering command", + error, + }); } } function processStringArray(arr, chunkSize = 10, separator = "\n") { @@ -412,7 +401,6 @@ client.on("threadCreate", async (thread) => { thread.send(answer); thread.send(role?.toString() + " team please check if this needs any further attention."); - const category = await getAnswerFromOpenAIAssistant(message, categoryPrompt); let values = [ [ threadId, diff --git a/index.ts b/index.ts index ef5d2c8..b6014ab 100644 --- a/index.ts +++ b/index.ts @@ -1,3 +1,4 @@ +import "isomorphic-fetch"; // Automatically polyfills fetch import dotenv from "dotenv"; import DiscordJS, { ActionRowBuilder, @@ -9,7 +10,6 @@ import DiscordJS, { StringSelectMenuOptionBuilder, ThreadChannel, } from "discord.js"; -import axios from "axios"; import express from "express"; import { GoogleAuth } from "google-auth-library"; import { google } from "googleapis"; @@ -17,11 +17,12 @@ import bodyParser from "body-parser"; import OpenAI from "openai"; import { sleep } from "openai/core"; import dayjs from "dayjs"; +import pino from "pino"; +import { createPinoBrowserSend, createWriteStream } from "pino-logflare"; dotenv.config(); const app = express(); const PORT = process.env.PORT || 3000; - app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); app.use(express.static("public")); @@ -31,40 +32,6 @@ app.listen(PORT, () => { }); const spreadsheetId = process.env.SPREADSHEET_ID || ""; -const categoryPrompt = `You are an intelligent AI assistant built by Glific team to help Glific"s team analyze the incoming queries on Glific"s NGO-support channel on discord. Glific is a chatbot platform and the discord channel for NGOs using the chatbot to share their issues and seek support. You will get NGO query as input, your main purpose is to analyze the query and categorize or tag the query raised in top 3 most relevant categories and also share your thinking for choosing the most relevant tag in the Reason attribute - -Generate the output in following JSON format and don't add any other words apart from the output in the following format - -{ -"Most relevant tag": "Tag 1", -"2nd most relevant tag": " Tag 2", -"3rd most relevant tag": "Tag 3", -"Reason": " Reason for selecting the tags" -} - -Here are a few examples for few NGO queries -Example 1: -{ -"Most relevant tag": "Knowledge", -"2nd most relevant tag":"Whatsapp Manager", -"3rd most relevant tag":"", -"Reason":"" -} -Example 2: -{ -"Most relevant tag": "Fb verification", -"2nd most relevant tag":"1-1 support", -"3rd most relevant tag":"", -"Reason":"", -} -Example 3: -{ -"Most relevant tag": "Bug", -"2nd most relevant tag":"Profiles", -"3rd most relevant tag":"Not urgent", -"Reason":"" -} -`; const tagIds = [ { id: "1037985352536830013", name: "Knowledge Gap" }, @@ -89,6 +56,37 @@ const tagIds = [ { id: "1290533381821567030", name: "Oct" }, ]; +const setLogs = (error: any) => { + const sourceToken = process.env.LOG_FLARE_SOURCE; + const apiKey = process.env.LOG_FLARE_API; + + if (sourceToken && apiKey) { + const stream = createWriteStream({ + apiKey, + sourceToken, + }); + + const send = createPinoBrowserSend({ + apiKey, + sourceToken, + }); + + const logger = pino( + { + browser: { + transmit: { + // @ts-ignore + send, + }, + }, + }, + stream + ); + + logger.error(error); + } +}; + const writeToSheets = async (values: any) => { const requestBody = { values, @@ -115,7 +113,7 @@ const writeToSheets = async (values: any) => { console.log("%d cells updated.", result.data.updates?.updatedCells); return result; } catch (err) { - // TODO (Developer) - Handle exception + setLogs(err); throw err; } }; @@ -142,7 +140,7 @@ const updateSheets = async (id: string, values: any) => { const idIndex = header.indexOf("thread_id"); if (idIndex === -1) { - console.log("thread id not found"); + setLogs({ message: "thread column not found", threadId: id }); return; } @@ -150,14 +148,20 @@ const updateSheets = async (id: string, values: any) => { const rowIndex = rows.findIndex((row) => row[idIndex] === id); if (rowIndex === -1) { - console.log("Row with the specified ID not found"); + setLogs({ + message: "Row with the specified ID not found", + threadId: id, + }); } const updatePromises = Object.entries(values).map( async ([column, newValue]) => { const columnIndex = header.indexOf(column); if (columnIndex === -1) { - console.log(`Column "${column}" not found`); + setLogs({ + message: "Column not found", + threadId: id, + }); return; } @@ -180,7 +184,11 @@ const updateSheets = async (id: string, values: any) => { console.log("%d cells updated.", results.length); return results; } catch (err) { - console.error("Error updating sheet:", err); + setLogs({ + error: err, + message: "Error updating sheet", + threadId: id, + }); throw err; } }; @@ -190,26 +198,6 @@ app.post("/chat", async (req: any, res: any) => { res(getAnswerFromOpenAIAssistant(user_input, "")); }); -const getAnswerFromJugalbandi = async (message: string, prompt: string) => { - const apiUrl = process.env.API_URL; - - const params = { - uuid_number: process.env.GLIFIC_DOC_UUID || "", - query_string: encodeURIComponent(message), - prompt: encodeURIComponent(prompt), - }; - // Convert the params object into a query string - const queryParams = new URLSearchParams(params).toString(); - - try { - const result = await axios.get(`${apiUrl}?${queryParams}`, { - timeout: 120000, - }); - return result.data.answer; - } catch (e) { - return "Sorry, I am not able to answer this question due to timeout in API. Please try again later."; - } -}; const getAnswerFromOpenAIAssistant = async ( message: string, @@ -248,6 +236,7 @@ const getAnswerFromOpenAIAssistant = async ( "expired", ].includes(run.status) ) { + setLogs(JSON.stringify(run)); return "Sorry, I am not able to answer this question due to timeout in API. Please try again later."; } await sleep(1000); @@ -262,9 +251,11 @@ const getAnswerFromOpenAIAssistant = async ( } } + setLogs(JSON.stringify({ run, message })); return "Sorry, I am not able to answer this question due to timeout in API. Please try again later."; } catch (e) { - return "Sorry, I am not able to answer this question due to timeout in API. Please try again later"; + setLogs(JSON.stringify(e)); + return "Sorry, I am not able to answer this question due to timeout in API. Please try again later."; } }; @@ -309,6 +300,10 @@ async function registerCommand() { } } catch (error) { console.error("Error registering command:", error); + setLogs({ + message: "Error registering command", + error, + }); } } @@ -494,6 +489,7 @@ client.on("interactionCreate", async (interaction) => { client.on("ready", async () => { registerCommand(); + setLogs("Bot is ready"); }); client.login(process.env.BOT_TOKEN); @@ -520,10 +516,6 @@ client.on("threadCreate", async (thread) => { role?.toString() + " team please check if this needs any further attention." ); - const category = await getAnswerFromOpenAIAssistant( - message, - categoryPrompt - ); let values = [ [ diff --git a/package.json b/package.json index 8c561ae..9903a9a 100644 --- a/package.json +++ b/package.json @@ -1,32 +1,36 @@ { - "name": "ngo-support-bot", - "version": "1.0.0", - "main": "index.js", - "author": "Mohd Shamoon", - "license": "MIT", - "dependencies": { - "@google-cloud/bigquery": "^5.12.0", - "@octokit/rest": "^18.12.0", - "@types/express": "^4.17.13", - "axios": "^1.4.0", - "body-parser": "^1.20.2", - "dayjs": "^1.11.13", - "discord.js": "14.11.0", - "dotenv": "^16.0.0", - "express": "^4.18.2", - "google-auth-library": "^9.2.0", - "googleapis": "^128.0.0", - "node-cron": "^3.0.0", - "openai": "^4.47.1", - "quickchart-js": "^3.1.1", - "ts-node": "^10.7.0", - "typescript": "^4.6.3" - }, - "type": "module", - "scripts": { - "start": "ts-node-esm index.ts" - }, - "engines": { - "node": ">16.13.0" - } + "name": "ngo-support-bot", + "version": "1.0.0", + "main": "index.js", + "author": "Mohd Shamoon", + "license": "MIT", + "dependencies": { + "@google-cloud/bigquery": "^5.12.0", + "@octokit/rest": "^18.12.0", + "@types/express": "^4.17.13", + "@types/node-fetch": "^2.6.12", + "axios": "^1.4.0", + "body-parser": "^1.20.2", + "dayjs": "^1.11.13", + "discord.js": "14.11.0", + "dotenv": "^16.0.0", + "express": "^4.18.2", + "google-auth-library": "^9.2.0", + "googleapis": "^128.0.0", + "isomorphic-fetch": "^3.0.0", + "node-cron": "^3.0.0", + "openai": "^4.47.1", + "pino": "^9.5.0", + "pino-logflare": "^0.4.2", + "quickchart-js": "^3.1.1", + "ts-node": "^10.9.2", + "typescript": "^4.9.5" + }, + "type": "module", + "scripts": { + "start": "ts-node-esm index.ts" + }, + "engines": { + "node": ">16.13.0" + } } diff --git a/yarn.lock b/yarn.lock index 6292fa7..aab7f79 100644 --- a/yarn.lock +++ b/yarn.lock @@ -325,6 +325,14 @@ resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.2.tgz#93e25bf9ee75fe0fd80b594bc4feb0e862111b5a" integrity sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw== +"@types/node-fetch@^2.6.12": + version "2.6.12" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.12.tgz#8ab5c3ef8330f13100a7479e2cd56d3386830a03" + integrity sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA== + dependencies: + "@types/node" "*" + form-data "^4.0.0" + "@types/node-fetch@^2.6.4": version "2.6.11" resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.11.tgz#9b39b78665dae0e82a08f02f4967d62c66f95d24" @@ -441,6 +449,11 @@ asynckit@^0.4.0: resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== +atomic-sleep@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/atomic-sleep/-/atomic-sleep-1.0.0.tgz#eb85b77a601fc932cfe432c5acd364a9e2c9075b" + integrity sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ== + axios@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f" @@ -455,6 +468,13 @@ base64-js@^1.3.0: resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== +batch2@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/batch2/-/batch2-1.0.6.tgz#fd895cb92decc4277cae01bbc281354e0b1d7786" + integrity sha512-xZsZx73HfBcoUMITZwqRF+gO5RGx5Sf+hZjmxoRuu8xpYM003aSDM7uwKKbmATJG1Kuc5Rs0kck/0ALpOnue0w== + dependencies: + through2 "^3.0.1" + before-after-hook@^2.2.0: version "2.2.2" resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.2.tgz#a6e8ca41028d90ee2c24222f201c90956091613e" @@ -538,6 +558,11 @@ combined-stream@^1.0.8: dependencies: delayed-stream "~1.0.0" +commander@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae" + integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg== + content-disposition@0.5.4: version "0.5.4" resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe" @@ -678,7 +703,7 @@ encodeurl@~1.0.2: resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= -end-of-stream@^1.4.1: +end-of-stream@^1.1.0, end-of-stream@^1.4.1: version "1.4.4" resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== @@ -752,6 +777,21 @@ fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-json-parse@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/fast-json-parse/-/fast-json-parse-1.0.3.tgz#43e5c61ee4efa9265633046b770fb682a7577c4d" + integrity sha512-FRWsaZRWEJ1ESVNbDWmsAlqDk96gPQezzLghafp5J4GUKjbCz3OkAHuZs5TuPEtkbVQERysLp9xv6c24fBm8Aw== + +fast-redact@^3.0.0, fast-redact@^3.1.1: + version "3.5.0" + resolved "https://registry.yarnpkg.com/fast-redact/-/fast-redact-3.5.0.tgz#e9ea02f7e57d0cd8438180083e93077e496285e4" + integrity sha512-dwsoQlS7h9hMeYUq1W++23NDcBLV4KqONnITDV9DjfS3q1SgDGVrBdvvTLUotWtPSD7asWDV9/CmsZPy8Hf70A== + +fast-safe-stringify@^2.0.8: + version "2.1.1" + resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz#c406a83b6e70d9e35ce3b30a81141df30aeba884" + integrity sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA== + fast-text-encoding@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/fast-text-encoding/-/fast-text-encoding-1.0.3.tgz#ec02ac8e01ab8a319af182dae2681213cfe9ce53" @@ -779,6 +819,11 @@ finalhandler@1.2.0: statuses "2.0.1" unpipe "~1.0.0" +flatstr@^1.0.12: + version "1.0.12" + resolved "https://registry.yarnpkg.com/flatstr/-/flatstr-1.0.12.tgz#c2ba6a08173edbb6c9640e3055b95e287ceb5931" + integrity sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw== + follow-redirects@^1.15.0: version "1.15.2" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" @@ -1005,7 +1050,7 @@ ieee754@^1.2.1: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== -inherits@2.0.4, inherits@^2.0.3: +inherits@2.0.4, inherits@^2.0.3, inherits@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -1030,6 +1075,14 @@ is@^3.3.0: resolved "https://registry.yarnpkg.com/is/-/is-3.3.0.tgz#61cff6dd3c4193db94a3d62582072b44e5645d79" integrity sha512-nW24QBoPcFGGHJGUwnfpI7Yc5CdqWNdsyHQszVE/z2pKHXzh7FZ5GWhJqSyaQ9wMkQnsTx+kAI8bHlCX4tKdbg== +isomorphic-fetch@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz#0267b005049046d2421207215d45d6a262b8b8b4" + integrity sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA== + dependencies: + node-fetch "^2.6.1" + whatwg-fetch "^3.4.1" + javascript-stringify@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/javascript-stringify/-/javascript-stringify-2.1.0.tgz#27c76539be14d8bd128219a2d731b09337904e79" @@ -1069,6 +1122,11 @@ lodash@^4.17.21: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== +logflare-transport-core@^0.3.3: + version "0.3.3" + resolved "https://registry.yarnpkg.com/logflare-transport-core/-/logflare-transport-core-0.3.3.tgz#dade63f6b414b7d01727825ce0ccb830ed6f0f7e" + integrity sha512-n82NsRVWvlaa3jd9QQ8rDroCjCJcIamQOlarLDBou9RsF0QaRv39rduy0ToPmlGQn1OPZBwlsv+R36lXupSmVQ== + lru-cache@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" @@ -1188,6 +1246,11 @@ object-inspect@^1.9.0: resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.0.tgz#6e2c120e868fd1fd18cb4f18c31741d0d6e776f0" integrity sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g== +on-exit-leak-free@^2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz#fed195c9ebddb7d9e4c3842f93f281ac8dadd3b8" + integrity sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA== + on-finished@2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" @@ -1195,7 +1258,7 @@ on-finished@2.4.1: dependencies: ee-first "1.1.1" -once@^1.4.0: +once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= @@ -1250,6 +1313,77 @@ peek-readable@^5.0.0: resolved "https://registry.yarnpkg.com/peek-readable/-/peek-readable-5.0.0.tgz#7ead2aff25dc40458c60347ea76cfdfd63efdfec" integrity sha512-YtCKvLUOvwtMGmrniQPdO7MwPjgkFBtFIrmfSbYmYuq3tKDV/mcfAhBth1+C3ru7uXIZasc/pHnb+YDYNkkj4A== +pino-abstract-transport@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pino-abstract-transport/-/pino-abstract-transport-2.0.0.tgz#de241578406ac7b8a33ce0d77ae6e8a0b3b68a60" + integrity sha512-F63x5tizV6WCh4R6RHyi2Ml+M70DNRXt/+HANowMflpgGFMAym/VKm6G7ZOQRjqN7XbGxK1Lg9t6ZrtzOaivMw== + dependencies: + split2 "^4.0.0" + +pino-logflare@^0.4.2: + version "0.4.2" + resolved "https://registry.yarnpkg.com/pino-logflare/-/pino-logflare-0.4.2.tgz#c1a6238bbdfe00b3bc3070d392001bfe95e8ca7f" + integrity sha512-WiqSIpBGH2Cn1KOinB95ovxxsmHkx33/aF0zZy0iip7dIA/x2VRiPCo9/1+II4cls/rjcMmkoNOZHZx8zNWLGQ== + dependencies: + batch2 "^1.0.6" + commander "^5.0.0" + fast-json-parse "^1.0.3" + logflare-transport-core "^0.3.3" + pino "^6.3.2" + pumpify "^2.0.1" + split2 "^3.1.1" + through2 "^3.0.1" + +pino-std-serializers@^3.1.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-3.2.0.tgz#b56487c402d882eb96cd67c257868016b61ad671" + integrity sha512-EqX4pwDPrt3MuOAAUBMU0Tk5kR/YcCM5fNPEzgCO2zJ5HfX0vbiH9HbJglnyeQsN96Kznae6MWD47pZB5avTrg== + +pino-std-serializers@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-7.0.0.tgz#7c625038b13718dbbd84ab446bd673dc52259e3b" + integrity sha512-e906FRY0+tV27iq4juKzSYPbUj2do2X2JX4EzSca1631EB2QJQUqGbDuERal7LCtOpxl6x3+nvo9NPZcmjkiFA== + +pino@^6.3.2: + version "6.14.0" + resolved "https://registry.yarnpkg.com/pino/-/pino-6.14.0.tgz#b745ea87a99a6c4c9b374e4f29ca7910d4c69f78" + integrity sha512-iuhEDel3Z3hF9Jfe44DPXR8l07bhjuFY3GMHIXbjnY9XcafbyDDwl2sN2vw2GjMPf5Nkoe+OFao7ffn9SXaKDg== + dependencies: + fast-redact "^3.0.0" + fast-safe-stringify "^2.0.8" + flatstr "^1.0.12" + pino-std-serializers "^3.1.0" + process-warning "^1.0.0" + quick-format-unescaped "^4.0.3" + sonic-boom "^1.0.2" + +pino@^9.5.0: + version "9.5.0" + resolved "https://registry.yarnpkg.com/pino/-/pino-9.5.0.tgz#a7ef0fea868d22d52d8a4ce46e6e03c5dc46fdd6" + integrity sha512-xSEmD4pLnV54t0NOUN16yCl7RIB1c5UUOse5HSyEXtBp+FgFQyPeDutc+Q2ZO7/22vImV7VfEjH/1zV2QuqvYw== + dependencies: + atomic-sleep "^1.0.0" + fast-redact "^3.1.1" + on-exit-leak-free "^2.1.0" + pino-abstract-transport "^2.0.0" + pino-std-serializers "^7.0.0" + process-warning "^4.0.0" + quick-format-unescaped "^4.0.3" + real-require "^0.2.0" + safe-stable-stringify "^2.3.1" + sonic-boom "^4.0.1" + thread-stream "^3.0.0" + +process-warning@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/process-warning/-/process-warning-1.0.0.tgz#980a0b25dc38cd6034181be4b7726d89066b4616" + integrity sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q== + +process-warning@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/process-warning/-/process-warning-4.0.0.tgz#581e3a7a1fb456c5f4fd239f76bce75897682d5a" + integrity sha512-/MyYDxttz7DfGMMHiysAsFE4qF+pQYAA8ziO/3NcRVrQ5fSk+Mns4QZA/oRPFzvcqNoVJXQNWNAsdwBXLUkQKw== + proxy-addr@~2.0.7: version "2.0.7" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" @@ -1263,6 +1397,23 @@ proxy-from-env@^1.1.0: resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== +pump@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.2.tgz#836f3edd6bc2ee599256c924ffe0d88573ddcbf8" + integrity sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +pumpify@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-2.0.1.tgz#abfc7b5a621307c728b551decbbefb51f0e4aa1e" + integrity sha512-m7KOje7jZxrmutanlkS1daj1dS6z6BgslzOXmcSEpIlCxM3VJH7lG5QLeck/6hgF6F4crFf01UtQmNsJfweTAw== + dependencies: + duplexify "^4.1.1" + inherits "^2.0.3" + pump "^3.0.0" + qs@6.11.0: version "6.11.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" @@ -1277,6 +1428,11 @@ qs@^6.7.0: dependencies: side-channel "^1.0.4" +quick-format-unescaped@^4.0.3: + version "4.0.4" + resolved "https://registry.yarnpkg.com/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz#93ef6dd8d3453cbc7970dd614fad4c5954d6b5a7" + integrity sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg== + quickchart-js@^3.1.1: version "3.1.2" resolved "https://registry.yarnpkg.com/quickchart-js/-/quickchart-js-3.1.2.tgz#cd36e77d0baa7560e79f91f67ad1c1a086ccfdd8" @@ -1310,6 +1466,15 @@ raw-body@2.5.2: iconv-lite "0.4.24" unpipe "1.0.0" +"readable-stream@2 || 3", readable-stream@^3.0.0: + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + readable-stream@^3.1.1, readable-stream@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" @@ -1326,6 +1491,11 @@ readable-web-to-node-stream@^3.0.2: dependencies: readable-stream "^3.6.0" +real-require@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/real-require/-/real-require-0.2.0.tgz#209632dea1810be2ae063a6ac084fee7e33fba78" + integrity sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg== + retry-request@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/retry-request/-/retry-request-4.2.2.tgz#b7d82210b6d2651ed249ba3497f07ea602f1a903" @@ -1339,6 +1509,11 @@ safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@~5.2.0: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== +safe-stable-stringify@^2.3.1: + version "2.5.0" + resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz#4ca2f8e385f2831c432a719b108a3bf7af42a1dd" + integrity sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA== + "safer-buffer@>= 2.1.2 < 3": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -1387,6 +1562,33 @@ side-channel@^1.0.4: get-intrinsic "^1.0.2" object-inspect "^1.9.0" +sonic-boom@^1.0.2: + version "1.4.1" + resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-1.4.1.tgz#d35d6a74076624f12e6f917ade7b9d75e918f53e" + integrity sha512-LRHh/A8tpW7ru89lrlkU4AszXt1dbwSjVWguGrmlxE7tawVmDBlI1PILMkXAxJTwqhgsEeTHzj36D5CmHgQmNg== + dependencies: + atomic-sleep "^1.0.0" + flatstr "^1.0.12" + +sonic-boom@^4.0.1: + version "4.2.0" + resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-4.2.0.tgz#e59a525f831210fa4ef1896428338641ac1c124d" + integrity sha512-INb7TM37/mAcsGmc9hyyI6+QR3rR1zVRu36B0NeGXKnOOLiZOfER5SA+N7X7k3yUYRzLWafduTDvJAfDswwEww== + dependencies: + atomic-sleep "^1.0.0" + +split2@^3.1.1: + version "3.2.2" + resolved "https://registry.yarnpkg.com/split2/-/split2-3.2.2.tgz#bf2cf2a37d838312c249c89206fd7a17dd12365f" + integrity sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg== + dependencies: + readable-stream "^3.0.0" + +split2@^4.0.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/split2/-/split2-4.2.0.tgz#c9c5920904d148bab0b9f67145f245a86aadbfa4" + integrity sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg== + statuses@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" @@ -1440,6 +1642,21 @@ teeny-request@^7.0.0: stream-events "^1.0.5" uuid "^8.0.0" +thread-stream@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/thread-stream/-/thread-stream-3.1.0.tgz#4b2ef252a7c215064507d4ef70c05a5e2d34c4f1" + integrity sha512-OqyPZ9u96VohAyMfJykzmivOrY2wfMSf3C5TtFJVgN+Hm6aj+voFhlK+kZEIv2FBh1X6Xp3DlnCOfEQ3B2J86A== + dependencies: + real-require "^0.2.0" + +through2@^3.0.1: + version "3.0.2" + resolved "https://registry.yarnpkg.com/through2/-/through2-3.0.2.tgz#99f88931cfc761ec7678b41d5d7336b5b6a07bf4" + integrity sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ== + dependencies: + inherits "^2.0.4" + readable-stream "2 || 3" + toidentifier@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" @@ -1463,10 +1680,10 @@ ts-mixer@^6.0.3: resolved "https://registry.yarnpkg.com/ts-mixer/-/ts-mixer-6.0.3.tgz#69bd50f406ff39daa369885b16c77a6194c7cae6" integrity sha512-k43M7uCG1AkTyxgnmI5MPwKoUvS/bRvLvUb7+Pgpdlmok8AoqmUaZxUUw8zKM5B1lqZrt41GjYgnvAi0fppqgQ== -ts-node@^10.7.0: - version "10.9.1" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" - integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== +ts-node@^10.9.2: + version "10.9.2" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f" + integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ== dependencies: "@cspotcode/source-map-support" "^0.8.0" "@tsconfig/node10" "^1.0.7" @@ -1495,10 +1712,10 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" -typescript@^4.6.3: - version "4.6.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.3.tgz#eefeafa6afdd31d725584c67a0eaba80f6fc6c6c" - integrity sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw== +typescript@^4.9.5: + version "4.9.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" + integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== undici-types@~5.26.4: version "5.26.5" @@ -1572,6 +1789,11 @@ webidl-conversions@^3.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= +whatwg-fetch@^3.4.1: + version "3.6.20" + resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz#580ce6d791facec91d37c72890995a0b48d31c70" + integrity sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg== + whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"