@@ -405,13 +405,12 @@ export async function upsert({
405
405
// A record is billed only once per month. ie:
406
406
// - If a record is inserted, it is billed
407
407
// - If a record is updated, it is billed if it has not been billed yet during the current month
408
- // - If a record is undeleted, it is billed if it has not been billed yet during the current month
409
- // - If a record is deleted, it is billed if it has not been billed yet during the current month
408
+ // - If a record is undeleted, it is not billed
409
+ // - If a record is deleted, it is not billed
410
410
411
411
if ( softDelete ) {
412
412
const deleted = res . filter ( ( r ) => r . status === 'deleted' ) ;
413
413
summary . deletedKeys ?. push ( ...deleted . map ( ( r ) => r . external_id ) ) ;
414
- summary . billedKeys . push ( ...billable ( deleted ) . map ( ( r ) => r . external_id ) ) ;
415
414
} else {
416
415
const undeletedRes = res . filter ( ( r ) => r . status === 'undeleted' ) ;
417
416
const changedRes = res . filter ( ( r ) => r . status === 'changed' ) ;
@@ -420,7 +419,7 @@ export async function upsert({
420
419
const undeletedKeys = undeletedRes . map ( ( r ) => r . external_id ) ;
421
420
const addedKeys = insertedKeys . concat ( undeletedKeys ) ;
422
421
const updatedKeys = changedRes . map ( ( r ) => r . external_id ) ;
423
- const billableKeys = [ ...insertedKeys , ...billable ( [ ... changedRes , ... undeletedRes ] ) . map ( ( r ) => r . external_id ) ] ;
422
+ const billableKeys = [ ...insertedKeys , ...billable ( changedRes ) . map ( ( r ) => r . external_id ) ] ;
424
423
425
424
summary . addedKeys . push ( ...addedKeys ) ;
426
425
summary . updatedKeys . push ( ...updatedKeys ) ;
0 commit comments