Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/loggingDatabaseOperations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class LoggingDatabaseOperations implements DatabaseOperations {
return this.wrapped.engineKind;
}

private sanitizeValue(value: any): string {
private sanitizeValue(value: unknown): string {
if (value === null) return 'null';
if (value === undefined) return 'undefined';
if (typeof value === 'string') {
Expand All @@ -42,8 +42,13 @@ export class LoggingDatabaseOperations implements DatabaseOperations {
}
return `"${value}"`;
}
if (value instanceof Uint8Array || (typeof value === 'object' && value && 'buffer' in value)) {
return `[BLOB ${value.byteLength} bytes]`;
if (value instanceof Uint8Array || (typeof value === 'object' && value !== null && 'buffer' in value)) {
const byteLength = value instanceof Uint8Array
? value.byteLength
: ('byteLength' in value && typeof (value as { byteLength: unknown }).byteLength === 'number'
? (value as { byteLength: number }).byteLength
: 0);
return `[BLOB ${byteLength} bytes]`;
}
if (typeof value === 'object') {
try {
Expand Down