@tryghost/admin-api
Advanced tools
+20
-0
@@ -26,2 +26,3 @@ 'use strict'; | ||
| } | ||
| if (!version) { | ||
@@ -48,2 +49,3 @@ throw new Error('GhostAdminAPI Config Missing: @tryghost/admin-api requires a "version" like "v2"'); | ||
| } | ||
| const api = ['posts'].reduce((apiObject, resourceType) => { | ||
@@ -167,2 +169,14 @@ function add(data, options = {}) { | ||
| api.configuration = { | ||
| read() { | ||
| return makeResourceRequest('configuration', {}, {}); | ||
| }, | ||
| about: { | ||
| read() { | ||
| return makeResourceRequest('configuration/about', {}, {}); | ||
| } | ||
| } | ||
| }; | ||
| return api; | ||
@@ -221,2 +235,8 @@ | ||
| // HACK: the configuration/about endpoint doesn't match the typical | ||
| // resource url structure and return value so we need to special-case it | ||
| if (resourceType === 'configuration/about') { | ||
| resourceType = 'configuration'; | ||
| } | ||
| if (!Array.isArray(res.data[resourceType])) { | ||
@@ -223,0 +243,0 @@ return res.data[resourceType]; |
+20
-0
@@ -12,2 +12,3 @@ import axios from 'axios'; | ||
| } | ||
| if (!version) { | ||
@@ -34,2 +35,3 @@ throw new Error('GhostAdminAPI Config Missing: @tryghost/admin-api requires a "version" like "v2"'); | ||
| } | ||
| const api = ['posts'].reduce((apiObject, resourceType) => { | ||
@@ -153,2 +155,14 @@ function add(data, options = {}) { | ||
| api.configuration = { | ||
| read() { | ||
| return makeResourceRequest('configuration', {}, {}); | ||
| }, | ||
| about: { | ||
| read() { | ||
| return makeResourceRequest('configuration/about', {}, {}); | ||
| } | ||
| } | ||
| }; | ||
| return api; | ||
@@ -207,2 +221,8 @@ | ||
| // HACK: the configuration/about endpoint doesn't match the typical | ||
| // resource url structure and return value so we need to special-case it | ||
| if (resourceType === 'configuration/about') { | ||
| resourceType = 'configuration'; | ||
| } | ||
| if (!Array.isArray(res.data[resourceType])) { | ||
@@ -209,0 +229,0 @@ return res.data[resourceType]; |
+2
-2
| { | ||
| "name": "@tryghost/admin-api", | ||
| "version": "0.0.2", | ||
| "version": "0.0.3", | ||
| "repository": "https://github.com/TryGhost/Ghost-SDKs/tree/master/packages/admin-api", | ||
@@ -47,3 +47,3 @@ "author": "Ghost Foundation", | ||
| }, | ||
| "gitHead": "0350bcd9cb92309f9d56c5c43702c45045b69def" | ||
| "gitHead": "16fd601c0167741e554f38dcf49bfa47a81dc8d9" | ||
| } |
Sorry, the diff of this file is too big to display
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
110729
1.15%758
4.12%1
Infinity%