@tryghost/bookshelf-collision 0.1.36 → 0.1.38

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.
@@ -56,7 +56,9 @@ module.exports = function (Bookshelf) {
56
56
  const clientUpdatedAt = moment(self.clientData.updated_at || self.serverData.updated_at || new Date());
57
57
  const serverUpdatedAt = moment(self.serverData.updated_at || clientUpdatedAt);
58
58
 
59
- if (Object.keys(changed).length) {
59
+ const changedFields = Object.keys(changed);
60
+
61
+ if (changedFields.length) {
60
62
  if (clientUpdatedAt.diff(serverUpdatedAt) !== 0) {
61
63
  // @NOTE: This will rollback the update. We cannot know if relations were updated before doing the update.
62
64
  throw new errors.UpdateCollisionError({
@@ -64,6 +66,7 @@ module.exports = function (Bookshelf) {
64
66
  code: 'UPDATE_COLLISION',
65
67
  level: 'critical',
66
68
  errorDetails: {
69
+ changedFields,
67
70
  clientUpdatedAt: self.clientData.updated_at,
68
71
  serverUpdatedAt: self.serverData.updated_at
69
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/bookshelf-collision",
3
- "version": "0.1.36",
3
+ "version": "0.1.38",
4
4
  "repository": "https://github.com/TryGhost/framework/tree/main/packages/bookshelf-collision",
5
5
  "author": "Ghost Foundation",
6
6
  "license": "MIT",
@@ -21,12 +21,12 @@
21
21
  "devDependencies": {
22
22
  "mocha": "10.2.0",
23
23
  "should": "13.2.3",
24
- "sinon": "15.0.4"
24
+ "sinon": "17.0.1"
25
25
  },
26
26
  "dependencies": {
27
- "@tryghost/errors": "^1.2.26",
27
+ "@tryghost/errors": "^1.2.27",
28
28
  "lodash": "^4.17.21",
29
29
  "moment-timezone": "^0.5.33"
30
30
  },
31
- "gitHead": "2330ad6fb69583198fb7ffd1b06fce6e4fcbe4d6"
31
+ "gitHead": "a655bcfba6531944b8fd997bf53ccefb9dcf1685"
32
32
  }