chore: fix lint errors — noBannedTypes, import ordering, formatting
Deploy FileDrop / deploy (push) Successful in 42s
Deploy FileDrop / deploy (push) Successful in 42s
- Replace unsafe 'Function' type in test with ITelegramService interface - Biome auto-fix formatting and import sorting across 8 files Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -205,11 +205,14 @@ export class BotPool implements ITelegramService {
|
|||||||
|
|
||||||
if (attempt <= MAX_TRANSIENT_RETRIES && isTransientError(error)) {
|
if (attempt <= MAX_TRANSIENT_RETRIES && isTransientError(error)) {
|
||||||
const backoffMs = Math.min(1000 * 2 ** attempt, 10_000);
|
const backoffMs = Math.min(1000 * 2 ** attempt, 10_000);
|
||||||
logger.warn(`Transient error forwarding file, retrying (${attempt}/${MAX_TRANSIENT_RETRIES})`, {
|
logger.warn(
|
||||||
|
`Transient error forwarding file, retrying (${attempt}/${MAX_TRANSIENT_RETRIES})`,
|
||||||
|
{
|
||||||
fileName,
|
fileName,
|
||||||
error: errorStr,
|
error: errorStr,
|
||||||
backoffMs,
|
backoffMs,
|
||||||
});
|
},
|
||||||
|
);
|
||||||
await sleep(backoffMs);
|
await sleep(backoffMs);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { createReadStream } from 'node:fs';
|
import { createReadStream } from 'node:fs';
|
||||||
import { nanoid } from 'nanoid';
|
import { nanoid } from 'nanoid';
|
||||||
|
import type { TelegramFileInfo } from '../../../domain/ports/telegram-service';
|
||||||
import { fileInfoCache } from '../../../infrastructure/cache/index';
|
import { fileInfoCache } from '../../../infrastructure/cache/index';
|
||||||
|
import { botPool } from '../../../infrastructure/telegram/bot-pool';
|
||||||
import logger from '../../../shared/logger/index';
|
import logger from '../../../shared/logger/index';
|
||||||
import { cleanupTempFile, formatCreatedAt, getErrorMessage } from '../../../shared/utils/file';
|
import { cleanupTempFile, formatCreatedAt, getErrorMessage } from '../../../shared/utils/file';
|
||||||
import { createChunkedObjectResponse } from '../../../utils/chunked-storage';
|
import { createChunkedObjectResponse } from '../../../utils/chunked-storage';
|
||||||
import { botPool } from '../../../infrastructure/telegram/bot-pool';
|
|
||||||
import type { TelegramFileInfo } from '../../../domain/ports/telegram-service';
|
|
||||||
import { locateZipEntry } from '../../../utils/zip';
|
import { locateZipEntry } from '../../../utils/zip';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
listMultipartUploadsByBucket,
|
listMultipartUploadsByBucket,
|
||||||
} from '../../../db/multipart';
|
} from '../../../db/multipart';
|
||||||
import type { File } from '../../../db/schema';
|
import type { File } from '../../../db/schema';
|
||||||
|
import { botPool } from '../../../infrastructure/telegram/bot-pool';
|
||||||
import logger from '../../../shared/logger/index';
|
import logger from '../../../shared/logger/index';
|
||||||
import { cleanupTempFile, ensureExtension, getErrorMessage } from '../../../shared/utils/file';
|
import { cleanupTempFile, ensureExtension, getErrorMessage } from '../../../shared/utils/file';
|
||||||
import {
|
import {
|
||||||
@@ -43,7 +44,6 @@ import {
|
|||||||
parseDeleteObjectsBody,
|
parseDeleteObjectsBody,
|
||||||
s3ErrorResponse,
|
s3ErrorResponse,
|
||||||
} from '../../../utils/s3/xml';
|
} from '../../../utils/s3/xml';
|
||||||
import { botPool } from '../../../infrastructure/telegram/bot-pool';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default S3 region returned when no region is explicitly configured.
|
* The default S3 region returned when no region is explicitly configured.
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ import {
|
|||||||
listObjectsByPrefix,
|
listObjectsByPrefix,
|
||||||
softDeleteFile,
|
softDeleteFile,
|
||||||
} from '../../../db/files-ext';
|
} from '../../../db/files-ext';
|
||||||
|
import { botPool } from '../../../infrastructure/telegram/bot-pool';
|
||||||
import logger from '../../../shared/logger/index';
|
import logger from '../../../shared/logger/index';
|
||||||
import { cleanupTempFile, ensureExtension, getErrorMessage } from '../../../shared/utils/file';
|
import { cleanupTempFile, ensureExtension, getErrorMessage } from '../../../shared/utils/file';
|
||||||
import {
|
import {
|
||||||
createChunkedObjectResponse,
|
createChunkedObjectResponse,
|
||||||
storeFileInTelegramChunks,
|
storeFileInTelegramChunks,
|
||||||
} from '../../../utils/chunked-storage';
|
} from '../../../utils/chunked-storage';
|
||||||
import { botPool } from '../../../infrastructure/telegram/bot-pool';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Route parameters extracted from the URL path.
|
* Route parameters extracted from the URL path.
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import { db, files as fileSchema } from '../db';
|
|||||||
import { insertFileParts, listFileParts, type NewFilePartInput } from '../db/file-parts';
|
import { insertFileParts, listFileParts, type NewFilePartInput } from '../db/file-parts';
|
||||||
import type { File } from '../db/schema';
|
import type { File } from '../db/schema';
|
||||||
import { config } from '../env';
|
import { config } from '../env';
|
||||||
|
import { botPool } from '../infrastructure/telegram/bot-pool';
|
||||||
import { computeHash } from './file';
|
import { computeHash } from './file';
|
||||||
import { createGetObjectResponse, type ObjectPartSource } from './s3/object-stream';
|
import { createGetObjectResponse, type ObjectPartSource } from './s3/object-stream';
|
||||||
import type { RangeParseResult } from './s3/range';
|
import type { RangeParseResult } from './s3/range';
|
||||||
import { botPool } from '../infrastructure/telegram/bot-pool';
|
|
||||||
|
|
||||||
export type ChunkCompressionAlgorithm = 'gzip' | null;
|
export type ChunkCompressionAlgorithm = 'gzip' | null;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import { nanoid } from 'nanoid';
|
|||||||
import { db, files as fileSchema } from '../db';
|
import { db, files as fileSchema } from '../db';
|
||||||
import type { NewFile } from '../db/schema';
|
import type { NewFile } from '../db/schema';
|
||||||
import { config } from '../env';
|
import { config } from '../env';
|
||||||
import { cleanupTempFile } from './file';
|
|
||||||
import { botPool } from '../infrastructure/telegram/bot-pool';
|
import { botPool } from '../infrastructure/telegram/bot-pool';
|
||||||
|
import { cleanupTempFile } from './file';
|
||||||
import { createZip, type ZipEntry } from './zip';
|
import { createZip, type ZipEntry } from './zip';
|
||||||
|
|
||||||
export type PreparedUpload = {
|
export type PreparedUpload = {
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ setEnv('SESSION_COOKIE_NAME', 'route_session');
|
|||||||
setEnv('SESSION_COOKIE_MAX_AGE_SECONDS', '3600');
|
setEnv('SESSION_COOKIE_MAX_AGE_SECONDS', '3600');
|
||||||
|
|
||||||
const { createSessionCookie } = await import('../src/utils/auth');
|
const { createSessionCookie } = await import('../src/utils/auth');
|
||||||
const { handleLogin, handleLogout, handleMe } = await import('../src/interfaces/http/controllers/auth-controller');
|
const { handleLogin, handleLogout, handleMe } = await import(
|
||||||
|
'../src/interfaces/http/controllers/auth-controller'
|
||||||
|
);
|
||||||
|
|
||||||
const jsonBody = async <T>(res: Response): Promise<T> => (await res.json()) as T;
|
const jsonBody = async <T>(res: Response): Promise<T> => (await res.json()) as T;
|
||||||
|
|
||||||
|
|||||||
@@ -230,7 +230,6 @@ describe('S3 API (production, SigV4)', () => {
|
|||||||
console.info('ℹ️ S3_SKIP: S3_SECRET_KEY not set — skipping S3 tests');
|
console.info('ℹ️ S3_SKIP: S3_SECRET_KEY not set — skipping S3 tests');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
const bucketName = `e2e-s3-${TS}`;
|
const bucketName = `e2e-s3-${TS}`;
|
||||||
|
|
||||||
it('ListBuckets (GET /)', async () => {
|
it('ListBuckets (GET /)', async () => {
|
||||||
@@ -471,7 +470,8 @@ describe('S3 API (production, SigV4)', () => {
|
|||||||
Authorization:
|
Authorization:
|
||||||
'AWS4-HMAC-SHA256 Credential=fake/20260701/us-east-1/s3/aws4_request, SignedHeaders=host, Signature=00',
|
'AWS4-HMAC-SHA256 Credential=fake/20260701/us-east-1/s3/aws4_request, SignedHeaders=host, Signature=00',
|
||||||
'x-amz-date': '20260701T000000Z',
|
'x-amz-date': '20260701T000000Z',
|
||||||
'x-amz-content-sha256': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
'x-amz-content-sha256':
|
||||||
|
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
expect(r.status).toBe(403);
|
expect(r.status).toBe(403);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, mock, spyOn } from 'bun:test';
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, mock, spyOn } from 'bun:test';
|
||||||
|
import type { ITelegramService } from '../src/domain/ports/telegram-service';
|
||||||
import { config } from '../src/env';
|
import { config } from '../src/env';
|
||||||
import logger from '../src/utils/logger';
|
import logger from '../src/utils/logger';
|
||||||
|
|
||||||
@@ -65,7 +66,7 @@ const infoSpy = spyOn(logger, 'info');
|
|||||||
const errorSpy = spyOn(logger, 'error');
|
const errorSpy = spyOn(logger, 'error');
|
||||||
|
|
||||||
describe('Telegram API Utilities', () => {
|
describe('Telegram API Utilities', () => {
|
||||||
let botPool: { forwardToStorage: Function; getFileInfo: Function; enqueueUpload: Function };
|
let botPool: ITelegramService;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
infoSpy.mockClear();
|
infoSpy.mockClear();
|
||||||
|
|||||||
Reference in New Issue
Block a user