diff --git a/dist/fastify.d.ts.map b/dist/fastify.d.ts.map index 0c57947..a8b7703 100644 --- a/dist/fastify.d.ts.map +++ b/dist/fastify.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"fastify.d.ts","sourceRoot":"","sources":["../src/fastify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,OAAO,IAAI;IACvC,MAAM,EAAE,CAAC,CAAC;IACV,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,qBAAa,SAAS;IACD,KAAK,EAAE,MAAM;gBAAb,KAAK,EAAE,MAAM;CACjC;AAED,8BAAsB,UAAU;IAC9B,OAAO,CAAC,aAAa,CAAgB;gBAEzB,aAAa,EAAE,aAAa;IAIxC,QAAQ,IAAI,aAAa;CAG1B;AAED,8BAAsB,WAAW,CAAC,CAAC;IACjC,OAAO,CAAC,MAAM,CAAI;gBAEN,MAAM,EAAE,CAAC;IAIrB,SAAS,IAAI,CAAC;IAId,mBAAmB,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;IAO7D,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;CAMrD"} \ No newline at end of file +{"version":3,"file":"fastify.d.ts","sourceRoot":"","sources":["../src/fastify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,OAAO,IAAI;IACxC,MAAM,EAAE,CAAC,CAAC;IACV,UAAU,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,qBAAa,SAAS;IACF,KAAK,EAAE,MAAM;gBAAb,KAAK,EAAE,MAAM;CAChC;AAED,8BAAsB,UAAU;IAC/B,OAAO,CAAC,aAAa,CAAgB;gBAEzB,aAAa,EAAE,aAAa;IAIxC,QAAQ,IAAI,aAAa;CAGzB;AAED,8BAAsB,WAAW,CAAC,CAAC;IAClC,OAAO,CAAC,MAAM,CAAI;gBAEN,MAAM,EAAE,CAAC;IAIrB,SAAS,IAAI,CAAC;IAId,mBAAmB,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;IAO7D,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;CAMpD"} \ No newline at end of file diff --git a/dist/grist.d.ts b/dist/grist.d.ts new file mode 100644 index 0000000..ac5c1ea --- /dev/null +++ b/dist/grist.d.ts @@ -0,0 +1,15 @@ +export type Record_PersonalGoals = { + went_outside: boolean; + standing: boolean; + standing_goal: number; + steps: boolean; + steps_goal: number; + pushups: boolean; + squats: boolean; + leg_raises: boolean; + reps_goal: number; + stairs: boolean; + stairs_goal: number; + is_workday: boolean; +}; +//# sourceMappingURL=grist.d.ts.map \ No newline at end of file diff --git a/dist/grist.d.ts.map b/dist/grist.d.ts.map new file mode 100644 index 0000000..60b6bfc --- /dev/null +++ b/dist/grist.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"grist.d.ts","sourceRoot":"","sources":["../src/grist.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IAClC,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACpB,CAAC"} \ No newline at end of file diff --git a/dist/grist.js b/dist/grist.js new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/dist/grist.js @@ -0,0 +1 @@ +export {}; diff --git a/dist/homepage.d.ts b/dist/homepage.d.ts index cd50940..bc500e7 100644 --- a/dist/homepage.d.ts +++ b/dist/homepage.d.ts @@ -1,5 +1,5 @@ -import { type API_HA_DeskPosition } from "./homeassistant"; -import { type TidalGetCurrent } from "./tidal"; +import type { API_HA_DeskPosition } from "./homeassistant"; +import type { TidalGetCurrent } from "./tidal"; export type FullInformation = { ha_desk_position: API_HA_DeskPosition | null; ha_temp: string | null; diff --git a/dist/homepage.d.ts.map b/dist/homepage.d.ts.map index 072180e..064706c 100644 --- a/dist/homepage.d.ts.map +++ b/dist/homepage.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"homepage.d.ts","sourceRoot":"","sources":["../src/homepage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,MAAM,eAAe,GAAG;IAC7B,gBAAgB,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC7C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,aAAa,EAAE,eAAe,GAAG,IAAI,CAAC;CACtC,CAAC"} \ No newline at end of file +{"version":3,"file":"homepage.d.ts","sourceRoot":"","sources":["../src/homepage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,MAAM,eAAe,GAAG;IAC7B,gBAAgB,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC7C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,aAAa,EAAE,eAAe,GAAG,IAAI,CAAC;CACtC,CAAC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts index cbe9110..17f8610 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -2,7 +2,7 @@ export * from "./fastify.js"; export * from "./homeassistant.js"; export * from "./homepage.js"; export * from "./logger.js"; -export * from "./ws.js"; export * from "./tidal.js"; export * from "./timehelper.js"; +export * from "./ws.js"; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map index 8e8d317..5752a0d 100644 --- a/dist/index.d.ts.map +++ b/dist/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 82163cc..c1765f1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2,6 +2,6 @@ export * from "./fastify.js"; export * from "./homeassistant.js"; export * from "./homepage.js"; export * from "./logger.js"; -export * from "./ws.js"; export * from "./tidal.js"; export * from "./timehelper.js"; +export * from "./ws.js"; diff --git a/dist/timehelper.d.ts.map b/dist/timehelper.d.ts.map index c924317..a7e8fd2 100644 --- a/dist/timehelper.d.ts.map +++ b/dist/timehelper.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"timehelper.d.ts","sourceRoot":"","sources":["../src/timehelper.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAQ;IACnB,OAAO,CAAC,KAAK,CAAqC;IAClD,OAAO,CAAC,GAAG,CAAqC;IAChD,OAAO,CAAC,QAAQ,CAAC;gBAEL,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAOjD,OAAO,CAAC,SAAS;IAKjB,QAAQ,CAAC,SAAS,GAAE,MAAmB,GAAG,OAAO;CAqBlD;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC;CAClD;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACV,WAAW,CAOb;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,cAAc,GAAE,OAAe,GAC9B,MAAM,CAmBR"} \ No newline at end of file +{"version":3,"file":"timehelper.d.ts","sourceRoot":"","sources":["../src/timehelper.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAQ;IACpB,OAAO,CAAC,KAAK,CAAqC;IAClD,OAAO,CAAC,GAAG,CAAqC;IAChD,OAAO,CAAC,QAAQ,CAAC;gBAEL,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAOjD,OAAO,CAAC,SAAS;IAKjB,QAAQ,CAAC,SAAS,GAAE,MAAmB,GAAG,OAAO;CAqBjD;AAED,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC;CACjD;AAED,wBAAgB,uBAAuB,CACtC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACT,WAAW,CAOb;AAED,wBAAgB,iBAAiB,CAChC,IAAI,EAAE,MAAM,EACZ,cAAc,GAAE,OAAe,GAC7B,MAAM,CAmBR"} \ No newline at end of file diff --git a/dist/ws.d.ts b/dist/ws.d.ts index 94048d3..eb609a9 100644 --- a/dist/ws.d.ts +++ b/dist/ws.d.ts @@ -1,4 +1,4 @@ -import { WebSocket } from "ws"; +import type { WebSocket } from "ws"; export type WsEvent = { type: string; data?: unknown; diff --git a/dist/ws.d.ts.map b/dist/ws.d.ts.map index a1ce376..a04fcbf 100644 --- a/dist/ws.d.ts.map +++ b/dist/ws.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAE/B,MAAM,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAE/D,qBAAa,SAAS;IACrB,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,SAAS,CAAgC;IAEjD,cAAc,CAAC,QAAQ,EAAE,sBAAsB,GAAG,MAAM,IAAI;IAO5D,OAAO,CAAC,gBAAgB;IAMxB,SAAS,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI;IAM9B,YAAY,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI;IAMjC,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAMjC,cAAc,IAAI,MAAM;CAGxB"} \ No newline at end of file +{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAGpC,MAAM,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAE/D,qBAAa,SAAS;IACrB,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,SAAS,CAAgC;IAEjD,cAAc,CAAC,QAAQ,EAAE,sBAAsB,GAAG,MAAM,IAAI;IAO5D,OAAO,CAAC,gBAAgB;IAMxB,SAAS,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI;IAM9B,YAAY,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI;IAMjC,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAMjC,cAAc,IAAI,MAAM;CAGxB"} \ No newline at end of file diff --git a/src/fastify.ts b/src/fastify.ts index d080e45..8ae4207 100644 --- a/src/fastify.ts +++ b/src/fastify.ts @@ -1,48 +1,48 @@ import type { AxiosInstance } from "axios"; export type ServiceResult = { - result: T; - successful: boolean; + result: T; + successful: boolean; }; export class API_Error { - constructor(public error: string) {} + constructor(public error: string) {} } export abstract class BaseClient { - private axiosInstance: AxiosInstance; + private axiosInstance: AxiosInstance; - constructor(axiosInstance: AxiosInstance) { - this.axiosInstance = axiosInstance; - } + constructor(axiosInstance: AxiosInstance) { + this.axiosInstance = axiosInstance; + } - getAxios(): AxiosInstance { - return this.axiosInstance; - } + getAxios(): AxiosInstance { + return this.axiosInstance; + } } export abstract class BaseService { - private client: T; + private client: T; - constructor(client: T) { - this.client = client; - } + constructor(client: T) { + this.client = client; + } - getClient(): T { - return this.client; - } + getClient(): T { + return this.client; + } - getSuccessfulResult(result: R): ServiceResult { - return { - result, - successful: true, - }; - } + getSuccessfulResult(result: R): ServiceResult { + return { + result, + successful: true, + }; + } - getErrorResult(error: string): ServiceResult { - return { - result: error, - successful: false, - }; - } + getErrorResult(error: string): ServiceResult { + return { + result: error, + successful: false, + }; + } } diff --git a/src/grist.ts b/src/grist.ts new file mode 100644 index 0000000..fa13dfb --- /dev/null +++ b/src/grist.ts @@ -0,0 +1,14 @@ +export type Record_PersonalGoals = { + went_outside: boolean; + standing: boolean; + standing_goal: number; + steps: boolean; + steps_goal: number; + pushups: boolean; + squats: boolean; + leg_raises: boolean; + reps_goal: number; + stairs: boolean; + stairs_goal: number; + is_workday: boolean; +}; diff --git a/src/homepage.ts b/src/homepage.ts index de5b778..cc8c6aa 100644 --- a/src/homepage.ts +++ b/src/homepage.ts @@ -1,5 +1,5 @@ -import { type API_HA_DeskPosition } from "./homeassistant"; -import { type TidalGetCurrent } from "./tidal"; +import type { API_HA_DeskPosition } from "./homeassistant"; +import type { TidalGetCurrent } from "./tidal"; export type FullInformation = { ha_desk_position: API_HA_DeskPosition | null; diff --git a/src/index.ts b/src/index.ts index 82163cc..c1765f1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,6 +2,6 @@ export * from "./fastify.js"; export * from "./homeassistant.js"; export * from "./homepage.js"; export * from "./logger.js"; -export * from "./ws.js"; export * from "./tidal.js"; export * from "./timehelper.js"; +export * from "./ws.js"; diff --git a/src/logger.ts b/src/logger.ts index f873c08..58fce27 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -2,31 +2,31 @@ import axios from "axios"; import chalk from "chalk"; export function logError(...args: unknown[]) { - console.error(chalk.red("ERROR:"), ...args); + console.error(chalk.red("ERROR:"), ...args); } export function logWarning(...args: unknown[]) { - console.warn(chalk.yellow("WARNING:"), ...args); + console.warn(chalk.yellow("WARNING:"), ...args); } export function logSuccess(...args: unknown[]) { - console.info(chalk.green("SUCCESS:"), ...args); + console.info(chalk.green("SUCCESS:"), ...args); } export function logInfo(...args: unknown[]) { - console.info(chalk.cyan("INFO:"), ...args); + console.info(chalk.cyan("INFO:"), ...args); } export function printNetworkError(error: unknown) { - if (axios.isAxiosError(error)) { - logError("Axios error details:", { - message: error.message, - status: error.response?.status, - statusText: error.response?.statusText, - data: error.response?.data, - url: error.config?.url, - }); - } else { - logError("Unexpected error:", error); - } + if (axios.isAxiosError(error)) { + logError("Axios error details:", { + message: error.message, + status: error.response?.status, + statusText: error.response?.statusText, + data: error.response?.data, + url: error.config?.url, + }); + } else { + logError("Unexpected error:", error); + } } diff --git a/src/timehelper.ts b/src/timehelper.ts index a50d625..34af7c3 100644 --- a/src/timehelper.ts +++ b/src/timehelper.ts @@ -1,80 +1,80 @@ export class TimeSpan { - private start: { hours: number; minutes: number }; - private end: { hours: number; minutes: number }; - private timeZone; + private start: { hours: number; minutes: number }; + private end: { hours: number; minutes: number }; + private timeZone; - constructor(timeSpanStr: string, timeZone: string) { - const [startStr, endStr] = timeSpanStr.split("-"); - this.start = this.parseTime(startStr); - this.end = this.parseTime(endStr); - this.timeZone = timeZone; - } + constructor(timeSpanStr: string, timeZone: string) { + const [startStr, endStr] = timeSpanStr.split("-"); + this.start = this.parseTime(startStr); + this.end = this.parseTime(endStr); + this.timeZone = timeZone; + } - private parseTime(timeStr: string) { - const [hours, minutes] = timeStr.split(":").map(Number); - return { hours, minutes }; - } + private parseTime(timeStr: string) { + const [hours, minutes] = timeStr.split(":").map(Number); + return { hours, minutes }; + } - contains(timestamp: number = Date.now()): boolean { - const date = new Date(timestamp); + contains(timestamp: number = Date.now()): boolean { + const date = new Date(timestamp); - const berlinTimeStr = date.toLocaleString("de-DE", { - timeZone: this.timeZone, // "Europe/Berlin" - hour12: false, - hour: "2-digit", - minute: "2-digit", - }); + const berlinTimeStr = date.toLocaleString("de-DE", { + timeZone: this.timeZone, // "Europe/Berlin" + hour12: false, + hour: "2-digit", + minute: "2-digit", + }); - const [hours, minutes] = berlinTimeStr.split(":").map(Number); - const currentMinutes = hours * 60 + minutes; - const startMinutes = this.start.hours * 60 + this.start.minutes; - const endMinutes = this.end.hours * 60 + this.end.minutes; + const [hours, minutes] = berlinTimeStr.split(":").map(Number); + const currentMinutes = hours * 60 + minutes; + const startMinutes = this.start.hours * 60 + this.start.minutes; + const endMinutes = this.end.hours * 60 + this.end.minutes; - if (startMinutes > endMinutes) { - return currentMinutes >= startMinutes || currentMinutes < endMinutes; - } else { - return currentMinutes >= startMinutes && currentMinutes < endMinutes; - } - } + if (startMinutes > endMinutes) { + return currentMinutes >= startMinutes || currentMinutes < endMinutes; + } else { + return currentMinutes >= startMinutes && currentMinutes < endMinutes; + } + } } export interface TimeBetween { - seconds: number; - toReadable: (roundToMinutes?: boolean) => string; + seconds: number; + toReadable: (roundToMinutes?: boolean) => string; } export function calculateSecondsBetween( - start: number, - end: number, + start: number, + end: number, ): TimeBetween { - const seconds = Math.max(60, (end - start) / 1000); - return { - seconds, - toReadable: (roundToMinutes?: boolean) => - secondsToReadable(seconds, roundToMinutes), - }; + const seconds = Math.max(60, (end - start) / 1000); + return { + seconds, + toReadable: (roundToMinutes?: boolean) => + secondsToReadable(seconds, roundToMinutes), + }; } export function secondsToReadable( - secs: number, - roundToMinutes: boolean = false, + secs: number, + roundToMinutes: boolean = false, ): string { - const totalSeconds = roundToMinutes ? Math.round(secs / 60) * 60 : secs; + const totalSeconds = roundToMinutes ? Math.round(secs / 60) * 60 : secs; - var days = Math.floor(totalSeconds / (3600 * 24)); - var hours = Math.floor((totalSeconds % (3600 * 24)) / 3600); - var minutes = Math.floor((totalSeconds % 3600) / 60); - var seconds = Math.floor(totalSeconds % 60); + var days = Math.floor(totalSeconds / (3600 * 24)); + var hours = Math.floor((totalSeconds % (3600 * 24)) / 3600); + var minutes = Math.floor((totalSeconds % 3600) / 60); + var seconds = Math.floor(totalSeconds % 60); - var dayDisplay = days > 0 ? days + (days === 1 ? " day, " : " days, ") : ""; - var hourDisplay = - hours > 0 ? hours + (hours === 1 ? " hour, " : " hours, ") : ""; - var minuteDisplay = - minutes > 0 ? minutes + (minutes === 1 ? " minute, " : " minutes, ") : ""; - var secondDisplay = - seconds > 0 ? seconds + (seconds === 1 ? " second" : " seconds") : ""; - return (dayDisplay + hourDisplay + minuteDisplay + secondDisplay).replace( - /,\s*$/, - "", - ); + var dayDisplay = days > 0 ? days + (days === 1 ? " day, " : " days, ") : ""; + var hourDisplay = + hours > 0 ? hours + (hours === 1 ? " hour, " : " hours, ") : ""; + var minuteDisplay = + minutes > 0 ? minutes + (minutes === 1 ? " minute, " : " minutes, ") : ""; + var secondDisplay = + seconds > 0 ? seconds + (seconds === 1 ? " second" : " seconds") : ""; + return (dayDisplay + hourDisplay + minuteDisplay + secondDisplay).replace( + /,\s*$/, + "", + ); } diff --git a/src/ws.ts b/src/ws.ts index 769d52c..3d9f226 100644 --- a/src/ws.ts +++ b/src/ws.ts @@ -1,5 +1,5 @@ +import type { WebSocket } from "ws"; import { logInfo } from "./logger.js"; -import { WebSocket } from "ws"; export type WsEvent = { type: string;