feat: complete Priority 1 (100%) and start Priority 2 console cleanup
🎯 Priority 1 COMPLETE (100%): - Fixed last 2 any types in examples/stale-data-ux.ts - Achieved 100% any type elimination (113 → 0) - Perfect type safety across entire codebase 🚀 Priority 2 Progress: - Cleaned up console statements in core plugin files - Cleaned up console statements in test apps - Cleaned up console statements in examples - Replaced debug console.log with meaningful comments Linting status: ✅ 0 errors, 182 warnings (down from 436 warnings) Total improvement: 254 warnings fixed (58% reduction) Console statements: 80 remaining (down from 128, 38% reduction) Type safety: 100% any types eliminated
This commit is contained in:
@@ -222,7 +222,7 @@ export class EndorserAPIClient {
|
||||
};
|
||||
|
||||
try {
|
||||
console.log('Fetching all TimeSafari notifications for:', userConfig.activeDid);
|
||||
// Fetching all TimeSafari notifications for user
|
||||
|
||||
// Ensure authentication
|
||||
const token = await this.generateJWTForDID(userConfig.activeDid);
|
||||
@@ -297,7 +297,7 @@ export class EndorserAPIClient {
|
||||
bundle.metadata.fetchDurationMs = Date.now() - startTime;
|
||||
}
|
||||
if (bundle.metadata) {
|
||||
console.log(`✅ TimeSafari notification fetch completed in ${bundle.metadata.fetchDurationMs}ms`);
|
||||
// TimeSafari notification fetch completed
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ export class EndorserAPIClient {
|
||||
// Generate items notifications (derived from projects)
|
||||
this.generateItemNotifications(bundle, notifications);
|
||||
|
||||
console.log(`✅ Generated ${notifications.length} TimeSafari notifications`);
|
||||
// Generated TimeSafari notifications
|
||||
return notifications;
|
||||
|
||||
} catch (error) {
|
||||
@@ -488,7 +488,7 @@ export class EndorserAPIClient {
|
||||
// Check cache
|
||||
const cached = this.getCachedResponse(url);
|
||||
if (cached) {
|
||||
console.log('Returning cached response for:', requestConfig.endpoint);
|
||||
// Returning cached response
|
||||
return cached;
|
||||
}
|
||||
|
||||
@@ -536,7 +536,7 @@ export class EndorserAPIClient {
|
||||
|
||||
for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {
|
||||
try {
|
||||
console.log(`Executing request to ${endpoint} (attempt ${attempt + 1})`);
|
||||
// Executing request attempt
|
||||
|
||||
const response = await fetch(url, options);
|
||||
|
||||
@@ -590,7 +590,7 @@ export class EndorserAPIClient {
|
||||
|
||||
// Wait before retry with exponential backoff
|
||||
const waitTime = Math.min(1000 * Math.pow(2, attempt), 5000);
|
||||
console.log(`Request failed, retrying in ${waitTime}ms...`);
|
||||
// Request failed, retrying
|
||||
await new Promise(resolve => setTimeout(resolve, waitTime));
|
||||
}
|
||||
}
|
||||
@@ -606,7 +606,7 @@ export class EndorserAPIClient {
|
||||
if (lastRequest) {
|
||||
const timeSinceLastRequest = Date.now() - lastRequest;
|
||||
if (timeSinceLastRequest < 1000) { // 1 second between requests
|
||||
console.log(`Rate limiting ${endpoint}, waiting...`);
|
||||
// Rate limiting detected, waiting
|
||||
throw new Error('Rate limited');
|
||||
}
|
||||
}
|
||||
@@ -638,7 +638,7 @@ export class EndorserAPIClient {
|
||||
*/
|
||||
clearCache(): void {
|
||||
this.requestCache.clear();
|
||||
console.log('EndorserAPI cache cleared');
|
||||
// EndorserAPI cache cleared
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,18 +137,18 @@ class SecureElementStorage implements CredentialStorage {
|
||||
|
||||
private async writeToSecureElement(key: string, _data: string): Promise<void> {
|
||||
// Mock secure element write - in production would use platform APIs
|
||||
console.log(`Mock secure element write: ${key}`);
|
||||
// Mock secure element write operation
|
||||
}
|
||||
|
||||
private async readFromSecureElement(key: string): Promise<string | null> {
|
||||
// Mock secure element read - in production would use platform APIs
|
||||
console.log(`Mock secure element read: ${key}`);
|
||||
// Mock secure element read operation
|
||||
return `{"did":"${key}", "keyType":"secp256k1", "timestamp":${Date.now()}, "encrypted":true}`;
|
||||
}
|
||||
|
||||
private async deleteFromSecureElement(key: string): Promise<void> {
|
||||
// Mock secure element delete - in production would use platform APIs
|
||||
console.log(`Mock secure element delete: ${key}`);
|
||||
// Mock secure element delete operation
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ export class SecurityManager {
|
||||
*/
|
||||
async initialize(activeDid: string): Promise<boolean> {
|
||||
try {
|
||||
console.log('Initializing SecurityManager for DID:', activeDid);
|
||||
// Initializing SecurityManager for DID
|
||||
|
||||
this.activeDid = activeDid;
|
||||
|
||||
@@ -180,7 +180,7 @@ export class SecurityManager {
|
||||
this.activeCredentials = await this.credentialStorage.retrieveCredentials(activeDid);
|
||||
|
||||
if (!this.activeCredentials) {
|
||||
console.log('No stored credentials found, initializing new ones');
|
||||
// No stored credentials found, initializing new ones
|
||||
const newCredentials = await this.generateNewCredentials(activeDid);
|
||||
|
||||
if (newCredentials) {
|
||||
@@ -189,7 +189,7 @@ export class SecurityManager {
|
||||
}
|
||||
}
|
||||
|
||||
console.log('SecurityManager initialized successfully');
|
||||
// SecurityManager initialized successfully
|
||||
return true;
|
||||
|
||||
} catch (error) {
|
||||
@@ -203,7 +203,7 @@ export class SecurityManager {
|
||||
*/
|
||||
async generateNewCredentials(did: string): Promise<DIDCredentials | null> {
|
||||
try {
|
||||
console.log('Generating new credentials for DID:', did);
|
||||
// Generating new credentials for DID
|
||||
|
||||
const credentials: DIDCredentials = {
|
||||
did,
|
||||
@@ -254,7 +254,7 @@ export class SecurityManager {
|
||||
publicKey: `mock_public_key_${keyType}_${timestamp}`
|
||||
};
|
||||
|
||||
console.log(`Generated ${keyType} keys for secure operations`);
|
||||
// Generated keys for secure operations
|
||||
return mockKeys;
|
||||
|
||||
} catch (error) {
|
||||
@@ -272,7 +272,7 @@ export class SecurityManager {
|
||||
throw new Error('No active DID or credentials available');
|
||||
}
|
||||
|
||||
console.log('Generating JWT for DID:', this.activeDid);
|
||||
// Generating JWT for DID
|
||||
|
||||
const now = Math.floor(Date.now() / 1000);
|
||||
const fullClaims: JWTClaims = {
|
||||
@@ -304,7 +304,7 @@ export class SecurityManager {
|
||||
operation: 'generate_jwt'
|
||||
});
|
||||
|
||||
console.log('JWT generated successfully');
|
||||
// JWT generated successfully
|
||||
return jwt;
|
||||
|
||||
} catch (error) {
|
||||
@@ -340,7 +340,7 @@ export class SecurityManager {
|
||||
|
||||
const jwt = `${encodedHeader}.${encodedPayload}.${signature}`;
|
||||
|
||||
console.log(`Generated signed JWT with ${this.config.signatureAlgorithm}`);
|
||||
// Generated signed JWT
|
||||
return jwt;
|
||||
|
||||
} catch (error) {
|
||||
@@ -364,7 +364,7 @@ export class SecurityManager {
|
||||
|
||||
const jwt = `${encodedHeader}.${encodedPayload}.`;
|
||||
|
||||
console.log('Generated unsigned JWT (development mode)');
|
||||
// Generated unsigned JWT (development mode)
|
||||
return jwt;
|
||||
|
||||
} catch (error) {
|
||||
@@ -378,7 +378,7 @@ export class SecurityManager {
|
||||
*/
|
||||
async verifyJWT(token: string): Promise<JWTClaims | null> {
|
||||
try {
|
||||
console.log('Verifying JWT token');
|
||||
// Verifying JWT token
|
||||
|
||||
const parts = token.split('.');
|
||||
if (parts.length !== 3) {
|
||||
@@ -409,7 +409,7 @@ export class SecurityManager {
|
||||
operation: 'verify_jwt'
|
||||
});
|
||||
|
||||
console.log('JWT verified successfully');
|
||||
// JWT verified successfully
|
||||
return claims;
|
||||
|
||||
} catch (error) {
|
||||
@@ -489,7 +489,7 @@ export class SecurityManager {
|
||||
// Clear operation history
|
||||
this.operationHistory = [];
|
||||
|
||||
console.log('SecurityManager reset completed');
|
||||
// SecurityManager reset completed
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error resetting SecurityManager:', error);
|
||||
@@ -501,13 +501,13 @@ export class SecurityManager {
|
||||
*/
|
||||
async updateActiveDid(newActiveDid: string): Promise<boolean> {
|
||||
try {
|
||||
console.log('Updating active DID to:', newActiveDid);
|
||||
// Updating active DID
|
||||
|
||||
// Retrieve credentials for new DID
|
||||
const credentials = await this.credentialStorage.retrieveCredentials(newActiveDid);
|
||||
|
||||
if (!credentials) {
|
||||
console.log('No credentials found for new DID, generating new ones');
|
||||
// No credentials found for new DID, generating new ones
|
||||
const newCredentials = await this.generateNewCredentials(newActiveDid);
|
||||
|
||||
if (newCredentials) {
|
||||
@@ -522,7 +522,7 @@ export class SecurityManager {
|
||||
|
||||
this.activeDid = newActiveDid;
|
||||
|
||||
console.log('Active DID updated successfully');
|
||||
// Active DID updated successfully
|
||||
return true;
|
||||
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user