@tryghost/content-api 1.12.8 → 1.12.9
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/cjs/content-api.js +7 -7
- package/es/content-api.js +221 -83
- package/es/content-api.js.map +1 -1
- package/package.json +7 -7
- package/umd/content-api.min.js +1 -1
- package/umd/content-api.min.js.map +1 -1
package/cjs/content-api.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var axios = require('axios');
|
|
4
4
|
|
|
5
5
|
var name$1 = "@tryghost/content-api";
|
|
6
|
-
var version = "1.12.
|
|
6
|
+
var version = "1.12.9";
|
|
7
7
|
var repository = {
|
|
8
8
|
type: "git",
|
|
9
9
|
url: "git+https://github.com/TryGhost/SDK.git",
|
|
@@ -36,17 +36,17 @@ var publishConfig = {
|
|
|
36
36
|
access: "public"
|
|
37
37
|
};
|
|
38
38
|
var devDependencies = {
|
|
39
|
-
"@babel/core": "7.29.
|
|
39
|
+
"@babel/core": "7.29.7",
|
|
40
40
|
"@babel/polyfill": "7.12.1",
|
|
41
|
-
"@babel/preset-env": "7.29.
|
|
42
|
-
"@rollup/plugin-babel": "7.
|
|
41
|
+
"@babel/preset-env": "7.29.7",
|
|
42
|
+
"@rollup/plugin-babel": "7.1.0",
|
|
43
43
|
"@rollup/plugin-json": "6.1.0",
|
|
44
44
|
"@rollup/plugin-node-resolve": "16.0.3",
|
|
45
45
|
"@rollup/plugin-terser": "1.0.0",
|
|
46
46
|
c8: "11.0.0",
|
|
47
47
|
"core-js": "3.49.0",
|
|
48
48
|
"eslint-plugin-ghost": "3.5.0",
|
|
49
|
-
mocha: "11.7.
|
|
49
|
+
mocha: "11.7.6",
|
|
50
50
|
rollup: "2.80.0",
|
|
51
51
|
"rollup-plugin-commonjs": "10.1.0",
|
|
52
52
|
"rollup-plugin-polyfill-node": "0.13.0",
|
|
@@ -55,9 +55,9 @@ var devDependencies = {
|
|
|
55
55
|
sinon: "22.0.0"
|
|
56
56
|
};
|
|
57
57
|
var dependencies = {
|
|
58
|
-
axios: "1.
|
|
58
|
+
axios: "1.17.0"
|
|
59
59
|
};
|
|
60
|
-
var gitHead = "
|
|
60
|
+
var gitHead = "8cc9ae375d4851d0ea52916a5c5cd9570bb53d0b";
|
|
61
61
|
var packageInfo = {
|
|
62
62
|
name: name$1,
|
|
63
63
|
version: version,
|
package/es/content-api.js
CHANGED
|
@@ -1432,7 +1432,9 @@ function merge(...objs) {
|
|
|
1432
1432
|
return;
|
|
1433
1433
|
}
|
|
1434
1434
|
|
|
1435
|
-
|
|
1435
|
+
// findKey lowercases the key, so caseless lookup only applies to strings —
|
|
1436
|
+
// symbol keys are identity-matched.
|
|
1437
|
+
const targetKey = (caseless && typeof key === 'string' && findKey(result, key)) || key;
|
|
1436
1438
|
// Read via own-prop only — a bare `result[targetKey]` walks the prototype
|
|
1437
1439
|
// chain, so a polluted Object.prototype value could surface here and get
|
|
1438
1440
|
// copied into the merged result.
|
|
@@ -1449,7 +1451,24 @@ function merge(...objs) {
|
|
|
1449
1451
|
};
|
|
1450
1452
|
|
|
1451
1453
|
for (let i = 0, l = objs.length; i < l; i++) {
|
|
1452
|
-
|
|
1454
|
+
const source = objs[i];
|
|
1455
|
+
if (!source || isBuffer(source)) {
|
|
1456
|
+
continue;
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
forEach(source, assignValue);
|
|
1460
|
+
|
|
1461
|
+
if (typeof source !== 'object' || isArray(source)) {
|
|
1462
|
+
continue;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
const symbols = Object.getOwnPropertySymbols(source);
|
|
1466
|
+
for (let j = 0; j < symbols.length; j++) {
|
|
1467
|
+
const symbol = symbols[j];
|
|
1468
|
+
if (propertyIsEnumerable.call(source, symbol)) {
|
|
1469
|
+
assignValue(source[symbol], symbol);
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1453
1472
|
}
|
|
1454
1473
|
return result;
|
|
1455
1474
|
}
|
|
@@ -1678,6 +1697,8 @@ const hasOwnProperty = (
|
|
|
1678
1697
|
hasOwnProperty.call(obj, prop)
|
|
1679
1698
|
)(Object.prototype);
|
|
1680
1699
|
|
|
1700
|
+
const { propertyIsEnumerable } = Object.prototype;
|
|
1701
|
+
|
|
1681
1702
|
/**
|
|
1682
1703
|
* Determine if a value is a RegExp object
|
|
1683
1704
|
*
|
|
@@ -1783,11 +1804,11 @@ function isSpecCompliantForm(thing) {
|
|
|
1783
1804
|
* @returns {Object} The JSON-compatible object.
|
|
1784
1805
|
*/
|
|
1785
1806
|
const toJSONObject = (obj) => {
|
|
1786
|
-
const
|
|
1807
|
+
const visited = new WeakSet();
|
|
1787
1808
|
|
|
1788
|
-
const visit = (source
|
|
1809
|
+
const visit = (source) => {
|
|
1789
1810
|
if (isObject(source)) {
|
|
1790
|
-
if (
|
|
1811
|
+
if (visited.has(source)) {
|
|
1791
1812
|
return;
|
|
1792
1813
|
}
|
|
1793
1814
|
|
|
@@ -1797,15 +1818,16 @@ const toJSONObject = (obj) => {
|
|
|
1797
1818
|
}
|
|
1798
1819
|
|
|
1799
1820
|
if (!('toJSON' in source)) {
|
|
1800
|
-
|
|
1821
|
+
// add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
|
|
1822
|
+
visited.add(source);
|
|
1801
1823
|
const target = isArray(source) ? [] : {};
|
|
1802
1824
|
|
|
1803
1825
|
forEach(source, (value, key) => {
|
|
1804
|
-
const reducedValue = visit(value
|
|
1826
|
+
const reducedValue = visit(value);
|
|
1805
1827
|
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
1806
1828
|
});
|
|
1807
1829
|
|
|
1808
|
-
|
|
1830
|
+
visited.delete(source);
|
|
1809
1831
|
|
|
1810
1832
|
return target;
|
|
1811
1833
|
}
|
|
@@ -1814,7 +1836,7 @@ const toJSONObject = (obj) => {
|
|
|
1814
1836
|
return source;
|
|
1815
1837
|
};
|
|
1816
1838
|
|
|
1817
|
-
return visit(obj
|
|
1839
|
+
return visit(obj);
|
|
1818
1840
|
};
|
|
1819
1841
|
|
|
1820
1842
|
/**
|
|
@@ -2016,10 +2038,6 @@ var parseHeaders = (rawHeaders) => {
|
|
|
2016
2038
|
return parsed;
|
|
2017
2039
|
};
|
|
2018
2040
|
|
|
2019
|
-
const $internals = Symbol('internals');
|
|
2020
|
-
|
|
2021
|
-
const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
|
|
2022
|
-
|
|
2023
2041
|
function trimSPorHTAB(str) {
|
|
2024
2042
|
let start = 0;
|
|
2025
2043
|
let end = str.length;
|
|
@@ -2047,12 +2065,40 @@ function trimSPorHTAB(str) {
|
|
|
2047
2065
|
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
2048
2066
|
}
|
|
2049
2067
|
|
|
2050
|
-
|
|
2051
|
-
|
|
2068
|
+
// The control-code ranges are intentional: header sanitization strips C0/DEL bytes.
|
|
2069
|
+
// eslint-disable-next-line no-control-regex
|
|
2070
|
+
const INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp('[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+', 'g');
|
|
2071
|
+
// eslint-disable-next-line no-control-regex
|
|
2072
|
+
const INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp('[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+', 'g');
|
|
2073
|
+
|
|
2074
|
+
function sanitizeValue(value, invalidChars) {
|
|
2075
|
+
if (utils$1.isArray(value)) {
|
|
2076
|
+
return value.map((item) => sanitizeValue(item, invalidChars));
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
return trimSPorHTAB(String(value).replace(invalidChars, ''));
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
const sanitizeHeaderValue = (value) =>
|
|
2083
|
+
sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
|
|
2084
|
+
|
|
2085
|
+
const sanitizeByteStringHeaderValue = (value) =>
|
|
2086
|
+
sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
|
|
2087
|
+
|
|
2088
|
+
function toByteStringHeaderObject(headers) {
|
|
2089
|
+
const byteStringHeaders = Object.create(null);
|
|
2090
|
+
|
|
2091
|
+
utils$1.forEach(headers.toJSON(), (value, header) => {
|
|
2092
|
+
byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
|
|
2093
|
+
});
|
|
2094
|
+
|
|
2095
|
+
return byteStringHeaders;
|
|
2052
2096
|
}
|
|
2053
2097
|
|
|
2054
|
-
|
|
2055
|
-
|
|
2098
|
+
const $internals = Symbol('internals');
|
|
2099
|
+
|
|
2100
|
+
function normalizeHeader(header) {
|
|
2101
|
+
return header && String(header).trim().toLowerCase();
|
|
2056
2102
|
}
|
|
2057
2103
|
|
|
2058
2104
|
function normalizeValue(value) {
|
|
@@ -2134,7 +2180,7 @@ class AxiosHeaders {
|
|
|
2134
2180
|
const lHeader = normalizeHeader(_header);
|
|
2135
2181
|
|
|
2136
2182
|
if (!lHeader) {
|
|
2137
|
-
|
|
2183
|
+
return;
|
|
2138
2184
|
}
|
|
2139
2185
|
|
|
2140
2186
|
const key = utils$1.findKey(self, lHeader);
|
|
@@ -2162,7 +2208,7 @@ class AxiosHeaders {
|
|
|
2162
2208
|
key;
|
|
2163
2209
|
for (const entry of header) {
|
|
2164
2210
|
if (!utils$1.isArray(entry)) {
|
|
2165
|
-
throw TypeError('Object iterator must return a key-value pair');
|
|
2211
|
+
throw new TypeError('Object iterator must return a key-value pair');
|
|
2166
2212
|
}
|
|
2167
2213
|
|
|
2168
2214
|
obj[(key = entry[0])] = (dest = obj[key])
|
|
@@ -2781,7 +2827,7 @@ function toFormData(obj, formData, options) {
|
|
|
2781
2827
|
}
|
|
2782
2828
|
|
|
2783
2829
|
if (stack.indexOf(value) !== -1) {
|
|
2784
|
-
throw Error('Circular reference detected in ' + path.join('.'));
|
|
2830
|
+
throw new Error('Circular reference detected in ' + path.join('.'));
|
|
2785
2831
|
}
|
|
2786
2832
|
|
|
2787
2833
|
stack.push(value);
|
|
@@ -3000,6 +3046,7 @@ var transitionalDefaults = {
|
|
|
3000
3046
|
forcedJSONParsing: true,
|
|
3001
3047
|
clarifyTimeoutError: false,
|
|
3002
3048
|
legacyInterceptorReqResOrdering: true,
|
|
3049
|
+
advertiseZstdAcceptEncoding: false,
|
|
3003
3050
|
};
|
|
3004
3051
|
|
|
3005
3052
|
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
@@ -3157,7 +3204,7 @@ function formDataToJSON(formData) {
|
|
|
3157
3204
|
return !isNumericKey;
|
|
3158
3205
|
}
|
|
3159
3206
|
|
|
3160
|
-
if (!target
|
|
3207
|
+
if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
|
|
3161
3208
|
target[name] = [];
|
|
3162
3209
|
}
|
|
3163
3210
|
|
|
@@ -3526,6 +3573,9 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
3526
3573
|
const _speedometer = speedometer(50, 250);
|
|
3527
3574
|
|
|
3528
3575
|
return throttle((e) => {
|
|
3576
|
+
if (!e || typeof e.loaded !== 'number') {
|
|
3577
|
+
return;
|
|
3578
|
+
}
|
|
3529
3579
|
const rawLoaded = e.loaded;
|
|
3530
3580
|
const total = e.lengthComputable ? e.total : undefined;
|
|
3531
3581
|
const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
|
|
@@ -3835,12 +3885,12 @@ function setFormDataHeaders(headers, formHeaders, policy) {
|
|
|
3835
3885
|
*
|
|
3836
3886
|
* @returns {string} UTF-8 bytes as a Latin-1 string
|
|
3837
3887
|
*/
|
|
3838
|
-
const encodeUTF8 = (str) =>
|
|
3888
|
+
const encodeUTF8$1 = (str) =>
|
|
3839
3889
|
encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
|
|
3840
3890
|
String.fromCharCode(parseInt(hex, 16))
|
|
3841
3891
|
);
|
|
3842
3892
|
|
|
3843
|
-
|
|
3893
|
+
function resolveConfig(config) {
|
|
3844
3894
|
const newConfig = mergeConfig({}, config);
|
|
3845
3895
|
|
|
3846
3896
|
// Read only own properties to prevent prototype pollution gadgets
|
|
@@ -3861,8 +3911,8 @@ var resolveConfig = (config) => {
|
|
|
3861
3911
|
|
|
3862
3912
|
newConfig.url = buildURL(
|
|
3863
3913
|
buildFullPath(baseURL, url, allowAbsoluteUrls),
|
|
3864
|
-
|
|
3865
|
-
|
|
3914
|
+
own('params'),
|
|
3915
|
+
own('paramsSerializer')
|
|
3866
3916
|
);
|
|
3867
3917
|
|
|
3868
3918
|
// HTTP basic authentication
|
|
@@ -3870,13 +3920,17 @@ var resolveConfig = (config) => {
|
|
|
3870
3920
|
headers.set(
|
|
3871
3921
|
'Authorization',
|
|
3872
3922
|
'Basic ' +
|
|
3873
|
-
btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : ''))
|
|
3923
|
+
btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8$1(auth.password) : ''))
|
|
3874
3924
|
);
|
|
3875
3925
|
}
|
|
3876
3926
|
|
|
3877
3927
|
if (utils$1.isFormData(data)) {
|
|
3878
|
-
if (
|
|
3879
|
-
|
|
3928
|
+
if (
|
|
3929
|
+
platform.hasStandardBrowserEnv ||
|
|
3930
|
+
platform.hasStandardBrowserWebWorkerEnv ||
|
|
3931
|
+
utils$1.isReactNative(data)
|
|
3932
|
+
) {
|
|
3933
|
+
headers.setContentType(undefined); // browser/web worker/RN handles it
|
|
3880
3934
|
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
3881
3935
|
// Node.js FormData (like form-data package)
|
|
3882
3936
|
setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
|
|
@@ -3908,7 +3962,7 @@ var resolveConfig = (config) => {
|
|
|
3908
3962
|
}
|
|
3909
3963
|
|
|
3910
3964
|
return newConfig;
|
|
3911
|
-
}
|
|
3965
|
+
}
|
|
3912
3966
|
|
|
3913
3967
|
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
3914
3968
|
|
|
@@ -4057,7 +4111,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
4057
4111
|
|
|
4058
4112
|
// Add headers to the request
|
|
4059
4113
|
if ('setRequestHeader' in request) {
|
|
4060
|
-
utils$1.forEach(requestHeaders
|
|
4114
|
+
utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
|
|
4061
4115
|
request.setRequestHeader(key, val);
|
|
4062
4116
|
});
|
|
4063
4117
|
}
|
|
@@ -4127,54 +4181,55 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
4127
4181
|
};
|
|
4128
4182
|
|
|
4129
4183
|
const composeSignals = (signals, timeout) => {
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
if (timeout || length) {
|
|
4133
|
-
let controller = new AbortController();
|
|
4134
|
-
|
|
4135
|
-
let aborted;
|
|
4136
|
-
|
|
4137
|
-
const onabort = function (reason) {
|
|
4138
|
-
if (!aborted) {
|
|
4139
|
-
aborted = true;
|
|
4140
|
-
unsubscribe();
|
|
4141
|
-
const err = reason instanceof Error ? reason : this.reason;
|
|
4142
|
-
controller.abort(
|
|
4143
|
-
err instanceof AxiosError$1
|
|
4144
|
-
? err
|
|
4145
|
-
: new CanceledError$1(err instanceof Error ? err.message : err)
|
|
4146
|
-
);
|
|
4147
|
-
}
|
|
4148
|
-
};
|
|
4184
|
+
signals = signals ? signals.filter(Boolean) : [];
|
|
4149
4185
|
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
const unsubscribe = () => {
|
|
4158
|
-
if (signals) {
|
|
4159
|
-
timer && clearTimeout(timer);
|
|
4160
|
-
timer = null;
|
|
4161
|
-
signals.forEach((signal) => {
|
|
4162
|
-
signal.unsubscribe
|
|
4163
|
-
? signal.unsubscribe(onabort)
|
|
4164
|
-
: signal.removeEventListener('abort', onabort);
|
|
4165
|
-
});
|
|
4166
|
-
signals = null;
|
|
4167
|
-
}
|
|
4168
|
-
};
|
|
4186
|
+
if (!timeout && !signals.length) {
|
|
4187
|
+
return;
|
|
4188
|
+
}
|
|
4189
|
+
|
|
4190
|
+
const controller = new AbortController();
|
|
4191
|
+
|
|
4192
|
+
let aborted = false;
|
|
4169
4193
|
|
|
4170
|
-
|
|
4194
|
+
const onabort = function (reason) {
|
|
4195
|
+
if (!aborted) {
|
|
4196
|
+
aborted = true;
|
|
4197
|
+
unsubscribe();
|
|
4198
|
+
const err = reason instanceof Error ? reason : this.reason;
|
|
4199
|
+
controller.abort(
|
|
4200
|
+
err instanceof AxiosError$1
|
|
4201
|
+
? err
|
|
4202
|
+
: new CanceledError$1(err instanceof Error ? err.message : err)
|
|
4203
|
+
);
|
|
4204
|
+
}
|
|
4205
|
+
};
|
|
4206
|
+
|
|
4207
|
+
let timer =
|
|
4208
|
+
timeout &&
|
|
4209
|
+
setTimeout(() => {
|
|
4210
|
+
timer = null;
|
|
4211
|
+
onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
4212
|
+
}, timeout);
|
|
4213
|
+
|
|
4214
|
+
const unsubscribe = () => {
|
|
4215
|
+
if (!signals) { return; }
|
|
4216
|
+
timer && clearTimeout(timer);
|
|
4217
|
+
timer = null;
|
|
4218
|
+
signals.forEach((signal) => {
|
|
4219
|
+
signal.unsubscribe
|
|
4220
|
+
? signal.unsubscribe(onabort)
|
|
4221
|
+
: signal.removeEventListener('abort', onabort);
|
|
4222
|
+
});
|
|
4223
|
+
signals = null;
|
|
4224
|
+
};
|
|
4171
4225
|
|
|
4172
|
-
|
|
4226
|
+
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
|
4173
4227
|
|
|
4174
|
-
|
|
4228
|
+
const { signal } = controller;
|
|
4175
4229
|
|
|
4176
|
-
|
|
4177
|
-
|
|
4230
|
+
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
4231
|
+
|
|
4232
|
+
return signal;
|
|
4178
4233
|
};
|
|
4179
4234
|
|
|
4180
4235
|
var composeSignals$1 = composeSignals;
|
|
@@ -4370,12 +4425,41 @@ function estimateDataURLDecodedBytes(url) {
|
|
|
4370
4425
|
return bytes;
|
|
4371
4426
|
}
|
|
4372
4427
|
|
|
4373
|
-
const VERSION = "1.
|
|
4428
|
+
const VERSION = "1.17.0";
|
|
4374
4429
|
|
|
4375
4430
|
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
4376
4431
|
|
|
4377
4432
|
const { isFunction } = utils$1;
|
|
4378
4433
|
|
|
4434
|
+
/**
|
|
4435
|
+
* Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
|
|
4436
|
+
* This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
|
|
4437
|
+
*
|
|
4438
|
+
* @param {string} str The string to encode
|
|
4439
|
+
*
|
|
4440
|
+
* @returns {string} UTF-8 bytes as a Latin-1 string
|
|
4441
|
+
*/
|
|
4442
|
+
const encodeUTF8 = (str) =>
|
|
4443
|
+
encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
|
|
4444
|
+
String.fromCharCode(parseInt(hex, 16))
|
|
4445
|
+
);
|
|
4446
|
+
|
|
4447
|
+
// Node's WHATWG URL parser returns `username` and `password` percent-encoded.
|
|
4448
|
+
// Decode before composing the `auth` option so credentials such as
|
|
4449
|
+
// `my%40email.com:pass` are sent as `my@email.com:pass`. Falls back to the
|
|
4450
|
+
// original value for malformed input so a bad encoding never throws.
|
|
4451
|
+
const decodeURIComponentSafe = (value) => {
|
|
4452
|
+
if (!utils$1.isString(value)) {
|
|
4453
|
+
return value;
|
|
4454
|
+
}
|
|
4455
|
+
|
|
4456
|
+
try {
|
|
4457
|
+
return decodeURIComponent(value);
|
|
4458
|
+
} catch (error) {
|
|
4459
|
+
return value;
|
|
4460
|
+
}
|
|
4461
|
+
};
|
|
4462
|
+
|
|
4379
4463
|
const test = (fn, ...args) => {
|
|
4380
4464
|
try {
|
|
4381
4465
|
return !!fn(...args);
|
|
@@ -4384,8 +4468,20 @@ const test = (fn, ...args) => {
|
|
|
4384
4468
|
}
|
|
4385
4469
|
};
|
|
4386
4470
|
|
|
4471
|
+
const maybeWithAuthCredentials = (url) => {
|
|
4472
|
+
const protocolIndex = url.indexOf('://');
|
|
4473
|
+
let urlToCheck = url;
|
|
4474
|
+
if (protocolIndex !== -1) {
|
|
4475
|
+
urlToCheck = urlToCheck.slice(protocolIndex + 3);
|
|
4476
|
+
}
|
|
4477
|
+
return urlToCheck.includes('@') || urlToCheck.includes(':');
|
|
4478
|
+
};
|
|
4479
|
+
|
|
4387
4480
|
const factory = (env) => {
|
|
4388
|
-
const globalObject =
|
|
4481
|
+
const globalObject =
|
|
4482
|
+
utils$1.global !== undefined && utils$1.global !== null
|
|
4483
|
+
? utils$1.global
|
|
4484
|
+
: globalThis;
|
|
4389
4485
|
const { ReadableStream, TextEncoder } = globalObject;
|
|
4390
4486
|
|
|
4391
4487
|
env = utils$1.merge.call(
|
|
@@ -4528,6 +4624,7 @@ const factory = (env) => {
|
|
|
4528
4624
|
|
|
4529
4625
|
const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
|
|
4530
4626
|
const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
|
|
4627
|
+
const own = (key) => (utils$1.hasOwnProp(config, key) ? config[key] : undefined);
|
|
4531
4628
|
|
|
4532
4629
|
let _fetch = envFetch || fetch;
|
|
4533
4630
|
|
|
@@ -4550,6 +4647,46 @@ const factory = (env) => {
|
|
|
4550
4647
|
let requestContentLength;
|
|
4551
4648
|
|
|
4552
4649
|
try {
|
|
4650
|
+
// HTTP basic authentication
|
|
4651
|
+
let auth = undefined;
|
|
4652
|
+
const configAuth = own('auth');
|
|
4653
|
+
|
|
4654
|
+
if (configAuth) {
|
|
4655
|
+
const username = configAuth.username || '';
|
|
4656
|
+
const password = configAuth.password || '';
|
|
4657
|
+
auth = {
|
|
4658
|
+
username,
|
|
4659
|
+
password
|
|
4660
|
+
};
|
|
4661
|
+
}
|
|
4662
|
+
|
|
4663
|
+
if (maybeWithAuthCredentials(url)) {
|
|
4664
|
+
const parsedURL = new URL(url, platform.origin);
|
|
4665
|
+
|
|
4666
|
+
if (!auth && (parsedURL.username || parsedURL.password)) {
|
|
4667
|
+
const urlUsername = decodeURIComponentSafe(parsedURL.username);
|
|
4668
|
+
const urlPassword = decodeURIComponentSafe(parsedURL.password);
|
|
4669
|
+
auth = {
|
|
4670
|
+
username: urlUsername,
|
|
4671
|
+
password: urlPassword
|
|
4672
|
+
};
|
|
4673
|
+
}
|
|
4674
|
+
|
|
4675
|
+
if (parsedURL.username || parsedURL.password) {
|
|
4676
|
+
parsedURL.username = '';
|
|
4677
|
+
parsedURL.password = '';
|
|
4678
|
+
url = parsedURL.href;
|
|
4679
|
+
}
|
|
4680
|
+
}
|
|
4681
|
+
|
|
4682
|
+
if (auth) {
|
|
4683
|
+
headers.delete('authorization');
|
|
4684
|
+
headers.set(
|
|
4685
|
+
'Authorization',
|
|
4686
|
+
'Basic ' + btoa(encodeUTF8((auth.username || '') + ':' + (auth.password || '')))
|
|
4687
|
+
);
|
|
4688
|
+
}
|
|
4689
|
+
|
|
4553
4690
|
// Enforce maxContentLength for data: URLs up-front so we never materialize
|
|
4554
4691
|
// an oversized payload. The HTTP adapter applies the same check (see http.js
|
|
4555
4692
|
// "if (protocol === 'data:')" branch).
|
|
@@ -4642,7 +4779,7 @@ const factory = (env) => {
|
|
|
4642
4779
|
...fetchOptions,
|
|
4643
4780
|
signal: composedSignal,
|
|
4644
4781
|
method: method.toUpperCase(),
|
|
4645
|
-
headers: headers.normalize()
|
|
4782
|
+
headers: toByteStringHeaderObject(headers.normalize()),
|
|
4646
4783
|
body: data,
|
|
4647
4784
|
duplex: 'half',
|
|
4648
4785
|
credentials: isCredentialsSupported ? withCredentials : undefined,
|
|
@@ -5231,6 +5368,7 @@ class Axios {
|
|
|
5231
5368
|
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
5232
5369
|
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
5233
5370
|
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
|
|
5371
|
+
advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
|
|
5234
5372
|
},
|
|
5235
5373
|
false
|
|
5236
5374
|
);
|
|
@@ -5727,7 +5865,7 @@ axios.default = axios;
|
|
|
5727
5865
|
var axios$1 = axios;
|
|
5728
5866
|
|
|
5729
5867
|
var name$1 = "@tryghost/content-api";
|
|
5730
|
-
var version = "1.12.
|
|
5868
|
+
var version = "1.12.9";
|
|
5731
5869
|
var repository = {
|
|
5732
5870
|
type: "git",
|
|
5733
5871
|
url: "git+https://github.com/TryGhost/SDK.git",
|
|
@@ -5760,17 +5898,17 @@ var publishConfig = {
|
|
|
5760
5898
|
access: "public"
|
|
5761
5899
|
};
|
|
5762
5900
|
var devDependencies = {
|
|
5763
|
-
"@babel/core": "7.29.
|
|
5901
|
+
"@babel/core": "7.29.7",
|
|
5764
5902
|
"@babel/polyfill": "7.12.1",
|
|
5765
|
-
"@babel/preset-env": "7.29.
|
|
5766
|
-
"@rollup/plugin-babel": "7.
|
|
5903
|
+
"@babel/preset-env": "7.29.7",
|
|
5904
|
+
"@rollup/plugin-babel": "7.1.0",
|
|
5767
5905
|
"@rollup/plugin-json": "6.1.0",
|
|
5768
5906
|
"@rollup/plugin-node-resolve": "16.0.3",
|
|
5769
5907
|
"@rollup/plugin-terser": "1.0.0",
|
|
5770
5908
|
c8: "11.0.0",
|
|
5771
5909
|
"core-js": "3.49.0",
|
|
5772
5910
|
"eslint-plugin-ghost": "3.5.0",
|
|
5773
|
-
mocha: "11.7.
|
|
5911
|
+
mocha: "11.7.6",
|
|
5774
5912
|
rollup: "2.80.0",
|
|
5775
5913
|
"rollup-plugin-commonjs": "10.1.0",
|
|
5776
5914
|
"rollup-plugin-polyfill-node": "0.13.0",
|
|
@@ -5779,9 +5917,9 @@ var devDependencies = {
|
|
|
5779
5917
|
sinon: "22.0.0"
|
|
5780
5918
|
};
|
|
5781
5919
|
var dependencies = {
|
|
5782
|
-
axios: "1.
|
|
5920
|
+
axios: "1.17.0"
|
|
5783
5921
|
};
|
|
5784
|
-
var gitHead = "
|
|
5922
|
+
var gitHead = "8cc9ae375d4851d0ea52916a5c5cd9570bb53d0b";
|
|
5785
5923
|
var packageInfo = {
|
|
5786
5924
|
name: name$1,
|
|
5787
5925
|
version: version,
|