@tryghost/content-api 1.11.16 → 1.11.17

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2013-2022 Ghost Foundation
3
+ Copyright (c) 2013-2023 Ghost Foundation
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -18,4 +18,4 @@ Follow the instructions for the top-level repo.
18
18
 
19
19
  # Copyright & License
20
20
 
21
- Copyright (c) 2013-2022 Ghost Foundation - Released under the [MIT license](LICENSE).
21
+ Copyright (c) 2013-2023 Ghost Foundation - Released under the [MIT license](LICENSE).
@@ -3,7 +3,7 @@
3
3
  var axios = require('axios');
4
4
 
5
5
  var name$1 = "@tryghost/content-api";
6
- var version = "1.11.16";
6
+ var version = "1.11.17";
7
7
  var repository = "https://github.com/TryGhost/SDK/tree/main/packages/content-api";
8
8
  var author = "Ghost Foundation";
9
9
  var license = "MIT";
@@ -32,12 +32,12 @@ var publishConfig = {
32
32
  access: "public"
33
33
  };
34
34
  var devDependencies = {
35
- "@babel/core": "7.22.9",
35
+ "@babel/core": "7.23.0",
36
36
  "@babel/polyfill": "7.12.1",
37
- "@babel/preset-env": "7.22.9",
37
+ "@babel/preset-env": "7.22.20",
38
38
  "@rollup/plugin-json": "6.0.0",
39
39
  c8: "7.13.0",
40
- "core-js": "3.31.1",
40
+ "core-js": "3.32.2",
41
41
  "eslint-plugin-ghost": "2.16.0",
42
42
  mocha: "10.2.0",
43
43
  rollup: "2.79.1",
@@ -53,7 +53,7 @@ var devDependencies = {
53
53
  var dependencies = {
54
54
  axios: "^1.0.0"
55
55
  };
56
- var gitHead = "9aab58d76232aa8487afaa4006db14816094671d";
56
+ var gitHead = "432b7bde7594264164b08c403d87d1d06659d603";
57
57
  var packageInfo = {
58
58
  name: name$1,
59
59
  version: version,
package/es/content-api.js CHANGED
@@ -542,8 +542,9 @@ const reduceDescriptors = (obj, reducer) => {
542
542
  const reducedDescriptors = {};
543
543
 
544
544
  forEach(descriptors, (descriptor, name) => {
545
- if (reducer(descriptor, name, obj) !== false) {
546
- reducedDescriptors[name] = descriptor;
545
+ let ret;
546
+ if ((ret = reducer(descriptor, name, obj)) !== false) {
547
+ reducedDescriptors[name] = ret || descriptor;
547
548
  }
548
549
  });
549
550
 
@@ -1385,10 +1386,6 @@ function formDataToJSON(formData) {
1385
1386
  return null;
1386
1387
  }
1387
1388
 
1388
- const DEFAULT_CONTENT_TYPE = {
1389
- 'Content-Type': undefined
1390
- };
1391
-
1392
1389
  /**
1393
1390
  * It takes a string, tries to parse it, and if it fails, it returns the stringified version
1394
1391
  * of the input
@@ -1418,7 +1415,7 @@ const defaults = {
1418
1415
 
1419
1416
  transitional: transitionalDefaults,
1420
1417
 
1421
- adapter: ['xhr', 'http'],
1418
+ adapter: platform.isNode ? 'http' : 'xhr',
1422
1419
 
1423
1420
  transformRequest: [function transformRequest(data, headers) {
1424
1421
  const contentType = headers.getContentType() || '';
@@ -1527,19 +1524,16 @@ const defaults = {
1527
1524
 
1528
1525
  headers: {
1529
1526
  common: {
1530
- 'Accept': 'application/json, text/plain, */*'
1527
+ 'Accept': 'application/json, text/plain, */*',
1528
+ 'Content-Type': undefined
1531
1529
  }
1532
1530
  }
1533
1531
  };
1534
1532
 
1535
- utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
1533
+ utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
1536
1534
  defaults.headers[method] = {};
1537
1535
  });
