@tryghost/admin-api 1.13.17 → 1.14.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.
Files changed (2) hide show
  1. package/lib/admin-api.js +10 -9
  2. package/package.json +2 -2
package/lib/admin-api.js CHANGED
@@ -7,9 +7,9 @@ const token = require('./token');
7
7
  const packageInfo = require('../package.json');
8
8
  const packageVersion = packageInfo.version;
9
9
 
10
- // NOTE: bump this default when Ghost v5 is released
11
- const defaultAcceptVersionHeader = 'v5.0';
12
- const supportedVersions = ['v2', 'v3', 'v4', 'v5', 'canary'];
10
+ // NOTE: bump this default when major versions are released
11
+ const defaultAcceptVersionHeader = 'v6.0';
12
+ const supportedVersions = ['v2', 'v3', 'v4', 'v5', 'v6', 'canary'];
13
13
  const packageName = '@tryghost/admin-api';
14
14
 
15
15
  /**
@@ -22,14 +22,15 @@ const packageName = '@tryghost/admin-api';
22
22
  const resolveAPIPrefix = (version) => {
23
23
  let prefix;
24
24
 
25
- // NOTE: the "version.match(/^v5\.\d+/)" expression should be changed to "version.match(/^v\d+\.\d+/)" once Ghost v5 is out
26
- if (version === 'v5' || version === undefined || version.match(/^v5\.\d+/)) {
27
- prefix = `/admin/`;
28
- } else if (version.match(/^v\d+\.\d+/)) {
29
- const versionPrefix = /^(v\d+)\.\d+/.exec(version)[1];
25
+ // Only v2, v3, v4, and canary need version prefixes in the URL
26
+ if (version === 'v2' || version === 'v3' || version === 'v4' || version === 'canary') {
27
+ prefix = `/${version}/admin/`;
28
+ } else if (version && version.match(/^v[2-4]\.\d+/)) {
29
+ const versionPrefix = /^(v[2-4])\.\d+/.exec(version)[1];
30
30
  prefix = `/${versionPrefix}/admin/`;
31
31
  } else {
32
- prefix = `/${version}/admin/`;
32
+ // Default for v5+, v6, undefined, etc. - no version prefix
33
+ prefix = `/admin/`;
33
34
  }
34
35
 
35
36
  return prefix;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/admin-api",
3
- "version": "1.13.17",
3
+ "version": "1.14.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/TryGhost/SDK.git",
@@ -36,5 +36,5 @@
36
36
  "form-data": "^4.0.0",
37
37
  "jsonwebtoken": "^9.0.0"
38
38
  },
39
- "gitHead": "b10773947244536b8829fec0540819990c901987"
39
+ "gitHead": "860707f032864400017b0f176cbabf181f99b764"
40
40
  }