Skip to content

Commit

Permalink
use js suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbroks committed Nov 14, 2024
1 parent a44e4c4 commit 6c19eb6
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 20 deletions.
5 changes: 3 additions & 2 deletions apps/pty-proxy/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import baseConfig from "@ctrlplane/eslint-config/base";
import baseConfig, { requireJsSuffix } from "@ctrlplane/eslint-config/base";

/** @type {import('typescript-eslint').Config} */
export default [
{
ignores: [".nitro/**", ".output/**"],
ignores: [".nitro/**", ".output/**", "dist/**", "node_modules/**"],
},
...requireJsSuffix,
...baseConfig,
];
2 changes: 1 addition & 1 deletion apps/pty-proxy/src/auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { IncomingMessage } from "http";
import type { Session } from "next-auth";

import { env } from "./config";
import { env } from "./config.js";

export const getSession = async (req: IncomingMessage) => {
const options: RequestInit = {
Expand Down
2 changes: 1 addition & 1 deletion apps/pty-proxy/src/controller/agent-socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { upsertResources } from "@ctrlplane/job-dispatch";
import { logger } from "@ctrlplane/logger";
import { agentConnect, agentHeartbeat } from "@ctrlplane/validators/session";

import { ifMessage } from "./utils";
import { ifMessage } from "./utils.js";

export class AgentSocket {
static async from(socket: WebSocket, request: IncomingMessage) {
Expand Down
6 changes: 3 additions & 3 deletions apps/pty-proxy/src/controller/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { WebSocketServer } from "ws";

import { logger } from "@ctrlplane/logger";

import { AgentSocket } from "./agent-socket";
import { agents, users } from "./sockets";
import { UserSocket } from "./user-socket";
import { AgentSocket } from "./agent-socket.js";
import { agents, users } from "./sockets.js";
import { UserSocket } from "./user-socket.js";

const onConnect = async (ws: WebSocket, request: IncomingMessage) => {
const agent = await AgentSocket.from(ws, request);
Expand Down
4 changes: 2 additions & 2 deletions apps/pty-proxy/src/controller/sockets.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { AgentSocket } from "./agent-socket";
import type { UserSocket } from "./user-socket";
import type { AgentSocket } from "./agent-socket.js";
import type { UserSocket } from "./user-socket.js";

export const agents = new Map<string, AgentSocket>();
export const users = new Map<string, UserSocket>();
8 changes: 4 additions & 4 deletions apps/pty-proxy/src/controller/user-socket.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { IncomingMessage } from "node:http";
import type WebSocket from "ws";
import { createSessionSocket } from "@/sessions";

import { logger } from "@ctrlplane/logger";
import { sessionCreate, sessionResize } from "@ctrlplane/validators/session";

import { getSession } from "../auth";
import { agents } from "./sockets";
import { ifMessage } from "./utils";
import { getSession } from "../auth.js";
import { createSessionSocket } from "../sessions/index.js";
import { agents } from "./sockets.js";
import { ifMessage } from "./utils.js";

type User = { id: string };

Expand Down
6 changes: 3 additions & 3 deletions apps/pty-proxy/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import ms from "ms";

import { env } from "./config";
import { addSocket } from "./routing";
import { app } from "./server";
import { env } from "./config.js";
import { addSocket } from "./routing.js";
import { app } from "./server.js";

const server = addSocket(app).listen(env.PORT, () => {
console.log(`Server is running on port ${env.PORT}`);
Expand Down
4 changes: 2 additions & 2 deletions apps/pty-proxy/src/routing.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createServer } from "node:http";
import type { Express } from "express";

import { controllerOnUpgrade } from "./controller";
import { sessionOnUpgrade } from "./sessions";
import { controllerOnUpgrade } from "./controller/index.js";
import { sessionOnUpgrade } from "./sessions/index.js";

export const addSocket = (expressApp: Express) => {
const server = createServer(expressApp);
Expand Down
2 changes: 1 addition & 1 deletion apps/pty-proxy/src/session-auditor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type WebSocket from "ws";
import { z } from "zod";

import { ifMessage } from "./controller/utils";
import { ifMessage } from "./controller/utils.js";

export const auditSessions = (socket: WebSocket) => {
socket.on(
Expand Down
2 changes: 1 addition & 1 deletion apps/pty-proxy/src/sessions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { WebSocketServer } from "ws";

import { logger } from "@ctrlplane/logger";

import { sessionServers } from "./servers";
import { sessionServers } from "./servers.js";

const MAX_HISTORY_BYTES = 1024;

Expand Down

0 comments on commit 6c19eb6

Please sign in to comment.