1538
1536
 
1539
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
1540
- defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
1541
- });
1542
-
1543
1537
  var defaults$1 = defaults;
1544
1538
 
1545
1539
  // RawAxiosHeaders whose duplicates are ignored by node
@@ -1873,7 +1867,17 @@ class AxiosHeaders {
1873
1867
 
1874
1868
  AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
1875
1869
 
1876
- utils.freezeMethods(AxiosHeaders.prototype);
1870
+ // reserved names hotfix
1871
+ utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
1872
+ let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
1873
+ return {
1874
+ get: () => value,
1875
+ set(headerValue) {
1876
+ this[mapped] = headerValue;
1877
+ }
1878
+ }
1879
+ });
1880
+
1877
1881
  utils.freezeMethods(AxiosHeaders);
1878
1882
 
1879
1883
  var AxiosHeaders$1 = AxiosHeaders;
@@ -2628,7 +2632,7 @@ function mergeConfig(config1, config2) {
2628
2632
  return config;
2629
2633
  }
2630
2634
 
2631
- const VERSION = "1.4.0";
2635
+ const VERSION = "1.5.0";
2632
2636
 
2633
2637
  const validators$1 = {};
2634
2638
 
@@ -2781,15 +2785,13 @@ class Axios {
2781
2785
  // Set config.method
2782
2786
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
2783
2787
 
2784
- let contextHeaders;
2785
-
2786
2788
  // Flatten headers
2787
- contextHeaders = headers && utils.merge(
2789
+ let contextHeaders = headers && utils.merge(
2788
2790
  headers.common,
2789
2791
  headers[config.method]
2790
2792
  );
2791
2793
 
2792
- contextHeaders && utils.forEach(
2794
+ headers && utils.forEach(
2793
2795
  ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
2794
2796
  (method) => {
2795
2797
  delete headers[method];
@@ -3199,6 +3201,8 @@ axios.AxiosHeaders = AxiosHeaders$1;
3199
3201
 
3200
3202
  axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
3201
3203
 
3204
+ axios.getAdapter = adapters.getAdapter;
3205
+
3202
3206
  axios.HttpStatusCode = HttpStatusCode$1;
3203
3207
 
3204
3208
  axios.default = axios;
@@ -3207,7 +3211,7 @@ axios.default = axios;
3207
3211
  var axios$1 = axios;
3208
3212
 
3209
3213
  var name$1 = "@tryghost/content-api";
3210
- var version = "1.11.16";
3214
+ var version = "1.11.17";
3211
3215
  var repository = "https://github.com/TryGhost/SDK/tree/main/packages/content-api";
3212
3216
  var author = "Ghost Foundation";
3213
3217
  var license = "MIT";
@@ -3236,12 +3240,12 @@ var publishConfig = {
3236
3240
  access: "public"
3237
3241
  };
3238
3242
  var devDependencies = {
3239
- "@babel/core": "7.22.9",
3243
+ "@babel/core": "7.23.0",
3240
3244
  "@babel/polyfill": "7.12.1",
3241
- "@babel/preset-env": "7.22.9",
3245
+ "@babel/preset-env": "7.22.20",
3242
3246
  "@rollup/plugin-json": "6.0.0",
3243
3247
  c8: "7.13.0",
3244
- "core-js": "3.31.1",
3248
+ "core-js": "3.32.2",
3245
3249
  "eslint-plugin-ghost": "2.16.0",
3246
3250
  mocha: "10.2.0",
3247
3251
  rollup: "2.79.1",
@@ -3257,7 +3261,7 @@ var devDependencies = {
3257
3261
  var dependencies = {
3258
3262
  axios: "^1.0.0"
3259
3263
  };
3260
- var gitHead = "9aab58d76232aa8487afaa4006db14816094671d";
3264
+ var gitHead = "432b7bde7594264164b08c403d87d1d06659d603";
3261
3265
  var packageInfo = {
3262
3266
  name: name$1,
3263
3267
  version: version,