chore: fixed unused types (#824)

This commit is contained in:
Nico 2026-04-22 22:04:46 +02:00 committed by GitHub
parent 04973849a0
commit e2c9ef0518
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 20 additions and 68 deletions

View file

@ -34,10 +34,8 @@ const invalidatingEvents = new Set<ServerEventType>([
"doctor:cancelled",
]);
export type RestoreEvent = ServerEventsPayloadMap["restore:started"] | ServerEventsPayloadMap["restore:completed"];
export type RestoreProgressEvent = ServerEventsPayloadMap["restore:progress"];
export type RestoreCompletedEvent = ServerEventsPayloadMap["restore:completed"];
export type BackupProgressEvent = ServerEventsPayloadMap["backup:progress"];
const sharedState: SharedServerEventsState = {
eventSource: null,

View file

@ -1,6 +1,5 @@
import { LOGIN_ERROR_CODES, type LoginErrorCode } from "~/lib/sso-errors";
export type { LoginErrorCode } from "~/lib/sso-errors";
export { getLoginErrorDescription } from "~/lib/sso-errors";
const VALID_ERROR_CODES = new Set<LoginErrorCode>(LOGIN_ERROR_CODES);

View file

@ -1,4 +1,4 @@
export type CronFormValues = {
type CronFormValues = {
frequency: string;
dailyTime?: string;
weeklyDay?: string;

View file

@ -1,7 +1,7 @@
import type { Config } from "~/client/api-client/client";
import { createClient, createConfig } from "~/client/api-client/client";
export type RequestClient = ReturnType<typeof createClient>;
type RequestClient = ReturnType<typeof createClient>;
type RequestClientStore = {
getStore: () => RequestClient | undefined;

View file

@ -67,14 +67,7 @@ const serverRestoreCompletedEventSchema = organizationScopedSchema.extend(restor
const serverDumpStartedEventSchema = organizationScopedSchema.extend(dumpStartedEventSchema.shape);
export type BackupEventStatusDto = z.infer<typeof backupEventStatusSchema>;
export type BackupStartedEventDto = z.infer<typeof backupStartedEventSchema>;
export type BackupProgressEventDto = z.infer<typeof backupProgressEventSchema>;
export type BackupCompletedEventDto = z.infer<typeof backupCompletedEventSchema>;
export type RestoreStartedEventDto = z.infer<typeof restoreStartedEventSchema>;
export type RestoreProgressEventDto = z.infer<typeof restoreProgressEventSchema>;
export type RestoreCompletedEventDto = z.infer<typeof restoreCompletedEventSchema>;
export type DumpStartedEventDto = z.infer<typeof dumpStartedEventSchema>;
export type ServerBackupStartedEventDto = z.infer<typeof serverBackupStartedEventSchema>;
export type ServerBackupProgressEventDto = z.infer<typeof serverBackupProgressEventSchema>;
export type ServerBackupCompletedEventDto = z.infer<typeof serverBackupCompletedEventSchema>;

View file

@ -2,7 +2,7 @@ import * as fs from "node:fs/promises";
import { RCLONE_CONFIG_DIR, RCLONE_CONFIG_FILE } from "./constants";
import { logger } from "@zerobyte/core/node";
export type SystemCapabilities = {
type SystemCapabilities = {
rclone: boolean;
sysAdmin: boolean;
};

View file

@ -1,7 +1,6 @@
import { EventEmitter } from "node:events";
import type { TypedEmitter } from "tiny-typed-emitter";
import type { ServerEventHandlers } from "~/schemas/server-events";
export type { ServerEventHandlers, ServerEventPayloadMap } from "~/schemas/server-events";
/**
* Global event emitter for server-side events

View file

@ -1,8 +1,8 @@
import { logger } from "@zerobyte/core/node";
export type LockType = "shared" | "exclusive";
type LockType = "shared" | "exclusive";
export interface LockRequest {
interface LockRequest {
repositoryId: string;
type: LockType;
operation: string;

View file

@ -1,6 +1,6 @@
import { AsyncLocalStorage } from "node:async_hooks";
export type RequestContext = {
type RequestContext = {
organizationId: string;
userId?: string;
};

View file

@ -11,7 +11,7 @@ export type { ProcessWithAgentRuntime } from "./helpers/runtime-state.dev";
const productionRuntimeState = createAgentRuntimeState();
export type AgentRunBackupRequest = {
type AgentRunBackupRequest = {
scheduleId: number;
payload: BackupRunPayload;
signal: AbortSignal;

View file

@ -21,8 +21,6 @@ type BackupExecutionRequest = {
onProgress: (progress: BackupExecutionProgress) => void;
};
export type { BackupExecutionResult } from "../agents/agents-manager";
const activeControllersByScheduleId = new Map<number, AbortController>();
const createBackupRunPayload = async ({

View file

@ -14,8 +14,6 @@ const retentionPolicySchema = z.object({
keepWithinDuration: z.string().optional(),
});
export type RetentionPolicy = z.infer<typeof retentionPolicySchema>;
const backupScheduleSchema = z.object({
id: z.number(),
shortId: z.string(),
@ -54,8 +52,6 @@ const scheduleMirrorSchema = z.object({
repository: repositorySchema,
});
export type ScheduleMirrorDto = z.infer<typeof scheduleMirrorSchema>;
export const listBackupSchedulesResponse = backupScheduleSchema.array();
export type ListBackupSchedulesResponseDto = z.infer<typeof listBackupSchedulesResponse>;
@ -376,8 +372,6 @@ export const reorderBackupSchedulesBody = z.object({
scheduleShortIds: z.array(z.string()),
});
export type ReorderBackupSchedulesBody = z.infer<typeof reorderBackupSchedulesBody>;
const reorderBackupSchedulesResponse = z.object({
success: z.boolean(),
});
@ -433,8 +427,6 @@ export const syncMirrorBody = z.object({
snapshotIds: z.array(z.string()).optional(),
});
export type SyncMirrorBody = z.infer<typeof syncMirrorBody>;
const syncMirrorResponse = z.object({
success: z.boolean(),
});

View file

@ -2,8 +2,8 @@ import { and, eq } from "drizzle-orm";
import { db } from "../../db/db";
import { backupSchedulesTable, backupScheduleMirrorsTable } from "../../db/schema";
export type BackupStatusType = "in_progress" | "success" | "warning" | "error";
export type MirrorStatusType = "in_progress" | "success" | "error";
type BackupStatusType = "in_progress" | "success" | "warning" | "error";
type MirrorStatusType = "in_progress" | "success" | "error";
type MirrorStatusUpdate = {
lastCopyAt?: number | null;

View file

@ -15,7 +15,7 @@ import { repositoriesService } from "../../repositories/repositories.service";
import { volumeService } from "../../volumes/volume.service";
import { copyToMirrors, runForget } from "./backup-maintenance";
export interface BackupContext {
interface BackupContext {
schedule: BackupSchedule;
volume: Volume;
repository: Repository;
@ -38,7 +38,7 @@ type ValidationSkipped = {
reason: string;
};
export type ValidationResult = ValidationSuccess | ValidationFailure | ValidationSkipped;
type ValidationResult = ValidationSuccess | ValidationFailure | ValidationSkipped;
export function getBackupProgress(scheduleId: number): BackupProgressEventDto | undefined {
return cache.get<BackupProgressEventDto>(cacheKeys.backup.progress(scheduleId));

View file

@ -12,8 +12,6 @@ const notificationDestinationSchema = z.object({
updatedAt: z.number(),
});
export type NotificationDestinationDto = z.infer<typeof notificationDestinationSchema>;
const listDestinationsResponse = notificationDestinationSchema.array();
export type ListDestinationsDto = z.infer<typeof listDestinationsResponse>;
@ -172,8 +170,6 @@ const scheduleNotificationAssignmentSchema = z.object({
destination: notificationDestinationSchema,
});
export type ScheduleNotificationAssignmentDto = z.infer<typeof scheduleNotificationAssignmentSchema>;
const getScheduleNotificationsResponse = scheduleNotificationAssignmentSchema.array();
export type GetScheduleNotificationsDto = z.infer<typeof getScheduleNotificationsResponse>;

View file

@ -27,8 +27,6 @@ export const repositorySchema = z.object({
updatedAt: z.number(),
});
export type RepositoryDto = z.infer<typeof repositorySchema>;
const listRepositoriesResponse = repositorySchema.array();
export type ListRepositoriesDto = z.infer<typeof listRepositoriesResponse>;
@ -54,8 +52,6 @@ export const createRepositoryBody = z.object({
config: repositoryConfigSchema,
});
export type CreateRepositoryBody = z.infer<typeof createRepositoryBody>;
const createRepositoryResponse = z.object({
message: z.string(),
repository: z.object({
@ -65,8 +61,6 @@ const createRepositoryResponse = z.object({
}),
});
export type CreateRepositoryDto = z.infer<typeof createRepositoryResponse>;
export const createRepositoryDto = describeRoute({
description: "Create a new restic repository",
operationId: "createRepository",
@ -352,8 +346,6 @@ export const restoreSnapshotBody = z.object({
overwrite: overwriteModeSchema.optional(),
});
export type RestoreSnapshotBody = z.infer<typeof restoreSnapshotBody>;
const restoreSnapshotResponse = z.object({
success: z.boolean(),
message: z.string(),
@ -559,8 +551,6 @@ export const devPanelExecBody = z.object({
args: z.array(z.string()).optional(),
});
export type DevPanelExecBody = z.infer<typeof devPanelExecBody>;
export const devPanelExecDto = describeRoute({
description: "Execute a restic command against a repository (dev panel only)",
tags: ["Repositories"],

View file

@ -17,8 +17,6 @@ export const volumeSchema = z.object({
autoRemount: z.boolean(),
});
export type VolumeDto = z.infer<typeof volumeSchema>;
const listVolumesResponse = volumeSchema.array();
export type ListVolumesDto = z.infer<typeof listVolumesResponse>;
@ -65,7 +63,6 @@ export const createVolumeDto = describeRoute({
const deleteVolumeResponse = z.object({
message: z.string(),
});
export type DeleteVolumeDto = z.infer<typeof deleteVolumeResponse>;
export const deleteVolumeDto = describeRoute({
description: "Delete a volume",
@ -153,7 +150,6 @@ const testConnectionResponse = z.object({
success: z.boolean(),
message: z.string(),
});
export type TestConnectionDto = z.infer<typeof testConnectionResponse>;
export const testConnectionDto = describeRoute({
description: "Test connection to backend",
@ -175,7 +171,6 @@ const mountVolumeResponse = z.object({
error: z.string().optional(),
status: z.enum(BACKEND_STATUS),
});
export type MountVolumeDto = z.infer<typeof mountVolumeResponse>;
export const mountVolumeDto = describeRoute({
description: "Mount a volume",
@ -197,7 +192,6 @@ const unmountVolumeResponse = z.object({
error: z.string().optional(),
status: z.enum(BACKEND_STATUS),
});
export type UnmountVolumeDto = z.infer<typeof unmountVolumeResponse>;
export const unmountVolumeDto = describeRoute({
description: "Unmount a volume",
@ -219,7 +213,6 @@ const healthCheckResponse = z.object({
error: z.string().optional(),
status: z.enum(BACKEND_STATUS),
});
export type HealthCheckDto = z.infer<typeof healthCheckResponse>;
export const healthCheckDto = describeRoute({
description: "Perform a health check on a volume",

View file

@ -89,7 +89,7 @@ const hasCompatibleCredentials = async (config1: RepositoryConfig, config2: Repo
}
};
export interface CompatibilityResult {
interface CompatibilityResult {
repositoryId: string;
compatible: boolean;
reason: string | null;

View file

@ -1,6 +1,6 @@
declare const brand: unique symbol;
export type Branded<T, B> = T & { [brand]: B };
type Branded<T, B> = T & { [brand]: B };
export type ShortId = Branded<string, "ShortId">;

View file

@ -5,7 +5,7 @@ import { DATABASE_URL } from "../core/constants";
const ONE_DAY_IN_SECONDS = 60 * 60 * 24;
export interface CacheOptions {
interface CacheOptions {
dbPath?: string;
}

View file

@ -2,7 +2,7 @@ import { safeExec } from "@zerobyte/core/node";
import { logger } from "@zerobyte/core/node";
import { toMessage } from "./errors";
export interface SendNotificationParams {
interface SendNotificationParams {
shoutrrrUrl: string;
title: string;
body: string;

View file

@ -1,7 +1,7 @@
const SI_UNITS = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] as const;
const IEC_UNITS = ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"] as const;
export type FormatBytesResult = {
type FormatBytesResult = {
text: string;
unit: string;
unitIndex: number;
@ -17,13 +17,7 @@ export type FormatBytesOptions = {
};
export function formatBytes(bytes: number, options?: FormatBytesOptions): FormatBytesResult {
const {
base = 1000,
maximumFractionDigits = 2,
smartRounding = true,
locale,
fallback = "—",
} = options ?? {};
const { base = 1000, maximumFractionDigits = 2, smartRounding = true, locale, fallback = "—" } = options ?? {};
if (!Number.isFinite(bytes)) {
return {

View file

@ -4,7 +4,7 @@ export const FILE_MODES = {
ownerReadWrite: 0o600,
} as const;
export type FileMode = (typeof FILE_MODES)[keyof typeof FILE_MODES];
type FileMode = (typeof FILE_MODES)[keyof typeof FILE_MODES];
export const writeFileWithMode = async (filePath: string, data: string, mode: FileMode) => {
await fs.writeFile(filePath, data, { mode });

View file

@ -34,7 +34,7 @@ export const safeExec = async ({ command, args = [], env = {}, ...rest }: ExecPr
}
};
export interface SafeSpawnParamsBase {
interface SafeSpawnParamsBase {
command: string;
args: string[];
env?: NodeJS.ProcessEnv;

View file

@ -38,7 +38,7 @@ const lsSnapshotInfoSchema = z.object({
type LsNode = z.infer<typeof lsNodeSchema>;
type LsSnapshotInfo = z.infer<typeof lsSnapshotInfoSchema>;
export type ResticLsResult = {
type ResticLsResult = {
snapshot: LsSnapshotInfo | null;
nodes: LsNode[];
pagination: {