[WEB-1435] dev: conflict free issue descriptions (#5912)
* chore: new description binary endpoints * chore: conflict free issue description * chore: fix submitting status * chore: update yjs utils * chore: handle component re-mounting * chore: update buffer response type * chore: add try catch for issue description update * chore: update buffer response type * chore: description binary in retrieve * chore: update issue description hook * chore: decode description binary * chore: migrations fixes and cleanup * chore: migration fixes * fix: inbox issue description * chore: move update operations to the issue store * fix: merge conflicts * chore: reverted the commit * chore: removed the unwanted imports * chore: remove unnecessary props * chore: remove unused services * chore: update live server error handling --------- Co-authored-by: NarayanBavisetti <narayan3119@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
parent
229610513a
commit
e9680cab74
65 changed files with 1466 additions and 358 deletions
|
|
@ -5,16 +5,13 @@ import expressWs from "express-ws";
|
|||
import * as Sentry from "@sentry/node";
|
||||
import compression from "compression";
|
||||
import helmet from "helmet";
|
||||
|
||||
// cors
|
||||
import cors from "cors";
|
||||
|
||||
// core hocuspocus server
|
||||
import { getHocusPocusServer } from "@/core/hocuspocus-server.js";
|
||||
|
||||
// helpers
|
||||
import { logger, manualLogger } from "@/core/helpers/logger.js";
|
||||
import { errorHandler } from "@/core/helpers/error-handler.js";
|
||||
import { logger, manualLogger } from "@/core/helpers/logger.js";
|
||||
import { resolveDocumentConflicts, TResolveConflictsRequestBody } from "@/core/resolve-conflicts.js";
|
||||
|
||||
const app = express();
|
||||
expressWs(app);
|
||||
|
|
@ -29,7 +26,7 @@ app.use(
|
|||
compression({
|
||||
level: 6,
|
||||
threshold: 5 * 1000,
|
||||
}),
|
||||
})
|
||||
);
|
||||
|
||||
// Logging middleware
|
||||
|
|
@ -62,6 +59,25 @@ router.ws("/collaboration", (ws, req) => {
|
|||
}
|
||||
});
|
||||
|
||||
app.post("/resolve-document-conflicts", (req, res) => {
|
||||
const { original_document, updates } = req.body as TResolveConflictsRequestBody;
|
||||
try {
|
||||
if (original_document === undefined || updates === undefined) {
|
||||
res.status(400).send({
|
||||
message: "Missing required fields",
|
||||
});
|
||||
return;
|
||||
}
|
||||
const resolvedDocument = resolveDocumentConflicts(req.body);
|
||||
res.status(200).json(resolvedDocument);
|
||||
} catch (error) {
|
||||
manualLogger.error("Error in /resolve-document-conflicts endpoint:", error);
|
||||
res.status(500).send({
|
||||
message: "Internal server error",
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
app.use(process.env.LIVE_BASE_PATH || "/live", router);
|
||||
|
||||
app.use((_req, res) => {
|
||||
|
|
@ -82,9 +98,7 @@ const gracefulShutdown = async () => {
|
|||
try {
|
||||
// Close the HocusPocus server WebSocket connections
|
||||
await HocusPocusServer.destroy();
|
||||
manualLogger.info(
|
||||
"HocusPocus server WebSocket connections closed gracefully.",
|
||||
);
|
||||
manualLogger.info("HocusPocus server WebSocket connections closed gracefully.");
|
||||
|
||||
// Close the Express server
|
||||
liveServer.close(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue