refactor: use type imports

This commit is contained in:
Carlos Valente
2025-01-24 17:03:34 +01:00
committed by Carlos Valente
parent 960f0322ad
commit b4caec0644
25 changed files with 28 additions and 28 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ import { LogOrigin } from 'ontime-types';
import { fromBuffer } from 'osc-min';
import * as dgram from 'node:dgram';
import { IAdapter } from './IAdapter.js';
import type { IAdapter } from './IAdapter.js';
import { logger } from '../classes/Logger.js';
import { integrationPayloadFromPath } from './utils/parse.js';
import { dispatchFromAdapter } from '../api-integration/integration.controller.js';
+1 -1
View File
@@ -20,7 +20,7 @@ import { WebSocket, WebSocketServer } from 'ws';
import type { Server } from 'http';
import getRandomName from '../utils/getRandomName.js';
import { IAdapter } from './IAdapter.js';
import type { IAdapter } from './IAdapter.js';
import { eventStore } from '../stores/EventStore.js';
import { logger } from '../classes/Logger.js';
import { dispatchFromAdapter } from '../api-integration/integration.controller.js';
@@ -7,7 +7,7 @@ import {
timerLifecycleValues,
} from 'ontime-types';
import { Request, Response, NextFunction } from 'express';
import type { Request, Response, NextFunction } from 'express';
import { body, oneOf, param, validationResult } from 'express-validator';
import * as assert from '../../utils/assert.js';
@@ -1,6 +1,6 @@
import { isAlphanumericWithSpace } from 'ontime-utils';
import { Request, Response, NextFunction } from 'express';
import type { Request, Response, NextFunction } from 'express';
import { body, param, validationResult } from 'express-validator';
export const validateCustomField = [
+2 -2
View File
@@ -1,5 +1,5 @@
import { Request } from 'express';
import multer, { FileFilterCallback } from 'multer';
import type { Request } from 'express';
import multer, { type FileFilterCallback } from 'multer';
import { JSON_MIME } from '../../utils/parser.js';
import { storage } from '../../utils/upload.js';
+2 -2
View File
@@ -1,7 +1,7 @@
import { Request, Response, NextFunction } from 'express';
import type { Request, Response, NextFunction } from 'express';
import { body, param, validationResult } from 'express-validator';
import { ensureJsonExtension } from '../../utils/fileManagement.js';
import sanitize from 'sanitize-filename';
import { ensureJsonExtension } from '../../utils/fileManagement.js';
/**
* @description Validates request for a new project.
@@ -3,7 +3,7 @@
* Google Sheets
*/
import { Request, Response } from 'express';
import type { Request, Response } from 'express';
import { generateRundownPreview, listWorksheets, saveExcelFile } from './excel.service.js';
export async function postExcel(req: Request, res: Response) {
@@ -1,5 +1,5 @@
import { Request } from 'express';
import multer, { FileFilterCallback } from 'multer';
import type { Request } from 'express';
import multer, { type FileFilterCallback } from 'multer';
import { EXCEL_MIME } from '../../utils/parser.js';
import { storage } from '../../utils/upload.js';
@@ -4,7 +4,7 @@
*/
import { CustomFields, OntimeRundown } from 'ontime-types';
import { ImportMap } from 'ontime-utils';
import type { ImportMap } from 'ontime-utils';
import { extname } from 'path';
import { existsSync } from 'fs';
@@ -1,7 +1,7 @@
import { isImportMap } from 'ontime-utils';
import { body, validationResult } from 'express-validator';
import { NextFunction, Request, Response } from 'express';
import type { NextFunction, Request, Response } from 'express';
export const validateFileExists = [
(req: Request, res: Response, next: NextFunction) => {
@@ -8,7 +8,7 @@ import {
} from 'ontime-types';
import { getErrorMessage } from 'ontime-utils';
import { Request, Response } from 'express';
import type { Request, Response } from 'express';
import { failEmptyObjects } from '../../utils/routerUtils.js';
import {
@@ -1,5 +1,5 @@
import { body, param, query, validationResult } from 'express-validator';
import { Request, Response, NextFunction } from 'express';
import type { Request, Response, NextFunction } from 'express';
export const rundownPostValidator = [
body('type').isString().exists().isIn(['event', 'delay', 'block']),
@@ -1,5 +1,5 @@
import { body, validationResult } from 'express-validator';
import { Request, Response, NextFunction } from 'express';
import type { Request, Response, NextFunction } from 'express';
/**
* @description Validates object for POST /ontime/settings/welcomedialog
+1 -1
View File
@@ -2,7 +2,7 @@ import { LogOrigin, Playback, runtimeStorePlaceholder, SimpleDirection, SimplePl
import 'dotenv/config';
import express from 'express';
import http, { Server } from 'http';
import http, { type Server } from 'http';
import cors from 'cors';
import serverTiming from 'server-timing';
import cookieParser from 'cookie-parser';
@@ -9,7 +9,7 @@ import {
normaliseEndTime,
skippedOutOfEvent,
} from '../timerUtils.js';
import { RuntimeState } from '../../stores/runtimeState.js';
import type { RuntimeState } from '../../stores/runtimeState.js';
describe('getExpectedFinish()', () => {
it('is null if we havent started', () => {
@@ -22,7 +22,7 @@ import { timerConfig } from '../../config/config.js';
import { eventStore } from '../../stores/EventStore.js';
import { EventTimer } from '../EventTimer.js';
import { RestorePoint, restoreService } from '../RestoreService.js';
import { type RestorePoint, restoreService } from '../RestoreService.js';
import {
findNext,
findPrevious,
@@ -7,7 +7,7 @@
import { AuthenticationStatus, CustomFields, LogOrigin, MaybeString, OntimeRundown } from 'ontime-types';
import { ImportMap, getErrorMessage } from 'ontime-utils';
import { sheets, sheets_v4 } from '@googleapis/sheets';
import { sheets, type sheets_v4 } from '@googleapis/sheets';
import { Credentials, OAuth2Client } from 'google-auth-library';
import got from 'got';
@@ -1,7 +1,7 @@
import { isOntimeBlock, isOntimeEvent, OntimeEvent, OntimeRundownEntry } from 'ontime-types';
import { millisToString } from 'ontime-utils';
import { sheets_v4 } from '@googleapis/sheets';
import type { sheets_v4 } from '@googleapis/sheets';
import { isObject } from '../../utils/assert.js';
// we expect client secret file to contain the following keys
+1 -1
View File
@@ -1,6 +1,6 @@
import { MaybeNumber, TimerPhase } from 'ontime-types';
import { dayInMs, isPlaybackActive } from 'ontime-utils';
import { RuntimeState } from '../stores/runtimeState.js';
import type { RuntimeState } from '../stores/runtimeState.js';
/**
* handle events that span over midnight
@@ -1,6 +1,6 @@
import { TimerPhase, Playback } from 'ontime-types';
import { deepmerge } from 'ontime-utils';
import { RuntimeState } from '../runtimeState.js';
import type { RuntimeState } from '../runtimeState.js';
const baseState: RuntimeState = {
clock: 0,
@@ -1,7 +1,7 @@
import { PlayableEvent, Playback, TimerPhase } from 'ontime-types';
import { deepmerge } from 'ontime-utils';
import { RuntimeState, addTime, clear, getState, load, pause, roll, start, stop } from '../runtimeState.js';
import { type RuntimeState, addTime, clear, getState, load, pause, roll, start, stop } from '../runtimeState.js';
import { initRundown } from '../../services/rundown-service/RundownService.js';
const mockEvent = {
+1 -1
View File
@@ -21,7 +21,7 @@ import {
} from 'ontime-utils';
import { clock } from '../services/Clock.js';
import { RestorePoint } from '../services/RestoreService.js';
import type { RestorePoint } from '../services/RestoreService.js';
import {
getCurrent,
getExpectedEnd,
+1 -1
View File
@@ -2,7 +2,7 @@ import { LogOrigin } from 'ontime-types';
import type { Server } from 'http';
import { networkInterfaces } from 'os';
import { AddressInfo } from 'net';
import type { AddressInfo } from 'net';
import { isDocker, isProduction } from '../externals.js';
import { logger } from '../classes/Logger.js';
+1 -1
View File
@@ -1,4 +1,4 @@
import { Argument } from 'node-osc';
import type { Argument } from 'node-osc';
import { splitWhitespace } from 'ontime-utils';
export function stringToOSCArgs(argsString: string | undefined): Argument[] {
+1 -1
View File
@@ -1,4 +1,4 @@
import { Response } from 'express';
import type { Response } from 'express';
import { isEmptyObject } from './parserUtils.js';