@kelceyp/caw-server 0.0.14 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +7 -7
- package/dist/main.js.map +3 -3
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -36104,7 +36104,7 @@ var ProjectRoutes_default = { create: create3 };
|
|
|
36104
36104
|
// src/api/DocumentRoutes.js
|
|
36105
36105
|
var create4 = (app, { store, storeDemux } = {}) => {
|
|
36106
36106
|
const auth = Auth_default.create({ store });
|
|
36107
|
-
app.post("/api/documents", auth.
|
|
36107
|
+
app.post("/api/documents", auth.middleware, async (req, res) => {
|
|
36108
36108
|
if (!storeDemux) {
|
|
36109
36109
|
return res.status(500).json({ error: "StoreDemux not initialized" });
|
|
36110
36110
|
}
|
|
@@ -36113,13 +36113,13 @@ var create4 = (app, { store, storeDemux } = {}) => {
|
|
|
36113
36113
|
return res.status(400).json({ error: "type and path are required" });
|
|
36114
36114
|
}
|
|
36115
36115
|
try {
|
|
36116
|
-
const result = storeDemux.createDocument({ type, path, content, store: storeCode });
|
|
36116
|
+
const result = await storeDemux.createDocument({ type, path, content, store: storeCode });
|
|
36117
36117
|
res.status(201).json(result);
|
|
36118
36118
|
} catch (error) {
|
|
36119
36119
|
res.status(500).json({ error: error.message });
|
|
36120
36120
|
}
|
|
36121
36121
|
});
|
|
36122
|
-
app.get("/api/documents/by-path", auth.
|
|
36122
|
+
app.get("/api/documents/by-path", auth.middleware, async (req, res) => {
|
|
36123
36123
|
if (!storeDemux) {
|
|
36124
36124
|
return res.status(500).json({ error: "StoreDemux not initialized" });
|
|
36125
36125
|
}
|
|
@@ -36128,7 +36128,7 @@ var create4 = (app, { store, storeDemux } = {}) => {
|
|
|
36128
36128
|
return res.status(400).json({ error: "type and path query params are required" });
|
|
36129
36129
|
}
|
|
36130
36130
|
try {
|
|
36131
|
-
const doc = storeDemux.getDocumentByPath(type, path, storeCode);
|
|
36131
|
+
const doc = await storeDemux.getDocumentByPath(type, path, storeCode);
|
|
36132
36132
|
if (!doc) {
|
|
36133
36133
|
return res.status(404).json({ error: "Document not found" });
|
|
36134
36134
|
}
|
|
@@ -36137,13 +36137,13 @@ var create4 = (app, { store, storeDemux } = {}) => {
|
|
|
36137
36137
|
res.status(500).json({ error: error.message });
|
|
36138
36138
|
}
|
|
36139
36139
|
});
|
|
36140
|
-
app.get("/api/documents/:id", auth.
|
|
36140
|
+
app.get("/api/documents/:id", auth.middleware, async (req, res) => {
|
|
36141
36141
|
if (!storeDemux) {
|
|
36142
36142
|
return res.status(500).json({ error: "StoreDemux not initialized" });
|
|
36143
36143
|
}
|
|
36144
36144
|
const { id } = req.params;
|
|
36145
36145
|
try {
|
|
36146
|
-
const doc = storeDemux.getDocument(id);
|
|
36146
|
+
const doc = await storeDemux.getDocument(id);
|
|
36147
36147
|
if (!doc) {
|
|
36148
36148
|
return res.status(404).json({ error: "Document not found" });
|
|
36149
36149
|
}
|
|
@@ -55772,4 +55772,4 @@ main().catch((error) => {
|
|
|
55772
55772
|
process.exit(1);
|
|
55773
55773
|
});
|
|
55774
55774
|
|
|
55775
|
-
//# debugId=
|
|
55775
|
+
//# debugId=EF4F500FE6FD6DF264756E2164756E21
|