json-object-editor 0.10.507 → 0.10.508
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/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/server/modules/MCP.js +5 -3
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/server/modules/MCP.js
CHANGED
|
@@ -168,9 +168,11 @@ MCP.tools = {
|
|
|
168
168
|
if (!object || !object.itemtype) throw new Error("'object' with 'itemtype' is required");
|
|
169
169
|
const user = (ctx.req && ctx.req.User) ? ctx.req.User : { name: 'anonymous' };
|
|
170
170
|
// Ensure server-side update timestamp parity with /API/save
|
|
171
|
-
if (!object.joeUpdated) {
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
if (!object.joeUpdated) { object.joeUpdated = new Date(); }
|
|
172
|
+
// Ensure a stable _id for new objects so history and events work consistently
|
|
173
|
+
try {
|
|
174
|
+
if (!object._id) { object._id = (typeof cuid === 'function') ? cuid() : ($c && $c.guid ? $c.guid() : undefined); }
|
|
175
|
+
} catch(_e) { /* ignore id generation errors; Mongo will assign one */ }
|
|
174
176
|
const saved = await new Promise((resolve, reject) => {
|
|
175
177
|
try {
|
|
176
178
|
Storage.save(object, object.itemtype, function(err, data){
|