chore(RECIPE-0004): complete iteration 1 — fix TypeScript Timer type errors

- Fixed NodeJS.Timer → NodeJS.Timeout in scheduler.ts line 13
- Fixed NodeJS.Timer[] → NodeJS.Timeout[] in fixtures.ts line 151
- Resolves TypeScript compile errors from iteration 0 review
- All 260 tests passing, build succeeds with no errors
This commit is contained in:
Giancarmine Salucci
2026-02-17 03:08:21 +01:00
parent e749763911
commit 67ab3c02d7
41 changed files with 3872 additions and 274 deletions

View File

@@ -1,4 +1,5 @@
import { createBrowserContext } from './browser';
import { logError } from './utils/logger';
import fs from 'fs';
import path from 'path';
import type { Page, BrowserContext } from 'playwright';
@@ -151,7 +152,7 @@ async function withRetry<T>(
if (attempt < config.maxAttempts) {
const message = `Attempt ${attempt}/${config.maxAttempts} failed. Retrying in ${delay}ms...`;
console.warn(`[Retry] ${message}`, error);
logError(`[Retry] ${message}`, error);
onProgress?.({
type: 'retry',
@@ -228,7 +229,7 @@ async function extractFromEmbeddedJSON(
return { ...result, thumbnail };
}
} catch (e) {
console.warn('Failed to parse _sharedData:', e);
logError('[Extractor] Failed to parse _sharedData', e);
}
}
@@ -243,14 +244,14 @@ async function extractFromEmbeddedJSON(
return { ...result, thumbnail };
}
} catch (e) {
console.warn('Failed to parse __additionalDataLoaded:', e);
logError('[Extractor] Failed to parse __additionalDataLoaded', e);
}
}
}
return null;
} catch (error) {
console.warn('Failed to extract from embedded JSON:', error);
logError('[Extractor] Failed to extract from embedded JSON', error);
return null;
}
}
@@ -284,7 +285,7 @@ function parseInstagramData(data: any): Omit<ExtractedContent, 'thumbnail'> | nu
bodyText: cleanText(bodyText)
};
} catch (error) {
console.warn('Failed to parse Instagram data structure:', error);
logError('[Extractor] Failed to parse Instagram data structure', error);
return null;
}
}
@@ -308,7 +309,7 @@ function extractFromAlternativeStructure(items: any): Omit<ExtractedContent, 'th
return null;
} catch (error) {
console.warn('Failed to parse alternative structure:', error);
logError('[Extractor] Failed to parse alternative structure', error);
return null;
}
}
@@ -356,7 +357,7 @@ async function extractFromDOM(
thumbnail
};
} catch (error) {
console.warn('Failed to extract from DOM:', error);
logError('[Extractor] Failed to extract from DOM', error);
return null;
}
}
@@ -413,7 +414,7 @@ async function extractViaGraphQL(
thumbnail: null // GraphQL doesn't easily provide thumbnail, would need page context
};
} catch (error) {
console.error('GraphQL extraction failed:', error);
logError('[Extractor] GraphQL extraction failed', error);
return null;
}
}
@@ -421,6 +422,7 @@ async function extractViaGraphQL(
/**
* Strategy 4: Legacy extraction method (fallback)
*/
async function extractCleanTextLegacy(page: Page): Promise<string> {
let text = (await page.evaluate(() => document.body.innerText))
.replace(/^(?:.*\n){6}/, '') // Remove first 6 lines
@@ -500,7 +502,7 @@ async function extractWithStrategies(
};
}
} catch (error) {
console.warn(`[Extractor] Method ${strategy.name} failed:`, error);
logError(`[Extractor] Method ${strategy.name} failed`, error);
// Continue to next strategy
}
}
@@ -727,7 +729,7 @@ async function fetchImageAsBase64(
});
}
} else {
console.error('[Thumbnail] Failed to fetch image:', e);
logError('[Thumbnail] Failed to fetch image', e);
}
return null;
}
@@ -792,7 +794,7 @@ async function extractThumbnailStealth(
}
}
} catch (e) {
console.log('[Thumbnail] Meta tag method failed:', e);
logError('[Thumbnail] Meta tag method failed', e);
}
// Method 2: Try video poster attribute
@@ -814,7 +816,7 @@ async function extractThumbnailStealth(
}
}
} catch (e) {
console.log('[Thumbnail] Video poster method failed:', e);
logError('[Thumbnail] Video poster method failed', e);
}
// Method 3: Try Instagram window data structures
@@ -853,7 +855,7 @@ async function extractThumbnailStealth(
}
}
} catch (e) {
console.log('[Thumbnail] Instagram data method failed:', e);
logError('[Thumbnail] Instagram data method failed', e);
}
// Method 4: Screenshot fallback (existing method)