@hasna/mementos 0.4.14 → 0.4.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";AACA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAukCH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAkH9C"}
|
package/dist/server/index.js
CHANGED
|
@@ -2418,11 +2418,15 @@ addRoute("PATCH", "/api/memories/:id", async (req, _url, params) => {
|
|
|
2418
2418
|
if (!body) {
|
|
2419
2419
|
return errorResponse("Invalid JSON body", 400);
|
|
2420
2420
|
}
|
|
2421
|
-
|
|
2422
|
-
|
|
2421
|
+
const updateBody = { ...body };
|
|
2422
|
+
if (updateBody["version"] === undefined) {
|
|
2423
|
+
const existing = getMemory(params["id"]);
|
|
2424
|
+
if (!existing)
|
|
2425
|
+
return errorResponse("Memory not found", 404);
|
|
2426
|
+
updateBody["version"] = existing.version;
|
|
2423
2427
|
}
|
|
2424
2428
|
try {
|
|
2425
|
-
const memory = updateMemory(params["id"],
|
|
2429
|
+
const memory = updateMemory(params["id"], updateBody);
|
|
2426
2430
|
return json(memory);
|
|
2427
2431
|
} catch (e) {
|
|
2428
2432
|
if (e instanceof MemoryNotFoundError) {
|