File tree Expand file tree Collapse file tree 7 files changed +12
-18
lines changed
Expand file tree Collapse file tree 7 files changed +12
-18
lines changed Original file line number Diff line number Diff line change 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" : {
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
Original file line number Diff line number Diff line change 11import * as functions from 'firebase-functions'
2- import fetch from 'node-fetch'
32import { isEmpty } from 'lodash'
43import { getOpsGenieEnv } from '../helpers/env'
54
Original file line number Diff line number Diff line change 11import { isEmpty } from 'lodash'
2- import FormData from 'form-data'
3- import fetch , { Response } from 'node-fetch'
42import { MailgunEnv } from '../types/MailgunEnv'
53
64export interface EmailData {
Original file line number Diff line number Diff line change 11import { 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
55export 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 ( )
Original file line number Diff line number Diff line change 11import * as functions from 'firebase-functions'
22import { getAppEnv , getMailgunEnv } from '../helpers/env'
3- import fetch , { Response } from 'node-fetch'
43import send from '../email/send'
54
65export 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 } )
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import * as functions from 'firebase-functions'
22import admin from 'firebase-admin'
33import send from '../../email/send'
44import { isEmpty } from 'lodash'
5- import { Response } from 'node-fetch'
65import { getAppEnv , getMailgunEnv } from '../../helpers/env'
76import { generateInviteEmail } from './generateInviteEmail'
87import { applyInvites } from './applyInvites'
You can’t perform that action at this time.
0 commit comments