@@ -170,6 +170,7 @@ function hasCurrentMessageDispatchDedupeTargets(params: {
170170 const store = createPluginStateSyncKeyedStore < PersistentDedupeEntry > ( "telegram" , {
171171 namespace : params . namespace ,
172172 maxEntries : TELEGRAM_MESSAGE_DISPATCH_DEDUPE_MAX_ENTRIES ,
173+ defaultTtlMs : TELEGRAM_MESSAGE_DISPATCH_DEDUPE_TTL_MS ,
173174 env : params . env ,
174175 } ) ;
175176 const existingByKey = new Map ( store . entries ( ) . map ( ( entry ) => [ entry . key , entry . value ] ) ) ;
@@ -436,7 +437,7 @@ function detectTelegramMessageDispatchLegacyStateMigration(params: {
436437 namespace : accountId ,
437438 } ) ,
438439 } ) ) ;
439- const jsonPlans = sources . flatMap ( ( source ) => {
440+ const jsonPlans : ChannelLegacyStateMigrationPlan [ ] = sources . flatMap ( ( source ) => {
440441 const sourcePath = source . sourcePath ;
441442 if ( ! fileExists ( sourcePath ) ) {
442443 return [ ] ;
@@ -449,6 +450,7 @@ function detectTelegramMessageDispatchLegacyStateMigration(params: {
449450 pluginId : "telegram" ,
450451 namespace,
451452 maxEntries : TELEGRAM_MESSAGE_DISPATCH_DEDUPE_MAX_ENTRIES ,
453+ defaultTtlMs : TELEGRAM_MESSAGE_DISPATCH_DEDUPE_TTL_MS ,
452454 scopeKey : "" ,
453455 cleanupSource : "rename" ,
454456 preview : `- Telegram message dispatch dedupe: ${ sourcePath } → plugin state (${ namespace } )` ,
@@ -476,27 +478,26 @@ function detectTelegramMessageDispatchLegacyStateMigration(params: {
476478 ) {
477479 return jsonPlans ;
478480 }
479- return [
480- ...jsonPlans ,
481- {
482- kind : "plugin-state-import" ,
483- label : "Telegram message dispatch dedupe" ,
484- sourcePath : `plugin state:${ TELEGRAM_MESSAGE_DISPATCH_LEGACY_BUCKET_NAMESPACE } :${ accountId } ` ,
485- targetPath : `plugin state:${ namespace } ` ,
486- pluginId : "telegram" ,
487- namespace,
488- maxEntries : TELEGRAM_MESSAGE_DISPATCH_DEDUPE_MAX_ENTRIES ,
489- scopeKey : "" ,
490- preview : `- Telegram message dispatch dedupe: plugin state (${ TELEGRAM_MESSAGE_DISPATCH_LEGACY_BUCKET_NAMESPACE } ) → plugin state (${ namespace } )` ,
491- shouldReplaceExistingEntry : ( { existingValue, incomingValue } ) =>
492- shouldReplacePersistentDedupeEntry ( { existingValue, incomingValue } ) ,
493- readEntries : ( ) =>
494- listTelegramLegacyMessageDispatchPluginStateEntries ( {
495- accountId,
496- env,
497- } ) ,
498- } ,
499- ] ;
481+ const pluginStatePlan : ChannelLegacyStateMigrationPlan = {
482+ kind : "plugin-state-import" ,
483+ label : "Telegram message dispatch dedupe" ,
484+ sourcePath : `plugin state:${ TELEGRAM_MESSAGE_DISPATCH_LEGACY_BUCKET_NAMESPACE } :${ accountId } ` ,
485+ targetPath : `plugin state:${ namespace } ` ,
486+ pluginId : "telegram" ,
487+ namespace,
488+ maxEntries : TELEGRAM_MESSAGE_DISPATCH_DEDUPE_MAX_ENTRIES ,
489+ defaultTtlMs : TELEGRAM_MESSAGE_DISPATCH_DEDUPE_TTL_MS ,
490+ scopeKey : "" ,
491+ preview : `- Telegram message dispatch dedupe: plugin state (${ TELEGRAM_MESSAGE_DISPATCH_LEGACY_BUCKET_NAMESPACE } ) → plugin state (${ namespace } )` ,
492+ shouldReplaceExistingEntry : ( { existingValue, incomingValue } ) =>
493+ shouldReplacePersistentDedupeEntry ( { existingValue, incomingValue } ) ,
494+ readEntries : ( ) =>
495+ listTelegramLegacyMessageDispatchPluginStateEntries ( {
496+ accountId,
497+ env,
498+ } ) ,
499+ } ;
500+ return [ ...jsonPlans , pluginStatePlan ] ;
500501 } ) ;
501502}
502503
0 commit comments