⬆️ Upgrade dependencies
This commit is contained in:
@@ -13,56 +13,55 @@
|
||||
"test:report": "pnpm playwright show-report"
|
||||
},
|
||||
"dependencies": {
|
||||
"@planetscale/database": "^1.7.0",
|
||||
"@sentry/nextjs": "7.53.1",
|
||||
"@trpc/server": "10.27.3",
|
||||
"@planetscale/database": "^1.8.0",
|
||||
"@sentry/nextjs": "7.58.1",
|
||||
"@trpc/server": "10.34.0",
|
||||
"@typebot.io/js": "workspace:*",
|
||||
"@typebot.io/prisma": "workspace:*",
|
||||
"@typebot.io/react": "workspace:*",
|
||||
"ai": "^2.1.18",
|
||||
"aws-sdk": "2.1384.0",
|
||||
"ai": "^2.1.20",
|
||||
"aws-sdk": "2.1415.0",
|
||||
"bot-engine": "workspace:*",
|
||||
"cors": "2.8.5",
|
||||
"eventsource-parser": "^1.0.0",
|
||||
"google-spreadsheet": "3.3.0",
|
||||
"google-spreadsheet": "4.0.2",
|
||||
"got": "12.6.0",
|
||||
"libphonenumber-js": "1.10.30",
|
||||
"next": "13.4.3",
|
||||
"libphonenumber-js": "1.10.37",
|
||||
"next": "13.4.9",
|
||||
"nextjs-cors": "2.1.2",
|
||||
"node-html-parser": "^6.1.5",
|
||||
"nodemailer": "6.9.2",
|
||||
"nodemailer": "6.9.3",
|
||||
"openai": "3.3.0",
|
||||
"openai-edge": "^1.2.0",
|
||||
"qs": "6.11.2",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"stripe": "12.6.0",
|
||||
"stripe": "12.13.0",
|
||||
"trpc-openapi": "1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@faire/mjml-react": "3.3.0",
|
||||
"@paralleldrive/cuid2": "2.2.0",
|
||||
"@playwright/test": "1.34.3",
|
||||
"@paralleldrive/cuid2": "2.2.1",
|
||||
"@playwright/test": "1.36.0",
|
||||
"@typebot.io/emails": "workspace:*",
|
||||
"@typebot.io/lib": "workspace:*",
|
||||
"@typebot.io/schemas": "workspace:*",
|
||||
"@typebot.io/tsconfig": "workspace:*",
|
||||
"@types/cors": "2.8.13",
|
||||
"@types/google-spreadsheet": "3.3.2",
|
||||
"@types/node": "20.2.3",
|
||||
"@types/node": "20.4.2",
|
||||
"@types/nodemailer": "6.4.8",
|
||||
"@types/papaparse": "5.3.7",
|
||||
"@types/qs": "6.9.7",
|
||||
"@types/react": "18.2.7",
|
||||
"@types/react": "18.2.15",
|
||||
"@types/sanitize-html": "2.9.0",
|
||||
"dotenv": "16.0.3",
|
||||
"eslint": "8.41.0",
|
||||
"dotenv": "16.3.1",
|
||||
"eslint": "8.44.0",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"google-auth-library": "8.8.0",
|
||||
"google-auth-library": "8.9.0",
|
||||
"node-fetch": "3.3.1",
|
||||
"papaparse": "5.4.1",
|
||||
"superjson": "1.12.3",
|
||||
"typescript": "5.0.4",
|
||||
"superjson": "1.12.4",
|
||||
"typescript": "5.1.6",
|
||||
"zod": "3.21.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,13 +37,13 @@ export const getRow = async (
|
||||
|
||||
try {
|
||||
await doc.loadInfo()
|
||||
const sheet = doc.sheetsById[sheetId]
|
||||
const sheet = doc.sheetsById[Number(sheetId)]
|
||||
const rows = await sheet.getRows()
|
||||
const filteredRows = getTotalRows(
|
||||
options.totalRowsToExtract,
|
||||
rows.filter((row) =>
|
||||
referenceCell
|
||||
? row[referenceCell.column as string] === referenceCell.value
|
||||
? row.get(referenceCell.column as string) === referenceCell.value
|
||||
: matchFilter(row, filter)
|
||||
)
|
||||
)
|
||||
@@ -64,7 +64,7 @@ export const getRow = async (
|
||||
.filter(isNotEmpty)
|
||||
const selectedRows = filteredRows.map((row) =>
|
||||
extractingColumns.reduce<{ [key: string]: string }>(
|
||||
(obj, column) => ({ ...obj, [column]: row[column] }),
|
||||
(obj, column) => ({ ...obj, [column]: row.get(column) }),
|
||||
{}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -9,18 +9,16 @@ export const getAuthenticatedGoogleDoc = async ({
|
||||
credentialsId?: string
|
||||
spreadsheetId?: string
|
||||
}) => {
|
||||
if (!credentialsId)
|
||||
if (!credentialsId || !spreadsheetId)
|
||||
throw new TRPCError({
|
||||
code: 'BAD_REQUEST',
|
||||
message: 'Missing credentialsId or sheetId',
|
||||
message: 'Missing credentialsId or spreadsheetId',
|
||||
})
|
||||
const doc = new GoogleSpreadsheet(spreadsheetId)
|
||||
const auth = await getAuthenticatedGoogleClient(credentialsId)
|
||||
if (!auth)
|
||||
throw new TRPCError({
|
||||
code: 'NOT_FOUND',
|
||||
message: "Couldn't find credentials in database",
|
||||
})
|
||||
doc.useOAuth2Client(auth)
|
||||
return doc
|
||||
return new GoogleSpreadsheet(spreadsheetId, auth)
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ export const matchFilter = (
|
||||
(comparison) =>
|
||||
comparison.column &&
|
||||
matchComparison(
|
||||
row[comparison.column],
|
||||
row.get(comparison.column),
|
||||
comparison.comparisonOperator,
|
||||
comparison.value
|
||||
)
|
||||
@@ -25,7 +25,7 @@ export const matchFilter = (
|
||||
(comparison) =>
|
||||
comparison.column &&
|
||||
matchComparison(
|
||||
row[comparison.column],
|
||||
row.get(comparison.column),
|
||||
comparison.comparisonOperator,
|
||||
comparison.value
|
||||
)
|
||||
|
||||
@@ -29,7 +29,7 @@ export const insertRow = async (
|
||||
|
||||
try {
|
||||
await doc.loadInfo()
|
||||
const sheet = doc.sheetsById[options.sheetId]
|
||||
const sheet = doc.sheetsById[Number(options.sheetId)]
|
||||
await sheet.addRow(parsedValues)
|
||||
log = {
|
||||
status: 'success',
|
||||
|
||||
@@ -34,11 +34,11 @@ export const updateRow = async (
|
||||
const parsedValues = parseCellValues(variables)(options.cellsToUpsert)
|
||||
|
||||
await doc.loadInfo()
|
||||
const sheet = doc.sheetsById[sheetId]
|
||||
const sheet = doc.sheetsById[Number(sheetId)]
|
||||
const rows = await sheet.getRows()
|
||||
const filteredRows = rows.filter((row) =>
|
||||
referenceCell
|
||||
? row[referenceCell.column as string] === referenceCell.value
|
||||
? row.get(referenceCell.column as string) === referenceCell.value
|
||||
: matchFilter(row, filter as NonNullable<typeof filter>)
|
||||
)
|
||||
if (filteredRows.length === 0) {
|
||||
@@ -58,9 +58,9 @@ export const updateRow = async (
|
||||
|
||||
try {
|
||||
for (const filteredRow of filteredRows) {
|
||||
const rowIndex = filteredRow.rowIndex - 2 // -1 for 0-indexing, -1 for header row
|
||||
const rowIndex = filteredRow.rowNumber - 2 // -1 for 1-indexing, -1 for header row
|
||||
for (const key in parsedValues) {
|
||||
rows[rowIndex][key] = parsedValues[key]
|
||||
rows[rowIndex].set(key, parsedValues[key])
|
||||
}
|
||||
await rows[rowIndex].save()
|
||||
}
|
||||
|
||||
@@ -61,20 +61,19 @@ const getRows = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
return
|
||||
}
|
||||
|
||||
const doc = new GoogleSpreadsheet(spreadsheetId)
|
||||
const client = await getAuthenticatedGoogleClient(credentialsId)
|
||||
if (!client) {
|
||||
notFound(res, "Couldn't find credentials in database")
|
||||
return
|
||||
}
|
||||
doc.useOAuth2Client(client)
|
||||
const doc = new GoogleSpreadsheet(spreadsheetId, client)
|
||||
await doc.loadInfo()
|
||||
const sheet = doc.sheetsById[sheetId]
|
||||
const sheet = doc.sheetsById[Number(sheetId)]
|
||||
try {
|
||||
const rows = await sheet.getRows()
|
||||
const filteredRows = rows.filter((row) =>
|
||||
referenceCell
|
||||
? row[referenceCell.column as string] === referenceCell.value
|
||||
? row.get(referenceCell.column as string) === referenceCell.value
|
||||
: matchFilter(row, filter as NonNullable<typeof filter>)
|
||||
)
|
||||
if (filteredRows.length === 0) {
|
||||
@@ -88,7 +87,7 @@ const getRows = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const response = {
|
||||
rows: filteredRows.map((row) =>
|
||||
extractingColumns.reduce<{ [key: string]: string }>(
|
||||
(obj, column) => ({ ...obj, [column]: row[column] }),
|
||||
(obj, column) => ({ ...obj, [column]: row.get(column) }),
|
||||
{}
|
||||
)
|
||||
),
|
||||
@@ -119,14 +118,13 @@ const insertRow = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
values: { [key: string]: string }
|
||||
}
|
||||
if (!hasValue(credentialsId)) return badRequest(res)
|
||||
const doc = new GoogleSpreadsheet(spreadsheetId)
|
||||
const auth = await getAuthenticatedGoogleClient(credentialsId)
|
||||
if (!auth)
|
||||
return res.status(404).send("Couldn't find credentials in database")
|
||||
doc.useOAuth2Client(auth)
|
||||
const doc = new GoogleSpreadsheet(spreadsheetId, auth)
|
||||
try {
|
||||
await doc.loadInfo()
|
||||
const sheet = doc.sheetsById[sheetId]
|
||||
const sheet = doc.sheetsById[Number(sheetId)]
|
||||
await sheet.addRow(values)
|
||||
await saveSuccessLog({ resultId, message: 'Succesfully inserted row' })
|
||||
return res.send({ message: 'Success' })
|
||||
@@ -149,22 +147,21 @@ const updateRow = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
values: { [key: string]: string }
|
||||
}
|
||||
if (!hasValue(credentialsId) || !referenceCell) return badRequest(res)
|
||||
const doc = new GoogleSpreadsheet(spreadsheetId)
|
||||
const auth = await getAuthenticatedGoogleClient(credentialsId)
|
||||
if (!auth)
|
||||
return res.status(404).send("Couldn't find credentials in database")
|
||||
doc.useOAuth2Client(auth)
|
||||
const doc = new GoogleSpreadsheet(spreadsheetId, auth)
|
||||
try {
|
||||
await doc.loadInfo()
|
||||
const sheet = doc.sheetsById[sheetId]
|
||||
const sheet = doc.sheetsById[Number(sheetId)]
|
||||
const rows = await sheet.getRows()
|
||||
const updatingRowIndex = rows.findIndex(
|
||||
(row) => row[referenceCell.column as string] === referenceCell.value
|
||||
(row) => row.get(referenceCell.column as string) === referenceCell.value
|
||||
)
|
||||
if (updatingRowIndex === -1)
|
||||
return res.status(404).send({ message: "Couldn't find row to update" })
|
||||
for (const key in values) {
|
||||
rows[updatingRowIndex][key] = values[key]
|
||||
rows[updatingRowIndex].set(key, values[key])
|
||||
}
|
||||
await rows[updatingRowIndex].save()
|
||||
await saveSuccessLog({ resultId, message: 'Succesfully updated row' })
|
||||
@@ -188,7 +185,7 @@ const matchFilter = (
|
||||
(comparison) =>
|
||||
comparison.column &&
|
||||
matchComparison(
|
||||
row[comparison.column],
|
||||
row.get(comparison.column),
|
||||
comparison.comparisonOperator,
|
||||
comparison.value
|
||||
)
|
||||
@@ -197,7 +194,7 @@ const matchFilter = (
|
||||
(comparison) =>
|
||||
comparison.column &&
|
||||
matchComparison(
|
||||
row[comparison.column],
|
||||
row.get(comparison.column),
|
||||
comparison.comparisonOperator,
|
||||
comparison.value
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user