Skip to content

Commit

Permalink
refactor: use type imports
Browse files Browse the repository at this point in the history
  • Loading branch information
cpvalente committed Jan 24, 2025
1 parent 960f032 commit b4caec0
Show file tree
Hide file tree
Showing 25 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion apps/server/src/adapters/OscAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/adapters/WebsocketAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/api-data/db/db.middleware.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/api-data/db/db.validation.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/api-data/excel/excel.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/api-data/excel/excel.middleware.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/api-data/excel/excel.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/api-data/excel/excel.validation.ts
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/api-data/rundown/rundown.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/api-data/rundown/rundown.validation.ts
Original file line number Diff line number Diff line change
@@ -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']),
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/api-data/settings/settings.validation.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/services/__tests__/timerUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/services/runtime-service/RuntimeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/services/sheet-service/SheetService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/services/sheet-service/sheetUtils.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/services/timerUtils.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/stores/__mocks__/runtimeState.mocks.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/stores/__tests__/runtimeState.test.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/stores/runtimeState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/utils/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/utils/oscArgParser.ts
Original file line number Diff line number Diff line change
@@ -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[] {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/utils/routerUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Response } from 'express';
import type { Response } from 'express';

import { isEmptyObject } from './parserUtils.js';

Expand Down

0 comments on commit b4caec0

Please sign in to comment.