Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
199 changes: 191 additions & 8 deletions components/log-viewer-webui/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions components/log-viewer-webui/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"react-dom": "^19.0.0",
"react-router": "^7.4.1",
"react-syntax-highlighter": "^15.6.1",
"socket.io-client": "^4.8.1",
"vite-tsconfig-paths": "^5.1.4",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Relocate vite-tsconfig-paths to devDependencies.
The vite-tsconfig-paths plugin is only needed at build time and for local development. Moving it to devDependencies will reduce production install size and clarify its usage scope.

"zustand": "^5.0.3"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import {
ClientToServerEvents,
ServerToClientEvents,
} from "@common/index.js";
import {Socket} from "socket.io-client";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Prefer type-only import for Socket
Consider using a type-only import for the Socket interface to avoid pulling in the module at runtime if it’s only used for type annotations:

-import {Socket} from "socket.io-client";
+import type {Socket} from "socket.io-client";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import {Socket} from "socket.io-client";
-import {Socket} from "socket.io-client";
+import type {Socket} from "socket.io-client";


import {MongoCursorSocket} from "./MongoCursorSocket.js";
import {getSharedSocket} from "./SocketSingleton.js";


/**
* Socket connection to a MongoDB collection residing on a server. Class provides methods to
* query the collection.
*/
class MongoCollectionSocket {
#collectionName: string;

#socket: Socket<ServerToClientEvents, ClientToServerEvents>;

/**
* Initalizes socket connection to a MongoDB collection on the server.
*
* @param collectionName
*/
Comment on lines +20 to +24

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Fix typo and clarify JSDoc in constructor
There's a typo in the JSDoc (InitalizesInitializes) and the @param lacks a description. Consider updating to:

- * Initalizes socket connection to a MongoDB collection on the server.
+ * Initializes the shared socket connection for a MongoDB collection on the server.
+ *
+ * @param collectionName - The name of the MongoDB collection to subscribe to.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* Initalizes socket connection to a MongoDB collection on the server.
*
* @param collectionName
*/
/**
* Initializes the shared socket connection for a MongoDB collection on the server.
*
* @param collectionName - The name of the MongoDB collection to subscribe to.
*/

constructor (collectionName: string) {
this.#socket = getSharedSocket();
this.#collectionName = collectionName;
console.log(`MongoDB collection:${collectionName} initialized.`);
}
Comment on lines +25 to +29

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Replace console.log with proper logger
Using console.log for production code can make debugging and log management harder. Consider using a structured logging utility or debug namespace (e.g. debug, winston, or a custom logger) to control log levels and output channels.


/**
* Selects documents in collection and returns a cursor-like object.
*
* @param query
* @param options
* @return a `MongoCursorSocket`.
*/

find (query: object, options: object) {
return new MongoCursorSocket(
this.#socket,
this.#collectionName,
query,
options,
);
}
}


export default MongoCollectionSocket;
Loading