import { Context } from '@temporalio/activity' ; import { CancelledFailure } from '@temporalio/common' ; export async function fakeProgress ( sleepIntervalMs = 1000 ) { try { for ( let progress = 1 ; progress <= 100 ; ++ progress ) { await Context . current ( ) . sleep ( sleepIntervalMs ) ; Context . current ( ) . heartbeat ( progress ) ; } } catch ( err ) { if ( err instanceof CancelledFailure ) { console . log ( 'Fake progress activity cancelled' ) ; } throw err ; } }