Skip to content

Commit f939902

Browse files
committed
Update TS and fix breaking changes in functions
1 parent 5e8c8a7 commit f939902

File tree

7 files changed

+12
-18
lines changed

7 files changed

+12
-18
lines changed

functions/package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

functions/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"firebase-tools": "13.6.0",
3737
"form-data": "^3.0.1",
3838
"lodash": "^4.17.21",
39-
"node-fetch": "^2.6.1",
4039
"ts-custom-error": "^3.3.1"
4140
},
4241
"devDependencies": {
@@ -47,7 +46,7 @@
4746
"eslint-plugin-import": "^2.25.4",
4847
"firestore-vitest": "^0.20.2",
4948
"jest-expect-message": "^1.0.2",
50-
"typescript": "^4.9.5",
49+
"typescript": "^5.9.3",
5150
"vitest": "^4.0.4"
5251
},
5352
"private": true

functions/src/callable/alert.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as functions from 'firebase-functions'
2-
import fetch from 'node-fetch'
32
import { isEmpty } from 'lodash'
43
import { getOpsGenieEnv } from '../helpers/env'
54

functions/src/email/send.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { isEmpty } from 'lodash'
2-
import FormData from 'form-data'
3-
import fetch, { Response } from 'node-fetch'
42
import { MailgunEnv } from '../types/MailgunEnv'
53

64
export interface EmailData {

functions/src/http/apiFunction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { onRequest } from 'firebase-functions/v2/https'
2-
import { createApiServer } from '../api/api'
2+
import { createFastifyAPI } from '../api/api'
33

44
// Export the API as a Firebase HTTP function
55
export const api = onRequest(
@@ -13,7 +13,7 @@ export const api = onRequest(
1313
async (request, response) => {
1414
try {
1515
// Create and start the Fastify server
16-
const server = await createApiServer()
16+
const server = await createFastifyAPI()
1717

1818
// Use Fastify's built-in adapter for Firebase Functions
1919
await server.ready()

functions/src/http/sendContactEmail.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as functions from 'firebase-functions'
22
import { getAppEnv, getMailgunEnv } from '../helpers/env'
3-
import fetch, { Response } from 'node-fetch'
43
import send from '../email/send'
54

65
export const sendContactEmail = functions.https.onRequest(async (req, res) => {
@@ -58,11 +57,11 @@ const isRecaptchaV3Valid = async (recaptchaV3Value: string) => {
5857
return fetch(
5958
`https://www.google.com/recaptcha/api/siteverify?secret=${appEnv.recaptchaV3Secret}&response=${recaptchaV3Value}`
6059
)
61-
.then((response) => response.json())
62-
.then((response) => {
60+
.then((response: Response) => response.json())
61+
.then((response: { success: boolean; score: number }) => {
6362
return response.success && response.score > 0.5
6463
})
65-
.catch((error) => {
64+
.catch((error: Error) => {
6665
console.error(error)
6766
return false
6867
})

functions/src/triggers/invites/userInvite.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as functions from 'firebase-functions'
22
import admin from 'firebase-admin'
33
import send from '../../email/send'
44
import { isEmpty } from 'lodash'
5-
import { Response } from 'node-fetch'
65
import { getAppEnv, getMailgunEnv } from '../../helpers/env'
76
import { generateInviteEmail } from './generateInviteEmail'
87
import { applyInvites } from './applyInvites'

0 commit comments

Comments
 (0)