@@ -13,9 +13,9 @@ export const markNotificationState = internalMutation({
1313 state : v . union (
1414 v . literal ( "delivered" ) ,
1515 v . literal ( "failed" ) ,
16- v . literal ( "maybe_delivered" )
16+ v . literal ( "maybe_delivered" ) ,
1717 ) ,
18- } )
18+ } ) ,
1919 ) ,
2020 checkJobId : v . id ( "_scheduled_functions" ) ,
2121 } ,
@@ -71,7 +71,7 @@ export const coordinateSendingPushNotifications = internalMutation({
7171 . withIndex ( "state" , ( q ) => q . eq ( "state" , "awaiting_delivery" ) )
7272 . take ( MAX_NOTIFICATIONS_PER_SEND - retryNotifications . length ) ;
7373 ctx . logger . debug (
74- `Found ${ retryNotifications . length } retry notifications and ${ unsentNotifications . length } unsent notifications`
74+ `Found ${ retryNotifications . length } retry notifications and ${ unsentNotifications . length } unsent notifications` ,
7575 ) ;
7676 const notificationsToProcess = [
7777 ...retryNotifications ,
@@ -101,18 +101,18 @@ export const coordinateSendingPushNotifications = internalMutation({
101101 if ( numActiveSenders >= MAX_SENDERS ) {
102102 // Don't add another sender yet
103103 ctx . logger . debug (
104- `Not starting another sender: already ${ numActiveSenders } `
104+ `Not starting another sender: already ${ numActiveSenders } ` ,
105105 ) ;
106106 ctx . logger . debug (
107- `When one sender finishes, or fails, we'll coordinate sending these notifications.`
107+ `When one sender finishes, or fails, we'll coordinate sending these notifications.` ,
108108 ) ;
109109 return ;
110110 }
111111 const notificationsToSend = notificationsToProcess . filter (
112- ( n ) => n . numPreviousFailures < MAX_RETRY_ATTEMPTS
112+ ( n ) => n . numPreviousFailures < MAX_RETRY_ATTEMPTS ,
113113 ) ;
114114 const notificationsToMarkAsUnableToDeliver = notificationsToProcess . filter (
115- ( n ) => n . numPreviousFailures >= MAX_RETRY_ATTEMPTS
115+ ( n ) => n . numPreviousFailures >= MAX_RETRY_ATTEMPTS ,
116116 ) ;
117117
118118 for ( const notification of notificationsToMarkAsUnableToDeliver ) {
@@ -134,7 +134,7 @@ export const coordinateSendingPushNotifications = internalMutation({
134134 {
135135 notificationIds : notificationsToSend . map ( ( n ) => n . _id ) ,
136136 logLevel : ctx . logger . level ,
137- }
137+ } ,
138138 ) ;
139139
140140 const senderJobId = await ctx . scheduler . runAfter (
@@ -165,14 +165,14 @@ export const coordinateSendingPushNotifications = internalMutation({
165165 } ;
166166 } ) ,
167167 logLevel : ctx . logger . level ,
168- }
168+ } ,
169169 ) ;
170170 await ctx . db . insert ( "senders" , {
171171 jobId : senderJobId ,
172172 checkJobId,
173173 } ) ;
174174 ctx . logger . debug (
175- `Started a new sender ${ senderJobId } with job ${ senderJobId } and check job ${ checkJobId } `
175+ `Started a new sender ${ senderJobId } with job ${ senderJobId } and check job ${ checkJobId } ` ,
176176 ) ;
177177 } ,
178178} ) ;
@@ -184,7 +184,7 @@ export const checkForFailedAction = internalMutation({
184184 handler : async ( ctx , { notificationIds } ) => {
185185 console . warn (
186186 `Could not determine delivery status for ${ notificationIds . length } notifications:` ,
187- notificationIds
187+ notificationIds ,
188188 ) ;
189189 for ( const notificationId of notificationIds ) {
190190 // We don't really know what happened to these notifications,
@@ -204,18 +204,18 @@ export const action_sendPushNotifications = internalAction({
204204 v . object ( {
205205 message : v . object ( {
206206 to : v . string ( ) ,
207- ...notificationFields
207+ ...notificationFields ,
208208 } ) ,
209209 _id : v . id ( "notifications" ) ,
210- } )
210+ } ) ,
211211 ) ,
212212 } ,
213213 handler : async ( ctx , args ) => {
214214 ctx . logger . debug (
215- `Sending ${ args . notifications . length } push notifications via Expo's API`
215+ `Sending ${ args . notifications . length } push notifications via Expo's API` ,
216216 ) ;
217217 ctx . logger . debug (
218- `Notification IDs: ${ JSON . stringify ( args . notifications . map ( ( n ) => n . _id ) ) } `
218+ `Notification IDs: ${ JSON . stringify ( args . notifications . map ( ( n ) => n . _id ) ) } ` ,
219219 ) ;
220220 let response : Response ;
221221 try {
@@ -232,10 +232,10 @@ export const action_sendPushNotifications = internalAction({
232232 } catch ( _e ) {
233233 ctx . logger . error (
234234 "Failed during during fetch for sending push notifications:" ,
235- _e
235+ _e ,
236236 ) ;
237237 ctx . logger . debug (
238- `Marking ${ args . notifications . length } notifications as failed so they can be retried`
238+ `Marking ${ args . notifications . length } notifications as failed so they can be retried` ,
239239 ) ;
240240 await ctx . runMutation ( internal . internal . markNotificationState , {
241241 notifications : args . notifications . map ( ( n ) => {
@@ -253,10 +253,10 @@ export const action_sendPushNotifications = internalAction({
253253 }
254254 if ( ! response . ok ) {
255255 ctx . logger . warn (
256- `Push notification failed with status ${ response . status } and body ${ await response . text ( ) } `
256+ `Push notification failed with status ${ response . status } and body ${ await response . text ( ) } ` ,
257257 ) ;
258258 ctx . logger . debug (
259- `Marking ${ args . notifications . length } notifications as maybe delivered. They won't be retried.`
259+ `Marking ${ args . notifications . length } notifications as maybe delivered. They won't be retried.` ,
260260 ) ;
261261 await ctx . runMutation ( internal . internal . markNotificationState , {
262262 notifications : args . notifications . map ( ( n ) => {
@@ -279,7 +279,7 @@ export const action_sendPushNotifications = internalAction({
279279 > ;
280280 } = await response . json ( ) ;
281281 ctx . logger . debug (
282- `Response from Expo's API: ${ JSON . stringify ( responseBody ) } `
282+ `Response from Expo's API: ${ JSON . stringify ( responseBody ) } ` ,
283283 ) ;
284284
285285 const notificationStates : Array < {
@@ -302,7 +302,7 @@ export const action_sendPushNotifications = internalAction({
302302 }
303303 }
304304 ctx . logger . debug (
305- `Successfully parsed response from Expo, and recording state`
305+ `Successfully parsed response from Expo, and recording state` ,
306306 ) ;
307307 await ctx . runMutation ( internal . internal . markNotificationState , {
308308 notifications : notificationStates ,
0 commit comments