1- // Doctor-only import for the retired Web Push JSON stores.
21import { createHash } from "node:crypto" ;
32import fs from "node:fs" ;
43import path from "node:path" ;
@@ -51,14 +50,10 @@ type ParsedLegacyState = {
5150 snapshots : LegacySourceSnapshot [ ] ;
5251} ;
5352
54- function resolveLegacyWebPushPaths ( stateDir : string ) : {
55- subscriptionsPath : string ;
56- vapidKeysPath : string ;
57- } {
58- const pushDir = path . join ( stateDir , "push" ) ;
53+ function resolveLegacyWebPushPaths ( stateDir : string ) {
5954 return {
60- subscriptionsPath : path . join ( pushDir , "web-push-subscriptions.json" ) ,
61- vapidKeysPath : path . join ( pushDir , "vapid-keys.json" ) ,
55+ subscriptionsPath : path . join ( stateDir , "push" , "web-push-subscriptions.json" ) ,
56+ vapidKeysPath : path . join ( stateDir , "push" , "vapid-keys.json" ) ,
6257 } ;
6358}
6459
@@ -84,13 +79,9 @@ function relativeLegacyPath(stateDir: string, filePath: string): string {
8479 return relativePath ;
8580}
8681
87- function sourceOrClaimMayExist ( sourcePath : string ) : boolean {
88- return (
89- legacyPathMayExist ( sourcePath ) || legacyPathMayExist ( `${ sourcePath } ${ DOCTOR_CLAIM_SUFFIX } ` )
90- ) ;
91- }
82+ const sourceOrClaimMayExist = ( sourcePath : string ) =>
83+ legacyPathMayExist ( sourcePath ) || legacyPathMayExist ( `${ sourcePath } ${ DOCTOR_CLAIM_SUFFIX } ` ) ;
9284
93- /** Detect retired Web Push state only when an explicit doctor flow opts in. */
9485export function detectLegacyWebPush ( params : {
9586 stateDir : string ;
9687 doctorOnlyStateMigrations ?: boolean ;
@@ -573,7 +564,6 @@ async function migrateLegacyWebPushWithExclusiveStateOwnership(params: {
573564 return { changes, warnings, notices } ;
574565}
575566
576- /** Import both retired stores while excluding old Gateways that can recreate them. */
577567export async function migrateLegacyWebPush ( params : {
578568 detected : LegacyStateDetection [ "webPush" ] ;
579569 stateDir : string ;
0 commit comments