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