@tryghost/bookshelf-collision 2.0.3 → 2.1.0

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/README.md CHANGED
@@ -6,8 +6,7 @@
6
6
 
7
7
  or
8
8
 
9
- `yarn add @tryghost/bookshelf-collision`
10
-
9
+ `pnpm add @tryghost/bookshelf-collision`
11
10
 
12
11
  ## Purpose
13
12
 
@@ -15,29 +14,24 @@ Bookshelf plugin that detects stale updates and throws an update-collision error
15
14
 
16
15
  ## Usage
17
16
 
18
-
19
17
  ## Develop
20
18
 
21
- This is a mono repository, managed with [lerna](https://lernajs.io/).
19
+ This is a mono repository, managed with [Nx](https://nx.dev).
22
20
 
23
21
  Follow the instructions for the top-level repo.
24
- 1. `git clone` this repo & `cd` into it as usual
25
- 2. Run `yarn` to install top-level dependencies.
26
22
 
23
+ 1. `git clone` this repo & `cd` into it as usual
24
+ 2. Run `pnpm install` to install top-level dependencies.
27
25
 
28
26
  ## Run
29
27
 
30
- - `yarn dev`
31
-
28
+ - `pnpm dev`
32
29
 
33
30
  ## Test
34
31
 
35
- - `yarn lint` run just eslint
36
- - `yarn test` run lint and tests
37
-
38
-
39
-
32
+ - `pnpm lint` runs oxlint
33
+ - `pnpm test` runs lint and tests
40
34
 
41
- # Copyright & License
35
+ # Copyright & License
42
36
 
43
- Copyright (c) 2013-2026 Ghost Foundation - Released under the [MIT license](LICENSE).
37
+ Copyright (c) 2013-2026 Ghost Foundation - Released under the [MIT license](LICENSE).
@@ -30,9 +30,11 @@ module.exports = function (Bookshelf) {
30
30
  const self = this;
31
31
 
32
32
  // CASE: only enabled for posts table
33
- if (this.tableName !== 'posts' ||
33
+ if (
34
+ this.tableName !== 'posts' ||
34
35
  !self.serverData ||
35
- ((options.method !== 'update' && options.method !== 'patch') || !options.method)
36
+ (options.method !== 'update' && options.method !== 'patch') ||
37
+ !options.method
36
38
  ) {
37
39
  return parentSync;
38
40
  }
@@ -49,11 +51,19 @@ module.exports = function (Bookshelf) {
49
51
  parentSync.update = async function update() {
50
52
  const response = await originalUpdateSync.apply(this, arguments);
51
53
  const changed = _.omit(self._changed, [
52
- 'created_at', 'updated_at', 'author_id', 'id',
53
- 'published_by', 'updated_by', 'html', 'plaintext'
54
+ 'created_at',
55
+ 'updated_at',
56
+ 'author_id',
57
+ 'id',
58
+ 'published_by',
59
+ 'updated_by',
60
+ 'html',
61
+ 'plaintext',
54
62
  ]);
55
63
 
56
- const clientUpdatedAt = moment(self.clientData.updated_at || self.serverData.updated_at || new Date());
64
+ const clientUpdatedAt = moment(
65
+ self.clientData.updated_at || self.serverData.updated_at || new Date(),
66
+ );
57
67
  const serverUpdatedAt = moment(self.serverData.updated_at || clientUpdatedAt);
58
68
 
59
69
  const changedFields = Object.keys(changed);
@@ -68,8 +78,8 @@ module.exports = function (Bookshelf) {
68
78
  errorDetails: {
69
79
  changedFields,
70
80
  clientUpdatedAt: self.clientData.updated_at,
71
- serverUpdatedAt: self.serverData.updated_at
72
- }
81
+ serverUpdatedAt: self.serverData.updated_at,
82
+ },
73
83
  });
74
84
  }
75
85
  }
@@ -91,7 +101,7 @@ module.exports = function (Bookshelf) {
91
101
  this.serverData = _.cloneDeep(this.attributes);
92
102
 
93
103
  return ParentModel.prototype.save.apply(this, arguments);
94
- }
104
+ },
95
105
  });
96
106
 
97
107
  Bookshelf.Model = Model;
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
1
  {
2
2
  "name": "@tryghost/bookshelf-collision",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
+ "license": "MIT",
5
+ "author": "Ghost Foundation",
4
6
  "repository": {
5
7
  "type": "git",
6
8
  "url": "git+https://github.com/TryGhost/framework.git",
7
9
  "directory": "packages/bookshelf-collision"
8
10
  },
9
- "author": "Ghost Foundation",
10
- "license": "MIT",
11
- "main": "index.js",
12
- "scripts": {
13
- "dev": "echo \"Implement me!\"",
14
- "test": "NODE_ENV=testing vitest run --coverage --config ../../vitest.config.ts",
15
- "lint": "eslint . --ext .js --cache",
16
- "posttest": "yarn lint"
17
- },
18
11
  "files": [
19
12
  "index.js",
20
13
  "lib"
21
14
  ],
15
+ "main": "index.js",
22
16
  "publishConfig": {
23
17
  "access": "public"
24
18
  },
19
+ "dependencies": {
20
+ "lodash": "4.18.1",
21
+ "moment-timezone": "^0.5.33",
22
+ "@tryghost/errors": "3.1.0"
23
+ },
25
24
  "devDependencies": {
26
- "sinon": "21.0.2"
25
+ "sinon": "21.1.2"
27
26
  },
28
- "dependencies": {
29
- "@tryghost/errors": "^3.0.3",
30
- "lodash": "4.17.23",
31
- "moment-timezone": "^0.5.33"
27
+ "scripts": {
28
+ "dev": "echo \"Implement me!\"",
29
+ "test": "NODE_ENV=testing vitest run --coverage --config ../../vitest.config.ts",
30
+ "lint": "oxlint -c ../../.oxlintrc.json .",
31
+ "posttest": "pnpm run lint"
32
32
  }
33
- }
33
+ }