@posty5/social-publisher-post 4.1.0 → 4.2.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 +231 -15
- package/dist/index.d.mts +695 -54
- package/dist/index.d.ts +695 -54
- package/dist/index.js +1364 -194
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1356 -195
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -12067,22 +12067,82 @@ var { toString } = Object.prototype;
|
|
|
12067
12067
|
var { getPrototypeOf } = Object;
|
|
12068
12068
|
var { iterator, toStringTag } = Symbol;
|
|
12069
12069
|
var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
|
|
12070
|
+
var isUnsafeObjectKey = (prop) => typeof prop === "string" && (prop === "__proto__" || prop === "constructor" || prop === "prototype");
|
|
12071
|
+
var isPrototypeBoundary = (obj, prototype2, source) => obj === Object.prototype || !source && prototype2 === null;
|
|
12072
|
+
var isSafeAndFullyMutable = (obj) => {
|
|
12073
|
+
if (!Object.isExtensible(obj)) {
|
|
12074
|
+
return false;
|
|
12075
|
+
}
|
|
12076
|
+
const props = Object.getOwnPropertyNames(obj);
|
|
12077
|
+
if (Object.getOwnPropertySymbols) {
|
|
12078
|
+
props.push(...Object.getOwnPropertySymbols(obj));
|
|
12079
|
+
}
|
|
12080
|
+
return props.every((prop) => {
|
|
12081
|
+
if (isUnsafeObjectKey(prop)) {
|
|
12082
|
+
return false;
|
|
12083
|
+
}
|
|
12084
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
12085
|
+
return !!descriptor && descriptor.configurable && descriptor.writable === true;
|
|
12086
|
+
});
|
|
12087
|
+
};
|
|
12070
12088
|
var hasOwnInPrototypeChain = (thing, prop) => {
|
|
12071
12089
|
let obj = thing;
|
|
12072
12090
|
const seen = [];
|
|
12073
|
-
while (obj != null
|
|
12091
|
+
while (obj != null) {
|
|
12074
12092
|
if (seen.indexOf(obj) !== -1) {
|
|
12075
12093
|
return false;
|
|
12076
12094
|
}
|
|
12077
12095
|
seen.push(obj);
|
|
12096
|
+
const prototype2 = getPrototypeOf(obj);
|
|
12097
|
+
if (isPrototypeBoundary(obj, prototype2, obj === thing)) {
|
|
12098
|
+
return false;
|
|
12099
|
+
}
|
|
12078
12100
|
if (hasOwnProperty(obj, prop)) {
|
|
12079
12101
|
return true;
|
|
12080
12102
|
}
|
|
12081
|
-
obj =
|
|
12103
|
+
obj = prototype2;
|
|
12082
12104
|
}
|
|
12083
12105
|
return false;
|
|
12084
12106
|
};
|
|
12085
12107
|
var getSafeProp = (obj, prop) => obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : void 0;
|
|
12108
|
+
var toSafeFlatObject = (thing) => {
|
|
12109
|
+
if (thing == null || typeof thing !== "object" && typeof thing !== "function") {
|
|
12110
|
+
return thing;
|
|
12111
|
+
}
|
|
12112
|
+
const sourcePrototype = getPrototypeOf(thing);
|
|
12113
|
+
if (sourcePrototype === null && isSafeAndFullyMutable(thing)) {
|
|
12114
|
+
return thing;
|
|
12115
|
+
}
|
|
12116
|
+
const result = /* @__PURE__ */ Object.create(null);
|
|
12117
|
+
const merged = /* @__PURE__ */ Object.create(null);
|
|
12118
|
+
const seen = [];
|
|
12119
|
+
let current = thing;
|
|
12120
|
+
while (current != null) {
|
|
12121
|
+
if (seen.indexOf(current) !== -1) {
|
|
12122
|
+
break;
|
|
12123
|
+
}
|
|
12124
|
+
seen.push(current);
|
|
12125
|
+
const prototype2 = current === thing ? sourcePrototype : getPrototypeOf(current);
|
|
12126
|
+
if (isPrototypeBoundary(current, prototype2, current === thing)) {
|
|
12127
|
+
break;
|
|
12128
|
+
}
|
|
12129
|
+
const props = Object.getOwnPropertyNames(current);
|
|
12130
|
+
if (Object.getOwnPropertySymbols) {
|
|
12131
|
+
props.push(...Object.getOwnPropertySymbols(current));
|
|
12132
|
+
}
|
|
12133
|
+
for (const prop of props) {
|
|
12134
|
+
if (isUnsafeObjectKey(prop)) {
|
|
12135
|
+
continue;
|
|
12136
|
+
}
|
|
12137
|
+
if (!hasOwnProperty(merged, prop)) {
|
|
12138
|
+
result[prop] = thing[prop];
|
|
12139
|
+
merged[prop] = true;
|
|
12140
|
+
}
|
|
12141
|
+
}
|
|
12142
|
+
current = prototype2;
|
|
12143
|
+
}
|
|
12144
|
+
return result;
|
|
12145
|
+
};
|
|
12086
12146
|
var kindOf = /* @__PURE__ */ ((cache) => (thing) => {
|
|
12087
12147
|
const str = toString.call(thing);
|
|
12088
12148
|
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
@@ -12117,9 +12177,9 @@ var isPlainObject = (val) => {
|
|
|
12117
12177
|
return false;
|
|
12118
12178
|
}
|
|
12119
12179
|
const prototype2 = getPrototypeOf(val);
|
|
12120
|
-
return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat
|
|
12121
|
-
//
|
|
12122
|
-
//
|
|
12180
|
+
return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat safe own/inherited Symbol.toStringTag or Symbol.iterator members as
|
|
12181
|
+
// evidence the value is tagged/iterable, while ignoring members reachable
|
|
12182
|
+
// only through shared or terminal prototype boundaries.
|
|
12123
12183
|
!hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
|
|
12124
12184
|
};
|
|
12125
12185
|
var isEmptyObject = (val) => {
|
|
@@ -12140,6 +12200,7 @@ var isReactNativeBlob = (value) => {
|
|
|
12140
12200
|
var isReactNative = (formData) => formData && typeof formData.getParts !== "undefined";
|
|
12141
12201
|
var isBlob = kindOfTest("Blob");
|
|
12142
12202
|
var isFileList = kindOfTest("FileList");
|
|
12203
|
+
var isSet = kindOfTest("Set");
|
|
12143
12204
|
var isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
12144
12205
|
function getGlobal() {
|
|
12145
12206
|
if (typeof globalThis !== "undefined") return globalThis;
|
|
@@ -12435,11 +12496,20 @@ var toJSONObject = (obj) => {
|
|
|
12435
12496
|
}
|
|
12436
12497
|
if (!("toJSON" in source)) {
|
|
12437
12498
|
visited.add(source);
|
|
12438
|
-
|
|
12439
|
-
|
|
12440
|
-
|
|
12441
|
-
|
|
12442
|
-
|
|
12499
|
+
let target;
|
|
12500
|
+
if (isSet(source)) {
|
|
12501
|
+
target = [];
|
|
12502
|
+
for (const value of source) {
|
|
12503
|
+
const reducedValue = visit(value);
|
|
12504
|
+
!isUndefined(reducedValue) && target.push(reducedValue);
|
|
12505
|
+
}
|
|
12506
|
+
} else {
|
|
12507
|
+
target = isArray(source) ? [] : {};
|
|
12508
|
+
forEach(source, (value, key) => {
|
|
12509
|
+
const reducedValue = visit(value);
|
|
12510
|
+
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
12511
|
+
});
|
|
12512
|
+
}
|
|
12443
12513
|
visited.delete(source);
|
|
12444
12514
|
return target;
|
|
12445
12515
|
}
|
|
@@ -12520,6 +12590,7 @@ var utils_default = {
|
|
|
12520
12590
|
// an alias to avoid ESLint no-prototype-builtins detection
|
|
12521
12591
|
hasOwnInPrototypeChain,
|
|
12522
12592
|
getSafeProp,
|
|
12593
|
+
toSafeFlatObject,
|
|
12523
12594
|
reduceDescriptors,
|
|
12524
12595
|
freezeMethods,
|
|
12525
12596
|
toObjectSet,
|
|
@@ -12568,17 +12639,18 @@ var parseHeaders_default = (rawHeaders) => {
|
|
|
12568
12639
|
i = line.indexOf(":");
|
|
12569
12640
|
key = line.substring(0, i).trim().toLowerCase();
|
|
12570
12641
|
val = line.substring(i + 1).trim();
|
|
12571
|
-
|
|
12642
|
+
const hasKey = utils_default.hasOwnProp(parsed, key);
|
|
12643
|
+
if (!key || hasKey && utils_default.hasOwnProp(ignoreDuplicateOf, key)) {
|
|
12572
12644
|
return;
|
|
12573
12645
|
}
|
|
12574
12646
|
if (key === "set-cookie") {
|
|
12575
|
-
if (
|
|
12647
|
+
if (hasKey) {
|
|
12576
12648
|
parsed[key].push(val);
|
|
12577
12649
|
} else {
|
|
12578
12650
|
parsed[key] = [val];
|
|
12579
12651
|
}
|
|
12580
12652
|
} else {
|
|
12581
|
-
parsed[key] =
|
|
12653
|
+
parsed[key] = hasKey ? parsed[key] + ", " + val : val;
|
|
12582
12654
|
}
|
|
12583
12655
|
});
|
|
12584
12656
|
return parsed;
|
|
@@ -12642,6 +12714,90 @@ function parseTokens(str) {
|
|
|
12642
12714
|
}
|
|
12643
12715
|
return tokens;
|
|
12644
12716
|
}
|
|
12717
|
+
var parameterNameRE = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
12718
|
+
function trimOWS(value) {
|
|
12719
|
+
let start = 0;
|
|
12720
|
+
let end = value.length;
|
|
12721
|
+
while (start < end) {
|
|
12722
|
+
const code = value.charCodeAt(start);
|
|
12723
|
+
if (code !== 9 && code !== 32) {
|
|
12724
|
+
break;
|
|
12725
|
+
}
|
|
12726
|
+
start += 1;
|
|
12727
|
+
}
|
|
12728
|
+
while (end > start) {
|
|
12729
|
+
const code = value.charCodeAt(end - 1);
|
|
12730
|
+
if (code !== 9 && code !== 32) {
|
|
12731
|
+
break;
|
|
12732
|
+
}
|
|
12733
|
+
end -= 1;
|
|
12734
|
+
}
|
|
12735
|
+
return start === 0 && end === value.length ? value : value.slice(start, end);
|
|
12736
|
+
}
|
|
12737
|
+
function decodeQuotedString(value) {
|
|
12738
|
+
const last = value.length - 1;
|
|
12739
|
+
if (last < 1 || value.charCodeAt(0) !== 34 || value.charCodeAt(last) !== 34) {
|
|
12740
|
+
return value;
|
|
12741
|
+
}
|
|
12742
|
+
let decoded = "";
|
|
12743
|
+
for (let i = 1; i < last; i++) {
|
|
12744
|
+
const code = value.charCodeAt(i);
|
|
12745
|
+
if (code === 34) {
|
|
12746
|
+
return value;
|
|
12747
|
+
}
|
|
12748
|
+
if (code === 92) {
|
|
12749
|
+
i += 1;
|
|
12750
|
+
if (i >= last) {
|
|
12751
|
+
return value;
|
|
12752
|
+
}
|
|
12753
|
+
}
|
|
12754
|
+
decoded += value[i];
|
|
12755
|
+
}
|
|
12756
|
+
return decoded;
|
|
12757
|
+
}
|
|
12758
|
+
function parseParameters(value) {
|
|
12759
|
+
const parameters = /* @__PURE__ */ Object.create(null);
|
|
12760
|
+
const str = String(value);
|
|
12761
|
+
let start = 0;
|
|
12762
|
+
let quoted = false;
|
|
12763
|
+
let escaped = false;
|
|
12764
|
+
function parseParameter(end) {
|
|
12765
|
+
const part = trimOWS(str.slice(start, end));
|
|
12766
|
+
const equals = part.indexOf("=");
|
|
12767
|
+
if (equals < 1) {
|
|
12768
|
+
return;
|
|
12769
|
+
}
|
|
12770
|
+
const name = trimOWS(part.slice(0, equals));
|
|
12771
|
+
if (!parameterNameRE.test(name)) {
|
|
12772
|
+
return;
|
|
12773
|
+
}
|
|
12774
|
+
const normalizedName = name.toLowerCase();
|
|
12775
|
+
if (normalizedName === "__proto__" || normalizedName === "constructor" || normalizedName === "prototype") {
|
|
12776
|
+
return;
|
|
12777
|
+
}
|
|
12778
|
+
const parameterValue = trimOWS(part.slice(equals + 1));
|
|
12779
|
+
parameters[normalizedName] = decodeQuotedString(parameterValue);
|
|
12780
|
+
}
|
|
12781
|
+
for (let i = 0; i < str.length; i++) {
|
|
12782
|
+
const code = str.charCodeAt(i);
|
|
12783
|
+
if (quoted) {
|
|
12784
|
+
if (escaped) {
|
|
12785
|
+
escaped = false;
|
|
12786
|
+
} else if (code === 92) {
|
|
12787
|
+
escaped = true;
|
|
12788
|
+
} else if (code === 34) {
|
|
12789
|
+
quoted = false;
|
|
12790
|
+
}
|
|
12791
|
+
} else if (code === 34) {
|
|
12792
|
+
quoted = true;
|
|
12793
|
+
} else if (code === 44 || code === 59) {
|
|
12794
|
+
parseParameter(i);
|
|
12795
|
+
start = i + 1;
|
|
12796
|
+
}
|
|
12797
|
+
}
|
|
12798
|
+
parseParameter(str.length);
|
|
12799
|
+
return parameters;
|
|
12800
|
+
}
|
|
12645
12801
|
var isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
12646
12802
|
function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
|
|
12647
12803
|
if (utils_default.isFunction(filter2)) {
|
|
@@ -12817,7 +12973,8 @@ var AxiosHeaders = class {
|
|
|
12817
12973
|
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
|
|
12818
12974
|
}
|
|
12819
12975
|
getSetCookie() {
|
|
12820
|
-
|
|
12976
|
+
const value = this.get("set-cookie");
|
|
12977
|
+
return utils_default.isArray(value) ? value : value == null || value === false ? [] : [value];
|
|
12821
12978
|
}
|
|
12822
12979
|
get [Symbol.toStringTag]() {
|
|
12823
12980
|
return "AxiosHeaders";
|
|
@@ -12825,6 +12982,9 @@ var AxiosHeaders = class {
|
|
|
12825
12982
|
static from(thing) {
|
|
12826
12983
|
return thing instanceof this ? thing : new this(thing);
|
|
12827
12984
|
}
|
|
12985
|
+
static parseParameters(value) {
|
|
12986
|
+
return parseParameters(value);
|
|
12987
|
+
}
|
|
12828
12988
|
static concat(first, ...targets) {
|
|
12829
12989
|
const computed = new this(first);
|
|
12830
12990
|
targets.forEach((target) => computed.set(target));
|
|
@@ -12920,9 +13080,30 @@ function redactConfig(config, redactKeys) {
|
|
|
12920
13080
|
};
|
|
12921
13081
|
return visit(config);
|
|
12922
13082
|
}
|
|
13083
|
+
function stringifySafely(value) {
|
|
13084
|
+
try {
|
|
13085
|
+
return String(value);
|
|
13086
|
+
} catch (err) {
|
|
13087
|
+
return "";
|
|
13088
|
+
}
|
|
13089
|
+
}
|
|
13090
|
+
function aggregateErrorMessage(error) {
|
|
13091
|
+
const message = error.errors.map((entry) => {
|
|
13092
|
+
try {
|
|
13093
|
+
return entry && entry.message ? stringifySafely(entry.message) : stringifySafely(entry);
|
|
13094
|
+
} catch (err) {
|
|
13095
|
+
return "";
|
|
13096
|
+
}
|
|
13097
|
+
}).filter(Boolean).join("; ");
|
|
13098
|
+
return message || error.name || "AggregateError";
|
|
13099
|
+
}
|
|
12923
13100
|
var AxiosError = class _AxiosError extends Error {
|
|
12924
13101
|
static from(error, code, config, request, response, customProps) {
|
|
12925
|
-
|
|
13102
|
+
let message = error.message;
|
|
13103
|
+
if (!message && utils_default.isArray(error.errors) && error.errors.length) {
|
|
13104
|
+
message = aggregateErrorMessage(error);
|
|
13105
|
+
}
|
|
13106
|
+
const axiosError = new _AxiosError(message, code || error.code, config, request, response);
|
|
12926
13107
|
Object.defineProperty(axiosError, "cause", {
|
|
12927
13108
|
__proto__: null,
|
|
12928
13109
|
value: error,
|
|
@@ -13012,6 +13193,16 @@ var AxiosError_default = AxiosError;
|
|
|
13012
13193
|
var import_form_data = __toESM(require_form_data());
|
|
13013
13194
|
var FormData_default = import_form_data.default;
|
|
13014
13195
|
|
|
13196
|
+
// ../node_modules/axios/lib/platform/node/classes/Buffer.js
|
|
13197
|
+
var Buffer_default = {
|
|
13198
|
+
isBufferAvailable() {
|
|
13199
|
+
return typeof Buffer !== "undefined";
|
|
13200
|
+
},
|
|
13201
|
+
from(value) {
|
|
13202
|
+
return Buffer.from(value);
|
|
13203
|
+
}
|
|
13204
|
+
};
|
|
13205
|
+
|
|
13015
13206
|
// ../node_modules/axios/lib/helpers/toFormData.js
|
|
13016
13207
|
var DEFAULT_FORM_DATA_MAX_DEPTH = 100;
|
|
13017
13208
|
function isVisitable(thing) {
|
|
@@ -13038,24 +13229,16 @@ function toFormData(obj, formData, options) {
|
|
|
13038
13229
|
throw new TypeError("target must be an object");
|
|
13039
13230
|
}
|
|
13040
13231
|
formData = formData || new (FormData_default || FormData)();
|
|
13041
|
-
|
|
13042
|
-
options,
|
|
13043
|
-
|
|
13044
|
-
|
|
13045
|
-
|
|
13046
|
-
|
|
13047
|
-
|
|
13048
|
-
|
|
13049
|
-
|
|
13050
|
-
|
|
13051
|
-
}
|
|
13052
|
-
);
|
|
13053
|
-
const metaTokens = options.metaTokens;
|
|
13054
|
-
const visitor = options.visitor || defaultVisitor;
|
|
13055
|
-
const dots = options.dots;
|
|
13056
|
-
const indexes = options.indexes;
|
|
13057
|
-
const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
|
|
13058
|
-
const maxDepth = options.maxDepth === void 0 ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
|
|
13232
|
+
const option = (name, fallback) => {
|
|
13233
|
+
const value = utils_default.getSafeProp(options, name);
|
|
13234
|
+
return utils_default.isUndefined(value) ? fallback : value;
|
|
13235
|
+
};
|
|
13236
|
+
const metaTokens = option("metaTokens", true);
|
|
13237
|
+
const visitor = option("visitor") || defaultVisitor;
|
|
13238
|
+
const dots = option("dots", false);
|
|
13239
|
+
const indexes = option("indexes", false);
|
|
13240
|
+
const _Blob = option("Blob") || typeof Blob !== "undefined" && Blob;
|
|
13241
|
+
const maxDepth = option("maxDepth", DEFAULT_FORM_DATA_MAX_DEPTH);
|
|
13059
13242
|
const useBlob = _Blob && utils_default.isSpecCompliantForm(formData);
|
|
13060
13243
|
const stack = [];
|
|
13061
13244
|
if (!utils_default.isFunction(visitor)) {
|
|
@@ -13076,10 +13259,13 @@ function toFormData(obj, formData, options) {
|
|
|
13076
13259
|
if (useBlob && typeof _Blob === "function") {
|
|
13077
13260
|
return new _Blob([value]);
|
|
13078
13261
|
}
|
|
13079
|
-
if (
|
|
13080
|
-
return
|
|
13262
|
+
if (Buffer_default && Buffer_default.isBufferAvailable()) {
|
|
13263
|
+
return Buffer_default.from(value);
|
|
13081
13264
|
}
|
|
13082
|
-
throw new AxiosError_default(
|
|
13265
|
+
throw new AxiosError_default(
|
|
13266
|
+
"Blob is not supported. Use a Buffer instead.",
|
|
13267
|
+
AxiosError_default.ERR_NOT_SUPPORT
|
|
13268
|
+
);
|
|
13083
13269
|
}
|
|
13084
13270
|
return value;
|
|
13085
13271
|
}
|
|
@@ -13225,9 +13411,47 @@ function buildURL(url2, params, options) {
|
|
|
13225
13411
|
}
|
|
13226
13412
|
|
|
13227
13413
|
// ../node_modules/axios/lib/core/InterceptorManager.js
|
|
13414
|
+
var $internals2 = /* @__PURE__ */ Symbol("internals");
|
|
13415
|
+
function countHandlers(handlers) {
|
|
13416
|
+
return handlers ? handlers.length : 0;
|
|
13417
|
+
}
|
|
13418
|
+
function trimHandlers(handlers) {
|
|
13419
|
+
if (!handlers) {
|
|
13420
|
+
return;
|
|
13421
|
+
}
|
|
13422
|
+
while (handlers.length && handlers[handlers.length - 1] === null) {
|
|
13423
|
+
handlers.pop();
|
|
13424
|
+
}
|
|
13425
|
+
}
|
|
13426
|
+
function syncHandlerEntries(manager, internals) {
|
|
13427
|
+
const handlers = manager.handlers;
|
|
13428
|
+
const length = countHandlers(handlers);
|
|
13429
|
+
if (handlers !== internals.handlersRef) {
|
|
13430
|
+
internals.handlersRef = handlers;
|
|
13431
|
+
internals.handlerEntries.clear();
|
|
13432
|
+
} else if (length !== internals.handlersLength) {
|
|
13433
|
+
if (!length) {
|
|
13434
|
+
internals.handlerEntries.clear();
|
|
13435
|
+
} else {
|
|
13436
|
+
internals.handlerEntries.forEach(function removeStaleEntry(entry, id) {
|
|
13437
|
+
if (handlers[entry.index] !== entry.handler) {
|
|
13438
|
+
internals.handlerEntries.delete(id);
|
|
13439
|
+
}
|
|
13440
|
+
});
|
|
13441
|
+
}
|
|
13442
|
+
}
|
|
13443
|
+
internals.handlersLength = length;
|
|
13444
|
+
}
|
|
13228
13445
|
var InterceptorManager = class {
|
|
13229
13446
|
constructor() {
|
|
13230
13447
|
this.handlers = [];
|
|
13448
|
+
this[$internals2] = {
|
|
13449
|
+
handlersRef: this.handlers,
|
|
13450
|
+
handlersLength: this.handlers.length,
|
|
13451
|
+
handlerEntries: /* @__PURE__ */ new Map(),
|
|
13452
|
+
iterationDepth: 0,
|
|
13453
|
+
nextId: 0
|
|
13454
|
+
};
|
|
13231
13455
|
}
|
|
13232
13456
|
/**
|
|
13233
13457
|
* Add a new interceptor to the stack
|
|
@@ -13239,13 +13463,25 @@ var InterceptorManager = class {
|
|
|
13239
13463
|
* @return {Number} An ID used to remove interceptor later
|
|
13240
13464
|
*/
|
|
13241
13465
|
use(fulfilled, rejected, options) {
|
|
13242
|
-
|
|
13466
|
+
const handler = {
|
|
13243
13467
|
fulfilled,
|
|
13244
13468
|
rejected,
|
|
13245
13469
|
synchronous: options ? options.synchronous : false,
|
|
13246
13470
|
runWhen: options ? options.runWhen : null
|
|
13471
|
+
};
|
|
13472
|
+
const internals = this[$internals2];
|
|
13473
|
+
if (this.handlers == null) {
|
|
13474
|
+
this.handlers = [];
|
|
13475
|
+
}
|
|
13476
|
+
syncHandlerEntries(this, internals);
|
|
13477
|
+
const id = internals.nextId++;
|
|
13478
|
+
this.handlers.push(handler);
|
|
13479
|
+
internals.handlerEntries.set(id, {
|
|
13480
|
+
handler,
|
|
13481
|
+
index: this.handlers.length - 1
|
|
13247
13482
|
});
|
|
13248
|
-
|
|
13483
|
+
internals.handlersLength = this.handlers.length;
|
|
13484
|
+
return id;
|
|
13249
13485
|
}
|
|
13250
13486
|
/**
|
|
13251
13487
|
* Remove an interceptor from the stack
|
|
@@ -13255,8 +13491,19 @@ var InterceptorManager = class {
|
|
|
13255
13491
|
* @returns {void}
|
|
13256
13492
|
*/
|
|
13257
13493
|
eject(id) {
|
|
13258
|
-
|
|
13259
|
-
|
|
13494
|
+
const internals = this[$internals2];
|
|
13495
|
+
syncHandlerEntries(this, internals);
|
|
13496
|
+
const entry = internals.handlerEntries.get(id);
|
|
13497
|
+
if (entry) {
|
|
13498
|
+
internals.handlerEntries.delete(id);
|
|
13499
|
+
if (this.handlers[entry.index] !== entry.handler) {
|
|
13500
|
+
return;
|
|
13501
|
+
}
|
|
13502
|
+
this.handlers[entry.index] = null;
|
|
13503
|
+
if (!internals.iterationDepth) {
|
|
13504
|
+
trimHandlers(this.handlers);
|
|
13505
|
+
internals.handlersLength = this.handlers.length;
|
|
13506
|
+
}
|
|
13260
13507
|
}
|
|
13261
13508
|
}
|
|
13262
13509
|
/**
|
|
@@ -13267,6 +13514,7 @@ var InterceptorManager = class {
|
|
|
13267
13514
|
clear() {
|
|
13268
13515
|
if (this.handlers) {
|
|
13269
13516
|
this.handlers = [];
|
|
13517
|
+
syncHandlerEntries(this, this[$internals2]);
|
|
13270
13518
|
}
|
|
13271
13519
|
}
|
|
13272
13520
|
/**
|
|
@@ -13280,11 +13528,22 @@ var InterceptorManager = class {
|
|
|
13280
13528
|
* @returns {void}
|
|
13281
13529
|
*/
|
|
13282
13530
|
forEach(fn) {
|
|
13283
|
-
|
|
13284
|
-
|
|
13285
|
-
|
|
13531
|
+
const internals = this[$internals2];
|
|
13532
|
+
syncHandlerEntries(this, internals);
|
|
13533
|
+
internals.iterationDepth++;
|
|
13534
|
+
try {
|
|
13535
|
+
utils_default.forEach(this.handlers, function forEachHandler(h) {
|
|
13536
|
+
if (h !== null) {
|
|
13537
|
+
fn(h);
|
|
13538
|
+
}
|
|
13539
|
+
});
|
|
13540
|
+
} finally {
|
|
13541
|
+
if (!--internals.iterationDepth) {
|
|
13542
|
+
syncHandlerEntries(this, internals);
|
|
13543
|
+
trimHandlers(this.handlers);
|
|
13544
|
+
internals.handlersLength = countHandlers(this.handlers);
|
|
13286
13545
|
}
|
|
13287
|
-
}
|
|
13546
|
+
}
|
|
13288
13547
|
}
|
|
13289
13548
|
};
|
|
13290
13549
|
var InterceptorManager_default = InterceptorManager;
|
|
@@ -13380,7 +13639,7 @@ function throwIfDepthExceeded(index) {
|
|
|
13380
13639
|
}
|
|
13381
13640
|
function parsePropPath(name) {
|
|
13382
13641
|
const path = [];
|
|
13383
|
-
const pattern =
|
|
13642
|
+
const pattern = /[^.[\]]+|\[([^.[\]]*)]/g;
|
|
13384
13643
|
let match;
|
|
13385
13644
|
while ((match = pattern.exec(name)) !== null) {
|
|
13386
13645
|
throwIfDepthExceeded(path.length);
|
|
@@ -13436,9 +13695,25 @@ function formDataToJSON(formData) {
|
|
|
13436
13695
|
}
|
|
13437
13696
|
var formDataToJSON_default = formDataToJSON;
|
|
13438
13697
|
|
|
13698
|
+
// ../node_modules/axios/lib/core/methodList.js
|
|
13699
|
+
var methodList = Object.freeze([
|
|
13700
|
+
"get",
|
|
13701
|
+
"delete",
|
|
13702
|
+
"head",
|
|
13703
|
+
"options",
|
|
13704
|
+
"post",
|
|
13705
|
+
"put",
|
|
13706
|
+
"patch",
|
|
13707
|
+
"purge",
|
|
13708
|
+
"link",
|
|
13709
|
+
"unlink",
|
|
13710
|
+
"query"
|
|
13711
|
+
]);
|
|
13712
|
+
var methodList_default = methodList;
|
|
13713
|
+
|
|
13439
13714
|
// ../node_modules/axios/lib/defaults/index.js
|
|
13440
13715
|
var own = (obj, key) => obj != null && utils_default.hasOwnProp(obj, key) ? obj[key] : void 0;
|
|
13441
|
-
function
|
|
13716
|
+
function stringifySafely2(rawValue, parser, encoder) {
|
|
13442
13717
|
if (utils_default.isString(rawValue)) {
|
|
13443
13718
|
try {
|
|
13444
13719
|
(parser || JSON.parse)(rawValue);
|
|
@@ -13494,7 +13769,7 @@ var defaults = {
|
|
|
13494
13769
|
}
|
|
13495
13770
|
if (isObjectPayload || hasJSONContentType) {
|
|
13496
13771
|
headers.setContentType("application/json", false);
|
|
13497
|
-
return
|
|
13772
|
+
return stringifySafely2(data);
|
|
13498
13773
|
}
|
|
13499
13774
|
return data;
|
|
13500
13775
|
}
|
|
@@ -13548,7 +13823,7 @@ var defaults = {
|
|
|
13548
13823
|
}
|
|
13549
13824
|
}
|
|
13550
13825
|
};
|
|
13551
|
-
utils_default.forEach(
|
|
13826
|
+
utils_default.forEach(methodList_default, (method) => {
|
|
13552
13827
|
defaults.headers[method] = {};
|
|
13553
13828
|
});
|
|
13554
13829
|
var defaults_default = defaults;
|
|
@@ -13616,29 +13891,62 @@ function isAbsoluteURL(url2) {
|
|
|
13616
13891
|
|
|
13617
13892
|
// ../node_modules/axios/lib/helpers/combineURLs.js
|
|
13618
13893
|
function combineURLs(baseURL, relativeURL) {
|
|
13619
|
-
|
|
13894
|
+
if (!relativeURL) {
|
|
13895
|
+
return baseURL;
|
|
13896
|
+
}
|
|
13897
|
+
let end = baseURL.length;
|
|
13898
|
+
while (end > 0 && baseURL.charCodeAt(end - 1) === 47) {
|
|
13899
|
+
end--;
|
|
13900
|
+
}
|
|
13901
|
+
return baseURL.slice(0, end) + "/" + relativeURL.replace(/^\/+/, "");
|
|
13902
|
+
}
|
|
13903
|
+
|
|
13904
|
+
// ../node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js
|
|
13905
|
+
var urlParserControlCharacters = /[\t\n\r]/g;
|
|
13906
|
+
function normalizeURLForProtocolCheck(url2) {
|
|
13907
|
+
if (typeof url2 !== "string") {
|
|
13908
|
+
return url2;
|
|
13909
|
+
}
|
|
13910
|
+
let start = 0;
|
|
13911
|
+
while (start < url2.length && url2.charCodeAt(start) <= 32) {
|
|
13912
|
+
start++;
|
|
13913
|
+
}
|
|
13914
|
+
return url2.slice(start).replace(urlParserControlCharacters, "");
|
|
13620
13915
|
}
|
|
13621
13916
|
|
|
13622
13917
|
// ../node_modules/axios/lib/core/buildFullPath.js
|
|
13623
13918
|
var malformedHttpProtocol = /^https?:(?!\/\/)/i;
|
|
13624
|
-
|
|
13625
|
-
|
|
13626
|
-
|
|
13627
|
-
while (i < url2.length && url2.charCodeAt(i) <= 32) {
|
|
13628
|
-
i++;
|
|
13919
|
+
function redactFragment(fragment) {
|
|
13920
|
+
if (!fragment) {
|
|
13921
|
+
return fragment;
|
|
13629
13922
|
}
|
|
13630
|
-
return
|
|
13923
|
+
return fragment.replace(/(^|&)([^=&]*=)?[^&]+/g, (match, separator, parameterName = "") => {
|
|
13924
|
+
return `${separator}${parameterName}${REDACTED}`;
|
|
13925
|
+
});
|
|
13631
13926
|
}
|
|
13632
|
-
function
|
|
13633
|
-
|
|
13927
|
+
function redactSensitiveURLParts(url2) {
|
|
13928
|
+
const redactedURL = url2.replace(/^(https?:\/{0,2})[^/?#]*@/i, `$1${REDACTED}@`);
|
|
13929
|
+
const fragmentIndex = redactedURL.indexOf("#");
|
|
13930
|
+
const urlWithoutFragment = fragmentIndex === -1 ? redactedURL : redactedURL.slice(0, fragmentIndex);
|
|
13931
|
+
const redactedURLWithoutFragment = urlWithoutFragment.replace(
|
|
13932
|
+
/([?&][^=&#]*=)[^&#]*/g,
|
|
13933
|
+
`$1${REDACTED}`
|
|
13934
|
+
);
|
|
13935
|
+
if (fragmentIndex === -1) {
|
|
13936
|
+
return redactedURLWithoutFragment;
|
|
13937
|
+
}
|
|
13938
|
+
return `${redactedURLWithoutFragment}#${redactFragment(redactedURL.slice(fragmentIndex + 1))}`;
|
|
13634
13939
|
}
|
|
13635
13940
|
function assertValidHttpProtocolURL(url2, config) {
|
|
13636
|
-
if (typeof url2 === "string"
|
|
13637
|
-
|
|
13638
|
-
|
|
13639
|
-
AxiosError_default
|
|
13640
|
-
|
|
13641
|
-
|
|
13941
|
+
if (typeof url2 === "string") {
|
|
13942
|
+
const normalizedURL = normalizeURLForProtocolCheck(url2);
|
|
13943
|
+
if (malformedHttpProtocol.test(normalizedURL)) {
|
|
13944
|
+
throw new AxiosError_default(
|
|
13945
|
+
`Invalid URL ${JSON.stringify(redactSensitiveURLParts(normalizedURL))}: missing "//" after protocol`,
|
|
13946
|
+
AxiosError_default.ERR_INVALID_URL,
|
|
13947
|
+
config
|
|
13948
|
+
);
|
|
13949
|
+
}
|
|
13642
13950
|
}
|
|
13643
13951
|
}
|
|
13644
13952
|
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
|
|
@@ -13723,7 +14031,7 @@ var import_https_proxy_agent = __toESM(require_dist());
|
|
|
13723
14031
|
var import_follow_redirects = __toESM(require_follow_redirects());
|
|
13724
14032
|
|
|
13725
14033
|
// ../node_modules/axios/lib/env/data.js
|
|
13726
|
-
var VERSION = "1.
|
|
14034
|
+
var VERSION = "1.20.0";
|
|
13727
14035
|
|
|
13728
14036
|
// ../node_modules/axios/lib/helpers/parseProtocol.js
|
|
13729
14037
|
function parseProtocol(url2) {
|
|
@@ -13732,7 +14040,7 @@ function parseProtocol(url2) {
|
|
|
13732
14040
|
}
|
|
13733
14041
|
|
|
13734
14042
|
// ../node_modules/axios/lib/helpers/fromDataURI.js
|
|
13735
|
-
var DATA_URL_PATTERN = /^([
|
|
14043
|
+
var DATA_URL_PATTERN = /^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
|
|
13736
14044
|
function fromDataURI(uri, asBlob, options) {
|
|
13737
14045
|
const _Blob = options && options.Blob || platform_default.classes.Blob;
|
|
13738
14046
|
const protocol = parseProtocol(uri);
|
|
@@ -13766,6 +14074,20 @@ function fromDataURI(uri, asBlob, options) {
|
|
|
13766
14074
|
}
|
|
13767
14075
|
throw new AxiosError_default("Unsupported protocol " + protocol, AxiosError_default.ERR_NOT_SUPPORT);
|
|
13768
14076
|
}
|
|
14077
|
+
|
|
14078
|
+
// ../node_modules/axios/lib/core/setFormDataHeaders.js
|
|
14079
|
+
var FORM_DATA_CONTENT_HEADERS = ["content-type", "content-length"];
|
|
14080
|
+
function setFormDataHeaders(headers, formHeaders, policy) {
|
|
14081
|
+
if (policy !== "content-only") {
|
|
14082
|
+
headers.set(formHeaders);
|
|
14083
|
+
return;
|
|
14084
|
+
}
|
|
14085
|
+
Object.entries(formHeaders || {}).forEach(([key, val]) => {
|
|
14086
|
+
if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
|
|
14087
|
+
headers.set(key, val);
|
|
14088
|
+
}
|
|
14089
|
+
});
|
|
14090
|
+
}
|
|
13769
14091
|
var kInternals = /* @__PURE__ */ Symbol("internals");
|
|
13770
14092
|
var AxiosTransformStream = class extends stream3.Transform {
|
|
13771
14093
|
constructor(options) {
|
|
@@ -14011,6 +14333,7 @@ var Http2Sessions = class {
|
|
|
14011
14333
|
}
|
|
14012
14334
|
getSession(authority, options) {
|
|
14013
14335
|
options = Object.assign(
|
|
14336
|
+
/* @__PURE__ */ Object.create(null),
|
|
14014
14337
|
{
|
|
14015
14338
|
sessionTimeout: 1e3
|
|
14016
14339
|
},
|
|
@@ -14076,6 +14399,7 @@ var Http2Sessions = class {
|
|
|
14076
14399
|
};
|
|
14077
14400
|
}
|
|
14078
14401
|
session.once("close", removeSession);
|
|
14402
|
+
session.once("error", removeSession);
|
|
14079
14403
|
let entry = [session, options];
|
|
14080
14404
|
authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
|
|
14081
14405
|
return session;
|
|
@@ -14100,12 +14424,73 @@ var callbackify_default = callbackify;
|
|
|
14100
14424
|
|
|
14101
14425
|
// ../node_modules/axios/lib/helpers/shouldBypassProxy.js
|
|
14102
14426
|
var LOOPBACK_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "0.0.0.0"]);
|
|
14427
|
+
var trimTrailingDots = (value) => {
|
|
14428
|
+
let end = value.length;
|
|
14429
|
+
while (end && value.charCodeAt(end - 1) === 46) {
|
|
14430
|
+
end--;
|
|
14431
|
+
}
|
|
14432
|
+
return end === value.length ? value : value.slice(0, end);
|
|
14433
|
+
};
|
|
14103
14434
|
var isIPv4Loopback = (host) => {
|
|
14104
14435
|
const parts = host.split(".");
|
|
14105
14436
|
if (parts.length !== 4) return false;
|
|
14106
14437
|
if (parts[0] !== "127") return false;
|
|
14107
14438
|
return parts.every((p) => /^\d+$/.test(p) && Number(p) >= 0 && Number(p) <= 255);
|
|
14108
14439
|
};
|
|
14440
|
+
var parseIPv4Octet = (text) => {
|
|
14441
|
+
if (/^0[xX][0-9a-fA-F]+$/.test(text)) {
|
|
14442
|
+
const n = parseInt(text.slice(2), 16);
|
|
14443
|
+
return Number.isFinite(n) ? n : null;
|
|
14444
|
+
}
|
|
14445
|
+
if (text.length > 1 && /^0[0-7]+$/.test(text)) {
|
|
14446
|
+
const n = parseInt(text, 8);
|
|
14447
|
+
return Number.isFinite(n) ? n : null;
|
|
14448
|
+
}
|
|
14449
|
+
if (text.length > 1 && /^0[0-9]+$/.test(text)) {
|
|
14450
|
+
return null;
|
|
14451
|
+
}
|
|
14452
|
+
if (/^[0-9]+$/.test(text)) {
|
|
14453
|
+
const n = parseInt(text, 10);
|
|
14454
|
+
return Number.isFinite(n) ? n : null;
|
|
14455
|
+
}
|
|
14456
|
+
return null;
|
|
14457
|
+
};
|
|
14458
|
+
var normalizeIPAddress = (host) => {
|
|
14459
|
+
if (typeof host !== "string" || !host || host.indexOf(":") !== -1) {
|
|
14460
|
+
return host;
|
|
14461
|
+
}
|
|
14462
|
+
let h = host;
|
|
14463
|
+
if (h.charAt(0) === "[" && h.charAt(h.length - 1) === "]") {
|
|
14464
|
+
h = h.slice(1, -1);
|
|
14465
|
+
}
|
|
14466
|
+
h = trimTrailingDots(h);
|
|
14467
|
+
if (!/^[0-9.xXa-fA-F]+$/.test(h)) return host;
|
|
14468
|
+
const parts = h.split(".");
|
|
14469
|
+
if (parts.some((p) => p === "")) return host;
|
|
14470
|
+
if (parts.length === 4) {
|
|
14471
|
+
const octets = parts.map(parseIPv4Octet);
|
|
14472
|
+
if (octets.some((n) => n === null || n < 0 || n > 255)) return host;
|
|
14473
|
+
return octets.join(".");
|
|
14474
|
+
}
|
|
14475
|
+
if (parts.length > 4) {
|
|
14476
|
+
return host;
|
|
14477
|
+
}
|
|
14478
|
+
if (parts.length === 1) return host;
|
|
14479
|
+
const literalOctets = parts.slice(0, -1);
|
|
14480
|
+
const tail = parts[parts.length - 1];
|
|
14481
|
+
const tailSlots = 4 - literalOctets.length;
|
|
14482
|
+
const tailValue = parseIPv4Octet(tail);
|
|
14483
|
+
if (tailValue === null) return host;
|
|
14484
|
+
const maxTail = (1 << 8 * tailSlots) - 1;
|
|
14485
|
+
if (tailValue < 0 || tailValue > maxTail) return host;
|
|
14486
|
+
const tailOctets = new Array(tailSlots).fill(0);
|
|
14487
|
+
for (let i = tailSlots - 1, v = tailValue; i >= 0; i--, v >>= 8) {
|
|
14488
|
+
tailOctets[i] = v & 255;
|
|
14489
|
+
}
|
|
14490
|
+
const literal = literalOctets.map(parseIPv4Octet);
|
|
14491
|
+
if (literal.some((n) => n === null || n < 0 || n > 255)) return host;
|
|
14492
|
+
return [...literal, ...tailOctets].join(".");
|
|
14493
|
+
};
|
|
14109
14494
|
var isIPv6ZeroGroup = (group) => /^0{1,4}$/.test(group);
|
|
14110
14495
|
var isIPv6Unspecified = (host) => {
|
|
14111
14496
|
if (host === "::") return true;
|
|
@@ -14190,6 +14575,40 @@ var unmapIPv4MappedIPv6 = (host) => {
|
|
|
14190
14575
|
}
|
|
14191
14576
|
return host;
|
|
14192
14577
|
};
|
|
14578
|
+
var IPV4_OCTET_RE = /^(?:0|[1-9]\d{0,2})$/;
|
|
14579
|
+
var ipv4ToBytes = (host) => {
|
|
14580
|
+
const parts = host.split(".");
|
|
14581
|
+
return parts.length === 4 && parts.every((part) => IPV4_OCTET_RE.test(part) && Number(part) <= 255) ? parts.map(Number) : null;
|
|
14582
|
+
};
|
|
14583
|
+
var IPV6_GROUP_RE = /^[0-9a-f]{1,4}$/i;
|
|
14584
|
+
var ipv6ToBytes = (host) => {
|
|
14585
|
+
const halves = host.split("::");
|
|
14586
|
+
if (halves.length > 2) {
|
|
14587
|
+
return null;
|
|
14588
|
+
}
|
|
14589
|
+
const groups = halves[0] ? halves[0].split(":") : [];
|
|
14590
|
+
if (halves.length === 2) {
|
|
14591
|
+
const rear = halves[1] ? halves[1].split(":") : [];
|
|
14592
|
+
const missing = 8 - groups.length - rear.length;
|
|
14593
|
+
if (missing < 1) {
|
|
14594
|
+
return null;
|
|
14595
|
+
}
|
|
14596
|
+
groups.push(...new Array(missing).fill("0"), ...rear);
|
|
14597
|
+
}
|
|
14598
|
+
if (groups.length !== 8 || groups.some((group) => !IPV6_GROUP_RE.test(group))) {
|
|
14599
|
+
return null;
|
|
14600
|
+
}
|
|
14601
|
+
return groups.flatMap((group) => {
|
|
14602
|
+
const value = Number.parseInt(group, 16);
|
|
14603
|
+
return [value >> 8 & 255, value & 255];
|
|
14604
|
+
});
|
|
14605
|
+
};
|
|
14606
|
+
var ipToBytes = (host) => {
|
|
14607
|
+
if (typeof host !== "string" || !host) {
|
|
14608
|
+
return null;
|
|
14609
|
+
}
|
|
14610
|
+
return host.indexOf(":") !== -1 ? ipv6ToBytes(host) : ipv4ToBytes(host);
|
|
14611
|
+
};
|
|
14193
14612
|
var normalizeNoProxyHost = (hostname) => {
|
|
14194
14613
|
if (!hostname) {
|
|
14195
14614
|
return hostname;
|
|
@@ -14197,7 +14616,89 @@ var normalizeNoProxyHost = (hostname) => {
|
|
|
14197
14616
|
if (hostname.charAt(0) === "[" && hostname.charAt(hostname.length - 1) === "]") {
|
|
14198
14617
|
hostname = hostname.slice(1, -1);
|
|
14199
14618
|
}
|
|
14200
|
-
|
|
14619
|
+
const trimmed = trimTrailingDots(hostname);
|
|
14620
|
+
const ipv4 = normalizeIPAddress(trimmed);
|
|
14621
|
+
if (ipv4 !== trimmed) {
|
|
14622
|
+
return ipv4;
|
|
14623
|
+
}
|
|
14624
|
+
return unmapIPv4MappedIPv6(trimmed);
|
|
14625
|
+
};
|
|
14626
|
+
var normalizeCidrBase = (input) => {
|
|
14627
|
+
let base = input;
|
|
14628
|
+
const startsBracket = base.charAt(0) === "[";
|
|
14629
|
+
const endsBracket = base.charAt(base.length - 1) === "]";
|
|
14630
|
+
const hasBracket = base.includes("[") || base.includes("]");
|
|
14631
|
+
if (startsBracket || endsBracket) {
|
|
14632
|
+
if (!startsBracket || !endsBracket) {
|
|
14633
|
+
return null;
|
|
14634
|
+
}
|
|
14635
|
+
base = base.slice(1, -1);
|
|
14636
|
+
if (base.indexOf(":") === -1 || base.includes("[") || base.includes("]")) {
|
|
14637
|
+
return null;
|
|
14638
|
+
}
|
|
14639
|
+
} else if (hasBracket) {
|
|
14640
|
+
return null;
|
|
14641
|
+
}
|
|
14642
|
+
if (!base || base.charAt(base.length - 1) === ".") {
|
|
14643
|
+
return null;
|
|
14644
|
+
}
|
|
14645
|
+
const wasIPv6 = base.indexOf(":") !== -1;
|
|
14646
|
+
if (wasIPv6) {
|
|
14647
|
+
try {
|
|
14648
|
+
base = new URL(`http://[${base}]/`).hostname.slice(1, -1);
|
|
14649
|
+
} catch (_err) {
|
|
14650
|
+
return null;
|
|
14651
|
+
}
|
|
14652
|
+
} else {
|
|
14653
|
+
base = normalizeIPAddress(base);
|
|
14654
|
+
if (!ipv4ToBytes(base)) {
|
|
14655
|
+
return null;
|
|
14656
|
+
}
|
|
14657
|
+
}
|
|
14658
|
+
return { normalized: unmapIPv4MappedIPv6(base), wasIPv6 };
|
|
14659
|
+
};
|
|
14660
|
+
var CIDR_ENTRY_RE = /^(.+)\/(0|[1-9]\d{0,2})$/;
|
|
14661
|
+
var parseCidrEntry = (entry) => {
|
|
14662
|
+
if (entry.indexOf("/") === -1) {
|
|
14663
|
+
return void 0;
|
|
14664
|
+
}
|
|
14665
|
+
const match = CIDR_ENTRY_RE.exec(entry);
|
|
14666
|
+
if (!match) {
|
|
14667
|
+
return null;
|
|
14668
|
+
}
|
|
14669
|
+
let prefix = Number(match[2]);
|
|
14670
|
+
const parsedBase = normalizeCidrBase(match[1]);
|
|
14671
|
+
if (!parsedBase) {
|
|
14672
|
+
return null;
|
|
14673
|
+
}
|
|
14674
|
+
const { normalized, wasIPv6 } = parsedBase;
|
|
14675
|
+
if (wasIPv6 && normalized.indexOf(":") === -1) {
|
|
14676
|
+
if (prefix < 96) {
|
|
14677
|
+
return null;
|
|
14678
|
+
}
|
|
14679
|
+
prefix -= 96;
|
|
14680
|
+
}
|
|
14681
|
+
const bytes = ipToBytes(normalized);
|
|
14682
|
+
if (!bytes || prefix > bytes.length * 8) {
|
|
14683
|
+
return null;
|
|
14684
|
+
}
|
|
14685
|
+
return { bytes, prefix };
|
|
14686
|
+
};
|
|
14687
|
+
var isInSubnet = (addressBytes, networkBytes, prefix) => {
|
|
14688
|
+
const fullBytes = prefix >> 3;
|
|
14689
|
+
for (let i = 0; i < fullBytes; i++) {
|
|
14690
|
+
if (addressBytes[i] !== networkBytes[i]) {
|
|
14691
|
+
return false;
|
|
14692
|
+
}
|
|
14693
|
+
}
|
|
14694
|
+
const remainingBits = prefix & 7;
|
|
14695
|
+
if (remainingBits) {
|
|
14696
|
+
const mask = 255 << 8 - remainingBits & 255;
|
|
14697
|
+
if ((addressBytes[fullBytes] & mask) !== (networkBytes[fullBytes] & mask)) {
|
|
14698
|
+
return false;
|
|
14699
|
+
}
|
|
14700
|
+
}
|
|
14701
|
+
return true;
|
|
14201
14702
|
};
|
|
14202
14703
|
function shouldBypassProxy(location) {
|
|
14203
14704
|
let parsed;
|
|
@@ -14215,10 +14716,18 @@ function shouldBypassProxy(location) {
|
|
|
14215
14716
|
}
|
|
14216
14717
|
const port = Number.parseInt(parsed.port, 10) || DEFAULT_PORTS2[parsed.protocol.split(":", 1)[0]] || 0;
|
|
14217
14718
|
const hostname = normalizeNoProxyHost(parsed.hostname.toLowerCase());
|
|
14719
|
+
const hostnameBytes = ipToBytes(hostname);
|
|
14218
14720
|
return noProxy.split(/[\s,]+/).some((entry) => {
|
|
14219
14721
|
if (!entry) {
|
|
14220
14722
|
return false;
|
|
14221
14723
|
}
|
|
14724
|
+
if (entry === "*") {
|
|
14725
|
+
return true;
|
|
14726
|
+
}
|
|
14727
|
+
const cidr = parseCidrEntry(entry);
|
|
14728
|
+
if (cidr !== void 0) {
|
|
14729
|
+
return cidr !== null && !!hostnameBytes && hostnameBytes.length === cidr.bytes.length && isInSubnet(hostnameBytes, cidr.bytes, cidr.prefix);
|
|
14730
|
+
}
|
|
14222
14731
|
let [entryHost, entryPort] = parseNoProxyEntry(entry);
|
|
14223
14732
|
entryHost = normalizeNoProxyHost(entryHost);
|
|
14224
14733
|
if (!entryHost) {
|
|
@@ -14304,7 +14813,8 @@ function throttle(fn, freq) {
|
|
|
14304
14813
|
}
|
|
14305
14814
|
};
|
|
14306
14815
|
const flush = () => lastArgs && invoke(lastArgs);
|
|
14307
|
-
|
|
14816
|
+
const flushWith = (...args) => invoke(args);
|
|
14817
|
+
return [throttled, flush, flushWith];
|
|
14308
14818
|
}
|
|
14309
14819
|
var throttle_default = throttle;
|
|
14310
14820
|
|
|
@@ -14313,12 +14823,12 @@ var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
14313
14823
|
let bytesNotified = 0;
|
|
14314
14824
|
const _speedometer = speedometer_default(50, 250);
|
|
14315
14825
|
return throttle_default((e) => {
|
|
14316
|
-
if (!e ||
|
|
14826
|
+
if (!e || !utils_default.isNumber(e.loaded)) {
|
|
14317
14827
|
return;
|
|
14318
14828
|
}
|
|
14319
14829
|
const rawLoaded = e.loaded;
|
|
14320
14830
|
const total = e.lengthComputable ? e.total : void 0;
|
|
14321
|
-
const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
|
|
14831
|
+
const loaded = Math.max(0, total != null ? Math.min(rawLoaded, total) : rawLoaded);
|
|
14322
14832
|
const progressBytes = Math.max(0, loaded - bytesNotified);
|
|
14323
14833
|
const rate = _speedometer(progressBytes);
|
|
14324
14834
|
bytesNotified = Math.max(bytesNotified, loaded);
|
|
@@ -14347,12 +14857,66 @@ var progressEventDecorator = (total, throttled) => {
|
|
|
14347
14857
|
throttled[1]
|
|
14348
14858
|
];
|
|
14349
14859
|
};
|
|
14350
|
-
var asyncDecorator = (fn) => (...args) =>
|
|
14860
|
+
var asyncDecorator = (fn, scheduler = utils_default.asap) => (...args) => scheduler(() => fn(...args));
|
|
14351
14861
|
|
|
14352
14862
|
// ../node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js
|
|
14353
14863
|
var isHexDigit = (charCode) => charCode >= 48 && charCode <= 57 || charCode >= 65 && charCode <= 70 || charCode >= 97 && charCode <= 102;
|
|
14354
14864
|
var isPercentEncodedByte = (str, i, len) => i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
|
|
14355
|
-
|
|
14865
|
+
var hexValue = (charCode) => charCode <= 57 ? charCode - 48 : (charCode & 223) - 55;
|
|
14866
|
+
var isBase64Char = (charCode) => charCode >= 65 && charCode <= 90 || // A-Z
|
|
14867
|
+
charCode >= 97 && charCode <= 122 || // a-z
|
|
14868
|
+
charCode >= 48 && charCode <= 57 || // 0-9
|
|
14869
|
+
charCode === 43 || // +
|
|
14870
|
+
charCode === 47 || // /
|
|
14871
|
+
charCode === 45 || // - (base64url)
|
|
14872
|
+
charCode === 95;
|
|
14873
|
+
var isBase64Whitespace = (charCode) => charCode === 9 || charCode === 10 || charCode === 12 || charCode === 13 || charCode === 32;
|
|
14874
|
+
var base64Bytes = (significant) => {
|
|
14875
|
+
const groups = Math.floor(significant / 4);
|
|
14876
|
+
const remainder = significant % 4;
|
|
14877
|
+
return groups * 3 + (remainder === 2 ? 1 : remainder === 3 ? 2 : 0);
|
|
14878
|
+
};
|
|
14879
|
+
var estimateBase64BufferAllocation = (body) => {
|
|
14880
|
+
const len = body.length;
|
|
14881
|
+
let padding = 0;
|
|
14882
|
+
if (len > 0 && body.charCodeAt(len - 1) === 61) {
|
|
14883
|
+
padding++;
|
|
14884
|
+
if (len > 1 && body.charCodeAt(len - 2) === 61) {
|
|
14885
|
+
padding++;
|
|
14886
|
+
}
|
|
14887
|
+
}
|
|
14888
|
+
return Math.floor((len - padding) * 3 / 4);
|
|
14889
|
+
};
|
|
14890
|
+
var estimatePercentDecodedBase64Bytes = (body) => {
|
|
14891
|
+
const len = body.length;
|
|
14892
|
+
let significant = 0;
|
|
14893
|
+
let padding = 0;
|
|
14894
|
+
let invalid = false;
|
|
14895
|
+
for (let i = 0; i < len; i++) {
|
|
14896
|
+
let code = body.charCodeAt(i);
|
|
14897
|
+
if (code === 37 && isPercentEncodedByte(body, i, len)) {
|
|
14898
|
+
code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
|
|
14899
|
+
i += 2;
|
|
14900
|
+
}
|
|
14901
|
+
if (isBase64Whitespace(code)) {
|
|
14902
|
+
continue;
|
|
14903
|
+
}
|
|
14904
|
+
if (code === 61) {
|
|
14905
|
+
padding++;
|
|
14906
|
+
continue;
|
|
14907
|
+
}
|
|
14908
|
+
if (!isBase64Char(code) || padding > 0) {
|
|
14909
|
+
invalid = true;
|
|
14910
|
+
continue;
|
|
14911
|
+
}
|
|
14912
|
+
significant++;
|
|
14913
|
+
}
|
|
14914
|
+
if (invalid || padding > 2 || padding > 0 && (significant + padding) % 4 !== 0 || significant % 4 === 1) {
|
|
14915
|
+
return estimateBase64BufferAllocation(body);
|
|
14916
|
+
}
|
|
14917
|
+
return base64Bytes(significant);
|
|
14918
|
+
};
|
|
14919
|
+
var estimateDataURLBytes = (url2, estimateBase64) => {
|
|
14356
14920
|
if (!url2 || typeof url2 !== "string") return 0;
|
|
14357
14921
|
if (!url2.startsWith("data:")) return 0;
|
|
14358
14922
|
const comma = url2.indexOf(",");
|
|
@@ -14361,43 +14925,7 @@ function estimateDataURLDecodedBytes(url2) {
|
|
|
14361
14925
|
const body = url2.slice(comma + 1);
|
|
14362
14926
|
const isBase64 = /;base64/i.test(meta);
|
|
14363
14927
|
if (isBase64) {
|
|
14364
|
-
|
|
14365
|
-
const len = body.length;
|
|
14366
|
-
for (let i = 0; i < len; i++) {
|
|
14367
|
-
if (body.charCodeAt(i) === 37 && i + 2 < len) {
|
|
14368
|
-
const a = body.charCodeAt(i + 1);
|
|
14369
|
-
const b = body.charCodeAt(i + 2);
|
|
14370
|
-
const isHex = isHexDigit(a) && isHexDigit(b);
|
|
14371
|
-
if (isHex) {
|
|
14372
|
-
effectiveLen -= 2;
|
|
14373
|
-
i += 2;
|
|
14374
|
-
}
|
|
14375
|
-
}
|
|
14376
|
-
}
|
|
14377
|
-
let pad = 0;
|
|
14378
|
-
let idx = len - 1;
|
|
14379
|
-
const tailIsPct3D = (j) => j >= 2 && body.charCodeAt(j - 2) === 37 && // '%'
|
|
14380
|
-
body.charCodeAt(j - 1) === 51 && // '3'
|
|
14381
|
-
(body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100);
|
|
14382
|
-
if (idx >= 0) {
|
|
14383
|
-
if (body.charCodeAt(idx) === 61) {
|
|
14384
|
-
pad++;
|
|
14385
|
-
idx--;
|
|
14386
|
-
} else if (tailIsPct3D(idx)) {
|
|
14387
|
-
pad++;
|
|
14388
|
-
idx -= 3;
|
|
14389
|
-
}
|
|
14390
|
-
}
|
|
14391
|
-
if (pad === 1 && idx >= 0) {
|
|
14392
|
-
if (body.charCodeAt(idx) === 61) {
|
|
14393
|
-
pad++;
|
|
14394
|
-
} else if (tailIsPct3D(idx)) {
|
|
14395
|
-
pad++;
|
|
14396
|
-
}
|
|
14397
|
-
}
|
|
14398
|
-
const groups = Math.floor(effectiveLen / 4);
|
|
14399
|
-
const bytes2 = groups * 3 - (pad || 0);
|
|
14400
|
-
return bytes2 > 0 ? bytes2 : 0;
|
|
14928
|
+
return estimateBase64(body);
|
|
14401
14929
|
}
|
|
14402
14930
|
let bytes = 0;
|
|
14403
14931
|
for (let i = 0, len = body.length; i < len; i++) {
|
|
@@ -14422,6 +14950,16 @@ function estimateDataURLDecodedBytes(url2) {
|
|
|
14422
14950
|
}
|
|
14423
14951
|
}
|
|
14424
14952
|
return bytes;
|
|
14953
|
+
};
|
|
14954
|
+
function estimateDataURLDecodedBytes(url2) {
|
|
14955
|
+
const fragmentIndex = typeof url2 === "string" ? url2.indexOf("#") : -1;
|
|
14956
|
+
return estimateDataURLBytes(
|
|
14957
|
+
fragmentIndex === -1 ? url2 : url2.slice(0, fragmentIndex),
|
|
14958
|
+
estimatePercentDecodedBase64Bytes
|
|
14959
|
+
);
|
|
14960
|
+
}
|
|
14961
|
+
function estimateDataURLBufferAllocation(url2) {
|
|
14962
|
+
return estimateDataURLBytes(url2, estimateBase64BufferAllocation);
|
|
14425
14963
|
}
|
|
14426
14964
|
|
|
14427
14965
|
// ../node_modules/axios/lib/adapters/http.js
|
|
@@ -14441,22 +14979,17 @@ var isBrotliSupported = utils_default.isFunction(zlib.createBrotliDecompress);
|
|
|
14441
14979
|
var isZstdSupported = utils_default.isFunction(zlib.createZstdDecompress);
|
|
14442
14980
|
var ACCEPT_ENCODING = "gzip, compress, deflate" + (isBrotliSupported ? ", br" : "");
|
|
14443
14981
|
var ACCEPT_ENCODING_WITH_ZSTD = ACCEPT_ENCODING + (isZstdSupported ? ", zstd" : "");
|
|
14982
|
+
var scheduleProgress = typeof process !== "undefined" && process.nextTick ? process.nextTick.bind(process) : utils_default.asap;
|
|
14444
14983
|
var { http: httpFollow, https: httpsFollow } = import_follow_redirects.default;
|
|
14445
14984
|
var isHttps = /https:?/;
|
|
14446
|
-
var FORM_DATA_CONTENT_HEADERS = ["content-type", "content-length"];
|
|
14447
|
-
function setFormDataHeaders(headers, formHeaders, policy) {
|
|
14448
|
-
if (policy !== "content-only") {
|
|
14449
|
-
headers.set(formHeaders);
|
|
14450
|
-
return;
|
|
14451
|
-
}
|
|
14452
|
-
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
14453
|
-
if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
|
|
14454
|
-
headers.set(key, val);
|
|
14455
|
-
}
|
|
14456
|
-
});
|
|
14457
|
-
}
|
|
14458
14985
|
var kAxiosSocketListener = /* @__PURE__ */ Symbol("axios.http.socketListener");
|
|
14459
14986
|
var kAxiosCurrentReq = /* @__PURE__ */ Symbol("axios.http.currentReq");
|
|
14987
|
+
function handleSocketError(err) {
|
|
14988
|
+
const current = this[kAxiosCurrentReq];
|
|
14989
|
+
if (current && !current.destroyed) {
|
|
14990
|
+
current.destroy(err);
|
|
14991
|
+
}
|
|
14992
|
+
}
|
|
14460
14993
|
var kAxiosInstalledTunnel = /* @__PURE__ */ Symbol("axios.http.installedTunnel");
|
|
14461
14994
|
var tunnelingAgentCache = /* @__PURE__ */ new Map();
|
|
14462
14995
|
var tunnelingAgentCacheUser = /* @__PURE__ */ new WeakMap();
|
|
@@ -14559,10 +15092,10 @@ function isSameOriginRedirect(redirectOptions, requestDetails) {
|
|
|
14559
15092
|
return false;
|
|
14560
15093
|
}
|
|
14561
15094
|
}
|
|
14562
|
-
function setProxy(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent) {
|
|
15095
|
+
function setProxy(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent, allowEnvProxy = true) {
|
|
14563
15096
|
let proxy = configProxy;
|
|
14564
15097
|
const proxyEnvAgent = getProxyEnvAgent(options, configHttpAgent, configHttpsAgent);
|
|
14565
|
-
if (!proxy && proxy !== false && !isNodeEnvProxyEnabled(proxyEnvAgent)) {
|
|
15098
|
+
if (!proxy && proxy !== false && allowEnvProxy && !isNodeEnvProxyEnabled(proxyEnvAgent)) {
|
|
14566
15099
|
const proxyUrl = getProxyForUrl(location);
|
|
14567
15100
|
if (proxyUrl) {
|
|
14568
15101
|
if (!shouldBypassProxy(location)) {
|
|
@@ -14659,9 +15192,13 @@ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent,
|
|
|
14659
15192
|
redirectOptions.href,
|
|
14660
15193
|
true,
|
|
14661
15194
|
configHttpsAgent,
|
|
14662
|
-
configHttpAgent
|
|
15195
|
+
configHttpAgent,
|
|
15196
|
+
allowEnvProxy
|
|
14663
15197
|
);
|
|
14664
15198
|
};
|
|
15199
|
+
return Boolean(
|
|
15200
|
+
proxy || configProxy !== false && allowEnvProxy && isNodeEnvProxyEnabled(proxyEnvAgent)
|
|
15201
|
+
);
|
|
14665
15202
|
}
|
|
14666
15203
|
var isHttpAdapterSupported = typeof process !== "undefined" && utils_default.kindOf(process) === "process";
|
|
14667
15204
|
var wrapAsync = (asyncExecutor) => {
|
|
@@ -14686,7 +15223,7 @@ var wrapAsync = (asyncExecutor) => {
|
|
|
14686
15223
|
};
|
|
14687
15224
|
var resolveFamily = ({ address, family }) => {
|
|
14688
15225
|
if (!utils_default.isString(address)) {
|
|
14689
|
-
throw
|
|
15226
|
+
throw new AxiosError_default("address must be a string", AxiosError_default.ERR_BAD_OPTION_VALUE);
|
|
14690
15227
|
}
|
|
14691
15228
|
return {
|
|
14692
15229
|
address,
|
|
@@ -14694,6 +15231,30 @@ var resolveFamily = ({ address, family }) => {
|
|
|
14694
15231
|
};
|
|
14695
15232
|
};
|
|
14696
15233
|
var buildAddressEntry = (address, family) => resolveFamily(utils_default.isObject(address) ? address : { address, family });
|
|
15234
|
+
var normalizedLookupCache = /* @__PURE__ */ new WeakMap();
|
|
15235
|
+
var normalizeLookup = (lookup) => {
|
|
15236
|
+
let normalized = normalizedLookupCache.get(lookup);
|
|
15237
|
+
if (normalized) {
|
|
15238
|
+
return normalized;
|
|
15239
|
+
}
|
|
15240
|
+
const callbackLookup = callbackify_default(lookup, (value) => utils_default.isArray(value) ? value : [value]);
|
|
15241
|
+
normalized = (hostname, opt, cb) => {
|
|
15242
|
+
callbackLookup(hostname, opt, (err, arg0, arg1) => {
|
|
15243
|
+
if (err) {
|
|
15244
|
+
return cb(err);
|
|
15245
|
+
}
|
|
15246
|
+
let addresses;
|
|
15247
|
+
try {
|
|
15248
|
+
addresses = utils_default.isArray(arg0) ? arg0.map((addr) => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
|
|
15249
|
+
} catch (error) {
|
|
15250
|
+
return cb(error);
|
|
15251
|
+
}
|
|
15252
|
+
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
|
15253
|
+
});
|
|
15254
|
+
};
|
|
15255
|
+
normalizedLookupCache.set(lookup, normalized);
|
|
15256
|
+
return normalized;
|
|
15257
|
+
};
|
|
14697
15258
|
var http2Transport = {
|
|
14698
15259
|
request(options, cb) {
|
|
14699
15260
|
const authority = options.protocol + "//" + options.hostname + ":" + (options.port || (options.protocol === "https:" ? 443 : 80));
|
|
@@ -14730,6 +15291,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
14730
15291
|
let family = own2("family");
|
|
14731
15292
|
let httpVersion = own2("httpVersion");
|
|
14732
15293
|
if (httpVersion === void 0) httpVersion = 1;
|
|
15294
|
+
const rawHttpVersion = httpVersion;
|
|
14733
15295
|
let http2Options = own2("http2Options");
|
|
14734
15296
|
const httpAgent = own2("httpAgent");
|
|
14735
15297
|
const httpsAgent = own2("httpsAgent");
|
|
@@ -14746,25 +15308,32 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
14746
15308
|
let rejected = false;
|
|
14747
15309
|
let req;
|
|
14748
15310
|
let connectPhaseTimer;
|
|
14749
|
-
|
|
15311
|
+
try {
|
|
15312
|
+
httpVersion = +httpVersion;
|
|
15313
|
+
} catch (err) {
|
|
15314
|
+
throw new AxiosError_default(
|
|
15315
|
+
"Invalid protocol version: value is not a number",
|
|
15316
|
+
AxiosError_default.ERR_BAD_OPTION_VALUE,
|
|
15317
|
+
config
|
|
15318
|
+
);
|
|
15319
|
+
}
|
|
14750
15320
|
if (Number.isNaN(httpVersion)) {
|
|
14751
|
-
throw
|
|
15321
|
+
throw new AxiosError_default(
|
|
15322
|
+
`Invalid protocol version: '${rawHttpVersion}' is not a number`,
|
|
15323
|
+
AxiosError_default.ERR_BAD_OPTION_VALUE,
|
|
15324
|
+
config
|
|
15325
|
+
);
|
|
14752
15326
|
}
|
|
14753
15327
|
if (httpVersion !== 1 && httpVersion !== 2) {
|
|
14754
|
-
throw
|
|
15328
|
+
throw new AxiosError_default(
|
|
15329
|
+
`Unsupported protocol version '${httpVersion}'`,
|
|
15330
|
+
AxiosError_default.ERR_BAD_OPTION_VALUE,
|
|
15331
|
+
config
|
|
15332
|
+
);
|
|
14755
15333
|
}
|
|
14756
15334
|
const isHttp2 = httpVersion === 2;
|
|
14757
15335
|
if (lookup) {
|
|
14758
|
-
|
|
14759
|
-
lookup = (hostname, opt, cb) => {
|
|
14760
|
-
_lookup(hostname, opt, (err, arg0, arg1) => {
|
|
14761
|
-
if (err) {
|
|
14762
|
-
return cb(err);
|
|
14763
|
-
}
|
|
14764
|
-
const addresses = utils_default.isArray(arg0) ? arg0.map((addr) => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
|
|
14765
|
-
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
|
14766
|
-
});
|
|
14767
|
-
};
|
|
15336
|
+
lookup = normalizeLookup(lookup);
|
|
14768
15337
|
}
|
|
14769
15338
|
const abortEmitter = new EventEmitter();
|
|
14770
15339
|
function abort(reason) {
|
|
@@ -14838,7 +15407,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
14838
15407
|
if (protocol === "data:") {
|
|
14839
15408
|
if (maxContentLength > -1) {
|
|
14840
15409
|
const dataUrl = String(own2("url") || fullPath || "");
|
|
14841
|
-
const estimated =
|
|
15410
|
+
const estimated = estimateDataURLBufferAllocation(dataUrl);
|
|
14842
15411
|
if (estimated > maxContentLength) {
|
|
14843
15412
|
return reject(
|
|
14844
15413
|
new AxiosError_default(
|
|
@@ -14968,7 +15537,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
14968
15537
|
data,
|
|
14969
15538
|
progressEventDecorator(
|
|
14970
15539
|
contentLength,
|
|
14971
|
-
progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
|
|
15540
|
+
progressEventReducer(asyncDecorator(onUploadProgress, scheduleProgress), false, 3)
|
|
14972
15541
|
)
|
|
14973
15542
|
)
|
|
14974
15543
|
);
|
|
@@ -15006,6 +15575,9 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
15006
15575
|
utils_default.hasOwnProp(transitional2, "advertiseZstdAcceptEncoding") && transitional2.advertiseZstdAcceptEncoding === true ? ACCEPT_ENCODING_WITH_ZSTD : ACCEPT_ENCODING,
|
|
15007
15576
|
false
|
|
15008
15577
|
);
|
|
15578
|
+
if (isHttp2 && lookup) {
|
|
15579
|
+
http2Options = Object.assign(/* @__PURE__ */ Object.create(null), http2Options, { lookup });
|
|
15580
|
+
}
|
|
15009
15581
|
const options = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
15010
15582
|
path,
|
|
15011
15583
|
method,
|
|
@@ -15016,9 +15588,11 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
15016
15588
|
family,
|
|
15017
15589
|
beforeRedirect: dispatchBeforeRedirect,
|
|
15018
15590
|
beforeRedirects: /* @__PURE__ */ Object.create(null),
|
|
15019
|
-
http2Options
|
|
15591
|
+
http2Options,
|
|
15592
|
+
createConnection: void 0
|
|
15020
15593
|
});
|
|
15021
15594
|
!utils_default.isUndefined(lookup) && (options.lookup = lookup);
|
|
15595
|
+
let proxyApplied = false;
|
|
15022
15596
|
if (socketPath) {
|
|
15023
15597
|
if (typeof socketPath !== "string") {
|
|
15024
15598
|
return reject(
|
|
@@ -15046,13 +15620,17 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
15046
15620
|
} else {
|
|
15047
15621
|
options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
|
|
15048
15622
|
options.port = parsed.port;
|
|
15049
|
-
setProxy(
|
|
15623
|
+
proxyApplied = setProxy(
|
|
15050
15624
|
options,
|
|
15051
15625
|
configProxy,
|
|
15052
15626
|
protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path,
|
|
15053
15627
|
false,
|
|
15054
15628
|
httpsAgent,
|
|
15055
|
-
httpAgent
|
|
15629
|
+
httpAgent,
|
|
15630
|
+
// The HTTP/2 transport connects independently of HTTP/1 agents, so it
|
|
15631
|
+
// cannot apply either axios-resolved or agent-local environment proxies.
|
|
15632
|
+
// Explicit proxy config is still processed and rejected below.
|
|
15633
|
+
!isHttp2
|
|
15056
15634
|
);
|
|
15057
15635
|
}
|
|
15058
15636
|
let transport;
|
|
@@ -15063,6 +15641,15 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
15063
15641
|
options.agent = isHttpsRequest ? httpsAgent : httpAgent;
|
|
15064
15642
|
}
|
|
15065
15643
|
if (isHttp2) {
|
|
15644
|
+
if (proxyApplied) {
|
|
15645
|
+
return reject(
|
|
15646
|
+
new AxiosError_default(
|
|
15647
|
+
"HTTP/2 requests with a proxy are not supported",
|
|
15648
|
+
AxiosError_default.ERR_NOT_SUPPORT,
|
|
15649
|
+
config
|
|
15650
|
+
)
|
|
15651
|
+
);
|
|
15652
|
+
}
|
|
15066
15653
|
transport = http2Transport;
|
|
15067
15654
|
} else {
|
|
15068
15655
|
const configTransport = own2("transport");
|
|
@@ -15150,7 +15737,11 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
15150
15737
|
transformStream,
|
|
15151
15738
|
progressEventDecorator(
|
|
15152
15739
|
responseLength,
|
|
15153
|
-
progressEventReducer(
|
|
15740
|
+
progressEventReducer(
|
|
15741
|
+
asyncDecorator(onDownloadProgress, scheduleProgress),
|
|
15742
|
+
true,
|
|
15743
|
+
3
|
|
15744
|
+
)
|
|
15154
15745
|
)
|
|
15155
15746
|
)
|
|
15156
15747
|
);
|
|
@@ -15299,12 +15890,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
15299
15890
|
socket.setKeepAlive(true, 1e3 * 60);
|
|
15300
15891
|
}
|
|
15301
15892
|
if (!socket[kAxiosSocketListener]) {
|
|
15302
|
-
socket.on("error",
|
|
15303
|
-
const current = socket[kAxiosCurrentReq];
|
|
15304
|
-
if (current && !current.destroyed) {
|
|
15305
|
-
current.destroy(err);
|
|
15306
|
-
}
|
|
15307
|
-
});
|
|
15893
|
+
socket.on("error", handleSocketError);
|
|
15308
15894
|
socket[kAxiosSocketListener] = true;
|
|
15309
15895
|
}
|
|
15310
15896
|
socket[kAxiosCurrentReq] = req;
|
|
@@ -15464,6 +16050,16 @@ var cookies_default = platform_default.hasStandardBrowserEnv ? (
|
|
|
15464
16050
|
|
|
15465
16051
|
// ../node_modules/axios/lib/core/mergeConfig.js
|
|
15466
16052
|
var headersToObject = (thing) => thing instanceof AxiosHeaders_default ? { ...thing } : thing;
|
|
16053
|
+
var ownEnumerableKeys = (thing) => {
|
|
16054
|
+
if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
|
|
16055
|
+
return Object.keys(thing).concat(
|
|
16056
|
+
Object.getOwnPropertySymbols(thing).filter(
|
|
16057
|
+
(symbol) => Object.getOwnPropertyDescriptor(thing, symbol).enumerable
|
|
16058
|
+
)
|
|
16059
|
+
);
|
|
16060
|
+
}
|
|
16061
|
+
return Object.keys(thing);
|
|
16062
|
+
};
|
|
15467
16063
|
function mergeConfig(config1, config2) {
|
|
15468
16064
|
config1 = config1 || {};
|
|
15469
16065
|
config2 = config2 || {};
|
|
@@ -15539,7 +16135,7 @@ function mergeConfig(config1, config2) {
|
|
|
15539
16135
|
transformResponse: defaultToConfig2,
|
|
15540
16136
|
paramsSerializer: defaultToConfig2,
|
|
15541
16137
|
timeout: defaultToConfig2,
|
|
15542
|
-
|
|
16138
|
+
timeoutErrorMessage: defaultToConfig2,
|
|
15543
16139
|
withCredentials: defaultToConfig2,
|
|
15544
16140
|
withXSRFToken: defaultToConfig2,
|
|
15545
16141
|
adapter: defaultToConfig2,
|
|
@@ -15562,7 +16158,7 @@ function mergeConfig(config1, config2) {
|
|
|
15562
16158
|
validateStatus: mergeDirectKeys,
|
|
15563
16159
|
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
15564
16160
|
};
|
|
15565
|
-
utils_default.forEach(
|
|
16161
|
+
utils_default.forEach(ownEnumerableKeys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
15566
16162
|
if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
|
|
15567
16163
|
const merge2 = utils_default.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
15568
16164
|
const a = utils_default.hasOwnProp(config1, prop) ? config1[prop] : void 0;
|
|
@@ -15581,18 +16177,6 @@ function mergeConfig(config1, config2) {
|
|
|
15581
16177
|
}
|
|
15582
16178
|
|
|
15583
16179
|
// ../node_modules/axios/lib/helpers/resolveConfig.js
|
|
15584
|
-
var FORM_DATA_CONTENT_HEADERS2 = ["content-type", "content-length"];
|
|
15585
|
-
function setFormDataHeaders2(headers, formHeaders, policy) {
|
|
15586
|
-
if (policy !== "content-only") {
|
|
15587
|
-
headers.set(formHeaders);
|
|
15588
|
-
return;
|
|
15589
|
-
}
|
|
15590
|
-
Object.entries(formHeaders || {}).forEach(([key, val]) => {
|
|
15591
|
-
if (FORM_DATA_CONTENT_HEADERS2.includes(key.toLowerCase())) {
|
|
15592
|
-
headers.set(key, val);
|
|
15593
|
-
}
|
|
15594
|
-
});
|
|
15595
|
-
}
|
|
15596
16180
|
var encodeUTF8 = (str) => encodeURIComponent(str).replace(
|
|
15597
16181
|
/%([0-9A-F]{2})/gi,
|
|
15598
16182
|
(_, hex) => String.fromCharCode(parseInt(hex, 16))
|
|
@@ -15628,10 +16212,11 @@ function resolveConfig(config) {
|
|
|
15628
16212
|
}
|
|
15629
16213
|
}
|
|
15630
16214
|
if (utils_default.isFormData(data)) {
|
|
16215
|
+
const getHeaders = utils_default.getSafeProp(data, "getHeaders");
|
|
15631
16216
|
if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv || utils_default.isReactNative(data)) {
|
|
15632
16217
|
headers.setContentType(void 0);
|
|
15633
|
-
} else if (utils_default.isFunction(
|
|
15634
|
-
|
|
16218
|
+
} else if (utils_default.isFunction(getHeaders)) {
|
|
16219
|
+
setFormDataHeaders(headers, getHeaders.call(data), own2("formDataHeaderPolicy"));
|
|
15635
16220
|
}
|
|
15636
16221
|
}
|
|
15637
16222
|
if (platform_default.hasStandardBrowserEnv) {
|
|
@@ -15660,7 +16245,7 @@ var xhr_default = isXHRAdapterSupported && function(config) {
|
|
|
15660
16245
|
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
15661
16246
|
let onCanceled;
|
|
15662
16247
|
let uploadThrottled, downloadThrottled;
|
|
15663
|
-
let flushUpload, flushDownload;
|
|
16248
|
+
let flushUpload, flushDownload, flushDownloadWithEvent;
|
|
15664
16249
|
function done() {
|
|
15665
16250
|
flushUpload && flushUpload();
|
|
15666
16251
|
flushDownload && flushDownload();
|
|
@@ -15670,7 +16255,27 @@ var xhr_default = isXHRAdapterSupported && function(config) {
|
|
|
15670
16255
|
let request = new XMLHttpRequest();
|
|
15671
16256
|
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
15672
16257
|
request.timeout = _config.timeout;
|
|
15673
|
-
function onloadend() {
|
|
16258
|
+
function onloadend(event) {
|
|
16259
|
+
if (!request) {
|
|
16260
|
+
return;
|
|
16261
|
+
}
|
|
16262
|
+
if (request.status === 0 && (parseProtocol(normalizeURLForProtocolCheck(_config.url)) || parseProtocol(platform_default.origin)) !== "file" && !(request.responseURL && request.responseURL.startsWith("file:"))) {
|
|
16263
|
+
reject(new AxiosError_default("Request aborted", AxiosError_default.ECONNABORTED, config, request));
|
|
16264
|
+
done();
|
|
16265
|
+
request = null;
|
|
16266
|
+
return;
|
|
16267
|
+
}
|
|
16268
|
+
try {
|
|
16269
|
+
if (event) {
|
|
16270
|
+
flushDownloadWithEvent && flushDownloadWithEvent(event);
|
|
16271
|
+
} else {
|
|
16272
|
+
flushDownload && flushDownload();
|
|
16273
|
+
}
|
|
16274
|
+
} catch (err) {
|
|
16275
|
+
setTimeout(() => {
|
|
16276
|
+
throw err;
|
|
16277
|
+
});
|
|
16278
|
+
}
|
|
15674
16279
|
if (!request) {
|
|
15675
16280
|
return;
|
|
15676
16281
|
}
|
|
@@ -15758,7 +16363,10 @@ var xhr_default = isXHRAdapterSupported && function(config) {
|
|
|
15758
16363
|
request.responseType = _config.responseType;
|
|
15759
16364
|
}
|
|
15760
16365
|
if (onDownloadProgress) {
|
|
15761
|
-
[downloadThrottled, flushDownload] = progressEventReducer(
|
|
16366
|
+
[downloadThrottled, flushDownload, flushDownloadWithEvent] = progressEventReducer(
|
|
16367
|
+
onDownloadProgress,
|
|
16368
|
+
true
|
|
16369
|
+
);
|
|
15762
16370
|
request.addEventListener("progress", downloadThrottled);
|
|
15763
16371
|
}
|
|
15764
16372
|
if (onUploadProgress && request.upload) {
|
|
@@ -15830,7 +16438,16 @@ var composeSignals = (signals, timeout) => {
|
|
|
15830
16438
|
});
|
|
15831
16439
|
signals = null;
|
|
15832
16440
|
};
|
|
15833
|
-
signals.forEach((signal2) =>
|
|
16441
|
+
signals.forEach((signal2) => {
|
|
16442
|
+
if (aborted) {
|
|
16443
|
+
return;
|
|
16444
|
+
}
|
|
16445
|
+
if (signal2.aborted) {
|
|
16446
|
+
onabort.call(signal2);
|
|
16447
|
+
return;
|
|
16448
|
+
}
|
|
16449
|
+
signal2.addEventListener("abort", onabort, { once: true });
|
|
16450
|
+
});
|
|
15834
16451
|
const { signal } = controller;
|
|
15835
16452
|
signal.unsubscribe = () => utils_default.asap(unsubscribe);
|
|
15836
16453
|
return signal;
|
|
@@ -15919,6 +16536,17 @@ var trackStream = (stream4, chunkSize, onProgress, onFinish) => {
|
|
|
15919
16536
|
|
|
15920
16537
|
// ../node_modules/axios/lib/adapters/fetch.js
|
|
15921
16538
|
var DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
16539
|
+
var DEFAULT_REQUEST_OPTIONS = {
|
|
16540
|
+
cache: "default",
|
|
16541
|
+
redirect: "follow",
|
|
16542
|
+
referrer: "about:client",
|
|
16543
|
+
referrerPolicy: "",
|
|
16544
|
+
mode: "cors",
|
|
16545
|
+
integrity: "",
|
|
16546
|
+
keepalive: false,
|
|
16547
|
+
priority: "auto",
|
|
16548
|
+
window: null
|
|
16549
|
+
};
|
|
15922
16550
|
var { isFunction: isFunction2 } = utils_default;
|
|
15923
16551
|
var encodeUTF82 = (str) => encodeURIComponent(str).replace(
|
|
15924
16552
|
/%([0-9A-F]{2})/gi,
|
|
@@ -16049,7 +16677,8 @@ var factory = (env) => {
|
|
|
16049
16677
|
withCredentials = "same-origin",
|
|
16050
16678
|
fetchOptions,
|
|
16051
16679
|
maxContentLength,
|
|
16052
|
-
maxBodyLength
|
|
16680
|
+
maxBodyLength,
|
|
16681
|
+
maxRedirects
|
|
16053
16682
|
} = resolveConfig_default(config);
|
|
16054
16683
|
const hasMaxContentLength = utils_default.isNumber(maxContentLength) && maxContentLength > -1;
|
|
16055
16684
|
const hasMaxBodyLength = utils_default.isNumber(maxBodyLength) && maxBodyLength > -1;
|
|
@@ -16179,17 +16808,44 @@ var factory = (env) => {
|
|
|
16179
16808
|
}
|
|
16180
16809
|
}
|
|
16181
16810
|
headers.set("User-Agent", "axios/" + VERSION, false);
|
|
16182
|
-
const
|
|
16183
|
-
|
|
16811
|
+
const safeFetchOptions = fetchOptions == null ? fetchOptions : Object.assign(/* @__PURE__ */ Object.create(null), fetchOptions);
|
|
16812
|
+
if (safeFetchOptions) {
|
|
16813
|
+
delete safeFetchOptions.body;
|
|
16814
|
+
delete safeFetchOptions.headers;
|
|
16815
|
+
delete safeFetchOptions.method;
|
|
16816
|
+
delete safeFetchOptions.signal;
|
|
16817
|
+
delete safeFetchOptions.duplex;
|
|
16818
|
+
delete safeFetchOptions.credentials;
|
|
16819
|
+
}
|
|
16820
|
+
const resolvedOptions = Object.assign(/* @__PURE__ */ Object.create(null), safeFetchOptions, {
|
|
16184
16821
|
signal: composedSignal,
|
|
16185
16822
|
method: method.toUpperCase(),
|
|
16186
16823
|
headers: toByteStringHeaderObject(headers.normalize()),
|
|
16187
16824
|
body: data,
|
|
16188
16825
|
duplex: "half",
|
|
16189
16826
|
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
16190
|
-
};
|
|
16827
|
+
});
|
|
16828
|
+
if (isRequestSupported) {
|
|
16829
|
+
utils_default.forEach(DEFAULT_REQUEST_OPTIONS, (value, key) => {
|
|
16830
|
+
if (resolvedOptions[key] === void 0) {
|
|
16831
|
+
resolvedOptions[key] = value;
|
|
16832
|
+
}
|
|
16833
|
+
});
|
|
16834
|
+
if (resolvedOptions.signal === void 0) {
|
|
16835
|
+
resolvedOptions.signal = null;
|
|
16836
|
+
}
|
|
16837
|
+
if (resolvedOptions.body === void 0) {
|
|
16838
|
+
resolvedOptions.body = null;
|
|
16839
|
+
}
|
|
16840
|
+
}
|
|
16841
|
+
if (maxRedirects === 0) {
|
|
16842
|
+
resolvedOptions.redirect = "manual";
|
|
16843
|
+
if (safeFetchOptions) {
|
|
16844
|
+
safeFetchOptions.redirect = "manual";
|
|
16845
|
+
}
|
|
16846
|
+
}
|
|
16191
16847
|
request = isRequestSupported && new Request(url2, resolvedOptions);
|
|
16192
|
-
let response = await (isRequestSupported ? _fetch(request,
|
|
16848
|
+
let response = await (isRequestSupported ? _fetch(request, safeFetchOptions) : _fetch(url2, resolvedOptions));
|
|
16193
16849
|
const responseHeaders = AxiosHeaders_default.from(response.headers);
|
|
16194
16850
|
if (hasMaxContentLength) {
|
|
16195
16851
|
const declaredLength = utils_default.toFiniteNumber(responseHeaders.getContentLength());
|
|
@@ -16408,9 +17064,10 @@ function throwIfCancellationRequested(config) {
|
|
|
16408
17064
|
throw new CanceledError_default(null, config);
|
|
16409
17065
|
}
|
|
16410
17066
|
}
|
|
16411
|
-
function dispatchRequest(
|
|
17067
|
+
function dispatchRequest(_config) {
|
|
17068
|
+
const config = utils_default.toSafeFlatObject(_config);
|
|
16412
17069
|
throwIfCancellationRequested(config);
|
|
16413
|
-
config.headers = AxiosHeaders_default.from(config
|
|
17070
|
+
config.headers = AxiosHeaders_default.from(utils_default.getSafeProp(config, "headers"));
|
|
16414
17071
|
config.data = transformData.call(config, config.transformRequest);
|
|
16415
17072
|
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
|
|
16416
17073
|
config.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
@@ -16540,16 +17197,15 @@ var Axios = class {
|
|
|
16540
17197
|
return await this._request(configOrUrl, config);
|
|
16541
17198
|
} catch (err) {
|
|
16542
17199
|
if (err instanceof Error) {
|
|
16543
|
-
let dummy = {};
|
|
16544
|
-
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
|
|
16545
|
-
const stack = (() => {
|
|
16546
|
-
if (!dummy.stack) {
|
|
16547
|
-
return "";
|
|
16548
|
-
}
|
|
16549
|
-
const firstNewlineIndex = dummy.stack.indexOf("\n");
|
|
16550
|
-
return firstNewlineIndex === -1 ? "" : dummy.stack.slice(firstNewlineIndex + 1);
|
|
16551
|
-
})();
|
|
16552
17200
|
try {
|
|
17201
|
+
let dummy = {};
|
|
17202
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
|
|
17203
|
+
const dummyStack = dummy.stack;
|
|
17204
|
+
let stack = "";
|
|
17205
|
+
if (typeof dummyStack === "string") {
|
|
17206
|
+
const firstNewlineIndex = dummyStack.indexOf("\n");
|
|
17207
|
+
stack = firstNewlineIndex === -1 ? "" : dummyStack.slice(firstNewlineIndex + 1);
|
|
17208
|
+
}
|
|
16553
17209
|
if (!err.stack) {
|
|
16554
17210
|
err.stack = stack;
|
|
16555
17211
|
} else if (stack) {
|
|
@@ -16618,9 +17274,9 @@ var Axios = class {
|
|
|
16618
17274
|
},
|
|
16619
17275
|
true
|
|
16620
17276
|
);
|
|
16621
|
-
config.method = (config
|
|
17277
|
+
config.method = (utils_default.getSafeProp(config, "method") || utils_default.getSafeProp(this.defaults, "method") || "get").toLowerCase();
|
|
16622
17278
|
let contextHeaders = headers && utils_default.merge(headers.common, headers[config.method]);
|
|
16623
|
-
headers && utils_default.forEach(
|
|
17279
|
+
headers && utils_default.forEach(methodList_default.concat("common"), (method) => {
|
|
16624
17280
|
delete headers[method];
|
|
16625
17281
|
});
|
|
16626
17282
|
config.headers = AxiosHeaders_default.concat(contextHeaders, headers);
|
|
@@ -16663,16 +17319,31 @@ var Axios = class {
|
|
|
16663
17319
|
const onFulfilled = requestInterceptorChain[i++];
|
|
16664
17320
|
const onRejected = requestInterceptorChain[i++];
|
|
16665
17321
|
try {
|
|
16666
|
-
newConfig = onFulfilled(newConfig);
|
|
17322
|
+
newConfig = onFulfilled ? onFulfilled(newConfig) : newConfig;
|
|
16667
17323
|
} catch (error) {
|
|
16668
|
-
onRejected
|
|
17324
|
+
if (!onRejected) {
|
|
17325
|
+
promise = Promise.reject(error);
|
|
17326
|
+
break;
|
|
17327
|
+
}
|
|
17328
|
+
try {
|
|
17329
|
+
const rejectedResult = onRejected.call(this, error);
|
|
17330
|
+
if (utils_default.isThenable(rejectedResult)) {
|
|
17331
|
+
promise = Promise.resolve(rejectedResult).then(
|
|
17332
|
+
() => dispatchRequest.call(this, newConfig)
|
|
17333
|
+
);
|
|
17334
|
+
}
|
|
17335
|
+
} catch (rejectedError) {
|
|
17336
|
+
promise = Promise.reject(rejectedError);
|
|
17337
|
+
}
|
|
16669
17338
|
break;
|
|
16670
17339
|
}
|
|
16671
17340
|
}
|
|
16672
|
-
|
|
16673
|
-
|
|
16674
|
-
|
|
16675
|
-
|
|
17341
|
+
if (!promise) {
|
|
17342
|
+
try {
|
|
17343
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
17344
|
+
} catch (error) {
|
|
17345
|
+
promise = Promise.reject(error);
|
|
17346
|
+
}
|
|
16676
17347
|
}
|
|
16677
17348
|
i = 0;
|
|
16678
17349
|
len = responseInterceptorChain.length;
|
|
@@ -16868,14 +17539,22 @@ var HttpStatusCode = {
|
|
|
16868
17539
|
Gone: 410,
|
|
16869
17540
|
LengthRequired: 411,
|
|
16870
17541
|
PreconditionFailed: 412,
|
|
17542
|
+
/**
|
|
17543
|
+
* @deprecated Use `ContentTooLarge` instead.
|
|
17544
|
+
*/
|
|
16871
17545
|
PayloadTooLarge: 413,
|
|
17546
|
+
ContentTooLarge: 413,
|
|
16872
17547
|
UriTooLong: 414,
|
|
16873
17548
|
UnsupportedMediaType: 415,
|
|
16874
17549
|
RangeNotSatisfiable: 416,
|
|
16875
17550
|
ExpectationFailed: 417,
|
|
16876
17551
|
ImATeapot: 418,
|
|
16877
17552
|
MisdirectedRequest: 421,
|
|
17553
|
+
/**
|
|
17554
|
+
* @deprecated Use `UnprocessableContent` instead.
|
|
17555
|
+
*/
|
|
16878
17556
|
UnprocessableEntity: 422,
|
|
17557
|
+
UnprocessableContent: 422,
|
|
16879
17558
|
Locked: 423,
|
|
16880
17559
|
FailedDependency: 424,
|
|
16881
17560
|
TooEarly: 425,
|
|
@@ -16895,6 +17574,7 @@ var HttpStatusCode = {
|
|
|
16895
17574
|
LoopDetected: 508,
|
|
16896
17575
|
NotExtended: 510,
|
|
16897
17576
|
NetworkAuthenticationRequired: 511,
|
|
17577
|
+
WebServerReturnsAnUnknownError: 520,
|
|
16898
17578
|
WebServerIsDown: 521,
|
|
16899
17579
|
ConnectionTimedOut: 522,
|
|
16900
17580
|
OriginIsUnreachable: 523,
|
|
@@ -16903,7 +17583,9 @@ var HttpStatusCode = {
|
|
|
16903
17583
|
InvalidSslCertificate: 526
|
|
16904
17584
|
};
|
|
16905
17585
|
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
16906
|
-
HttpStatusCode[value]
|
|
17586
|
+
if (HttpStatusCode[value] === void 0) {
|
|
17587
|
+
HttpStatusCode[value] = key;
|
|
17588
|
+
}
|
|
16907
17589
|
});
|
|
16908
17590
|
var HttpStatusCode_default = HttpStatusCode;
|
|
16909
17591
|
|
|
@@ -17244,6 +17926,16 @@ function transformError(error) {
|
|
|
17244
17926
|
}
|
|
17245
17927
|
return new Posty5Error("An unknown error occurred", void 0, void 0, { originalError: error });
|
|
17246
17928
|
}
|
|
17929
|
+
function parseFileName(disposition) {
|
|
17930
|
+
if (!disposition) return void 0;
|
|
17931
|
+
const match = /filename\*?=(?:UTF-8'')?"?([^";]+)"?/i.exec(disposition);
|
|
17932
|
+
if (!match) return void 0;
|
|
17933
|
+
try {
|
|
17934
|
+
return decodeURIComponent(match[1]);
|
|
17935
|
+
} catch {
|
|
17936
|
+
return match[1];
|
|
17937
|
+
}
|
|
17938
|
+
}
|
|
17247
17939
|
var HttpClient = class {
|
|
17248
17940
|
constructor(config = {}) {
|
|
17249
17941
|
this.config = {
|
|
@@ -17386,6 +18078,28 @@ var HttpClient = class {
|
|
|
17386
18078
|
throw transformError(error);
|
|
17387
18079
|
}
|
|
17388
18080
|
}
|
|
18081
|
+
/**
|
|
18082
|
+
* Make a GET request for a file download.
|
|
18083
|
+
*
|
|
18084
|
+
* Separate from `get` rather than a flag on it: a download answers with the
|
|
18085
|
+
* file itself, not with the `{ message, result }` envelope every other
|
|
18086
|
+
* endpoint uses, so it cannot share the return type.
|
|
18087
|
+
*/
|
|
18088
|
+
async getBinary(url2, config) {
|
|
18089
|
+
try {
|
|
18090
|
+
const response = await this.axiosInstance.get(url2, {
|
|
18091
|
+
...this.buildConfig(config),
|
|
18092
|
+
responseType: "arraybuffer"
|
|
18093
|
+
});
|
|
18094
|
+
return {
|
|
18095
|
+
data: response.data,
|
|
18096
|
+
contentType: String(response.headers?.["content-type"] || "application/octet-stream"),
|
|
18097
|
+
fileName: parseFileName(response.headers?.["content-disposition"])
|
|
18098
|
+
};
|
|
18099
|
+
} catch (error) {
|
|
18100
|
+
throw transformError(error);
|
|
18101
|
+
}
|
|
18102
|
+
}
|
|
17389
18103
|
/**
|
|
17390
18104
|
* Build axios config from request config
|
|
17391
18105
|
*/
|
|
@@ -17460,6 +18174,169 @@ async function uploadToR2(presignedUrl, fileOrBlob, options = {}) {
|
|
|
17460
18174
|
}
|
|
17461
18175
|
}
|
|
17462
18176
|
|
|
18177
|
+
// src/resumable-upload.ts
|
|
18178
|
+
var TUS_VERSION = "1.0.0";
|
|
18179
|
+
var DEFAULT_CHUNK_SIZE2 = 8 * 1024 * 1024;
|
|
18180
|
+
var RETRY_DELAYS = [0, 1e3, 3e3, 5e3, 1e4];
|
|
18181
|
+
var MAX_CONSECUTIVE_STALLS = 3;
|
|
18182
|
+
function encodeMetadata(pairs) {
|
|
18183
|
+
return Object.entries(pairs).filter(([, value]) => value !== void 0 && value !== null && value !== "").map(([key, value]) => `${key} ${toBase64(value)}`).join(",");
|
|
18184
|
+
}
|
|
18185
|
+
function toBase64(value) {
|
|
18186
|
+
if (typeof btoa === "function") {
|
|
18187
|
+
return btoa(String.fromCharCode(...new TextEncoder().encode(value)));
|
|
18188
|
+
}
|
|
18189
|
+
return Buffer.from(value, "utf8").toString("base64");
|
|
18190
|
+
}
|
|
18191
|
+
var wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
18192
|
+
function isAborted(signal) {
|
|
18193
|
+
return !!signal?.aborted;
|
|
18194
|
+
}
|
|
18195
|
+
function abortError() {
|
|
18196
|
+
const error = new Error("Upload aborted");
|
|
18197
|
+
error.name = "AbortError";
|
|
18198
|
+
return error;
|
|
18199
|
+
}
|
|
18200
|
+
function supportsResumableUpload(target) {
|
|
18201
|
+
return !!target.tusEndpoint && !!target.ticket;
|
|
18202
|
+
}
|
|
18203
|
+
async function createUpload(target, size, filename, filetype, signal) {
|
|
18204
|
+
const response = await fetch(target.tusEndpoint, {
|
|
18205
|
+
method: "POST",
|
|
18206
|
+
headers: {
|
|
18207
|
+
"Tus-Resumable": TUS_VERSION,
|
|
18208
|
+
"Upload-Length": String(size),
|
|
18209
|
+
"Upload-Metadata": encodeMetadata({ ticket: target.ticket, filename, filetype })
|
|
18210
|
+
},
|
|
18211
|
+
signal
|
|
18212
|
+
});
|
|
18213
|
+
if (response.status !== 201) {
|
|
18214
|
+
throw new Error(`Could not start the upload (${response.status}): ${await safeText(response)}`);
|
|
18215
|
+
}
|
|
18216
|
+
const location = response.headers.get("Location");
|
|
18217
|
+
if (!location) {
|
|
18218
|
+
throw new Error("Upload was created but the server returned no Location header.");
|
|
18219
|
+
}
|
|
18220
|
+
return new URL(location, target.tusEndpoint).toString();
|
|
18221
|
+
}
|
|
18222
|
+
async function getOffset(uploadUrl, signal) {
|
|
18223
|
+
const response = await fetch(uploadUrl, {
|
|
18224
|
+
method: "HEAD",
|
|
18225
|
+
headers: { "Tus-Resumable": TUS_VERSION },
|
|
18226
|
+
signal
|
|
18227
|
+
});
|
|
18228
|
+
if (response.status === 404 || response.status === 410) {
|
|
18229
|
+
throw new Error("This upload has expired on the server and cannot be resumed.");
|
|
18230
|
+
}
|
|
18231
|
+
if (!response.ok) {
|
|
18232
|
+
throw new Error(`Could not read the upload's progress (${response.status}).`);
|
|
18233
|
+
}
|
|
18234
|
+
return Number(response.headers.get("Upload-Offset") ?? 0);
|
|
18235
|
+
}
|
|
18236
|
+
async function terminateUpload(uploadUrl) {
|
|
18237
|
+
try {
|
|
18238
|
+
const response = await fetch(uploadUrl, {
|
|
18239
|
+
method: "DELETE",
|
|
18240
|
+
headers: { "Tus-Resumable": TUS_VERSION }
|
|
18241
|
+
});
|
|
18242
|
+
return response.status === 204 || response.status === 404 || response.status === 410;
|
|
18243
|
+
} catch {
|
|
18244
|
+
return false;
|
|
18245
|
+
}
|
|
18246
|
+
}
|
|
18247
|
+
async function safeText(response) {
|
|
18248
|
+
try {
|
|
18249
|
+
return (await response.text()).slice(0, 300);
|
|
18250
|
+
} catch {
|
|
18251
|
+
return "";
|
|
18252
|
+
}
|
|
18253
|
+
}
|
|
18254
|
+
async function patchChunk(uploadUrl, chunk, offset, signal) {
|
|
18255
|
+
let lastError;
|
|
18256
|
+
for (let attempt = 0; attempt < RETRY_DELAYS.length; attempt++) {
|
|
18257
|
+
if (isAborted(signal)) throw abortError();
|
|
18258
|
+
if (RETRY_DELAYS[attempt]) await wait(RETRY_DELAYS[attempt]);
|
|
18259
|
+
try {
|
|
18260
|
+
const response = await fetch(uploadUrl, {
|
|
18261
|
+
method: "PATCH",
|
|
18262
|
+
headers: {
|
|
18263
|
+
"Tus-Resumable": TUS_VERSION,
|
|
18264
|
+
"Upload-Offset": String(offset),
|
|
18265
|
+
"Content-Type": "application/offset+octet-stream"
|
|
18266
|
+
},
|
|
18267
|
+
body: chunk,
|
|
18268
|
+
signal
|
|
18269
|
+
});
|
|
18270
|
+
if (response.status === 204) {
|
|
18271
|
+
return Number(response.headers.get("Upload-Offset") ?? offset + chunk.size);
|
|
18272
|
+
}
|
|
18273
|
+
if (response.status === 409) {
|
|
18274
|
+
return await getOffset(uploadUrl, signal);
|
|
18275
|
+
}
|
|
18276
|
+
if (response.status >= 400 && response.status < 500) {
|
|
18277
|
+
throw new Error(`Upload rejected (${response.status}): ${await safeText(response)}`);
|
|
18278
|
+
}
|
|
18279
|
+
lastError = new Error(`Upload failed (${response.status})`);
|
|
18280
|
+
} catch (error) {
|
|
18281
|
+
if (error?.name === "AbortError") throw error;
|
|
18282
|
+
if (/^Upload rejected/.test(error?.message || "")) throw error;
|
|
18283
|
+
lastError = error;
|
|
18284
|
+
}
|
|
18285
|
+
}
|
|
18286
|
+
throw lastError instanceof Error ? lastError : new Error("Upload failed");
|
|
18287
|
+
}
|
|
18288
|
+
async function uploadResumable(target, file, options = {}) {
|
|
18289
|
+
const { onProgress, onUploadUrl, chunkSize = DEFAULT_CHUNK_SIZE2, signal, fallbackType = "application/octet-stream", terminateOnAbort = false } = options;
|
|
18290
|
+
if (!supportsResumableUpload(target)) {
|
|
18291
|
+
throw new Error("This upload target does not support resumable uploads.");
|
|
18292
|
+
}
|
|
18293
|
+
if (target.maxSize && file.size > target.maxSize) {
|
|
18294
|
+
const limitMb = Math.round(target.maxSize / (1024 * 1024));
|
|
18295
|
+
throw new Error(`This file is larger than the ${limitMb}MB limit.`);
|
|
18296
|
+
}
|
|
18297
|
+
if (isAborted(signal)) throw abortError();
|
|
18298
|
+
const filename = file.name || "upload";
|
|
18299
|
+
const filetype = file.type || fallbackType;
|
|
18300
|
+
let uploadUrl = options.uploadUrl;
|
|
18301
|
+
let offset = 0;
|
|
18302
|
+
if (uploadUrl) {
|
|
18303
|
+
offset = await getOffset(uploadUrl, signal);
|
|
18304
|
+
} else {
|
|
18305
|
+
uploadUrl = await createUpload(target, file.size, filename, filetype, signal);
|
|
18306
|
+
onUploadUrl?.(uploadUrl);
|
|
18307
|
+
}
|
|
18308
|
+
const discardIfAsked = async () => {
|
|
18309
|
+
if (terminateOnAbort && uploadUrl) await terminateUpload(uploadUrl);
|
|
18310
|
+
};
|
|
18311
|
+
onProgress?.(file.size ? Math.round(offset / file.size * 100) : 0);
|
|
18312
|
+
let consecutiveStalls = 0;
|
|
18313
|
+
while (offset < file.size) {
|
|
18314
|
+
if (isAborted(signal)) {
|
|
18315
|
+
await discardIfAsked();
|
|
18316
|
+
throw abortError();
|
|
18317
|
+
}
|
|
18318
|
+
const end = Math.min(offset + chunkSize, file.size);
|
|
18319
|
+
let next;
|
|
18320
|
+
try {
|
|
18321
|
+
next = await patchChunk(uploadUrl, file.slice(offset, end), offset, signal);
|
|
18322
|
+
} catch (error) {
|
|
18323
|
+
if (error?.name === "AbortError") await discardIfAsked();
|
|
18324
|
+
throw error;
|
|
18325
|
+
}
|
|
18326
|
+
if (next <= offset) {
|
|
18327
|
+
if (++consecutiveStalls >= MAX_CONSECUTIVE_STALLS) {
|
|
18328
|
+
throw new Error("The upload stopped making progress and was abandoned.");
|
|
18329
|
+
}
|
|
18330
|
+
continue;
|
|
18331
|
+
}
|
|
18332
|
+
consecutiveStalls = 0;
|
|
18333
|
+
offset = next;
|
|
18334
|
+
onProgress?.(Math.round(offset / file.size * 100));
|
|
18335
|
+
}
|
|
18336
|
+
onProgress?.(100);
|
|
18337
|
+
return target.fileURL;
|
|
18338
|
+
}
|
|
18339
|
+
|
|
17463
18340
|
// src/social-publisher-post.client.ts
|
|
17464
18341
|
var SocialPublisherPostClient = class {
|
|
17465
18342
|
constructor(http3) {
|
|
@@ -17505,6 +18382,29 @@ var SocialPublisherPostClient = class {
|
|
|
17505
18382
|
const response = await this.http.post(`${this.basePath}/generate-upload-urls`, data);
|
|
17506
18383
|
return response.result;
|
|
17507
18384
|
}
|
|
18385
|
+
/**
|
|
18386
|
+
* Remove (delete) a post's published media directly from the connected
|
|
18387
|
+
* platform pages. Runs synchronously on the server — the media is deleted
|
|
18388
|
+
* from the platform immediately, not via a background job.
|
|
18389
|
+
*
|
|
18390
|
+
* Cost: 50 credits, charged ONLY when the removal succeeds (at least one
|
|
18391
|
+
* platform cleared and no delete-capable platform failed). Instagram and
|
|
18392
|
+
* TikTok expose no delete API, so a post published only to those platforms
|
|
18393
|
+
* cannot be removed programmatically and no credits are charged.
|
|
18394
|
+
*
|
|
18395
|
+
* @param id - Post ID
|
|
18396
|
+
* @returns Per-platform removal results
|
|
18397
|
+
*
|
|
18398
|
+
* @example
|
|
18399
|
+
* ```ts
|
|
18400
|
+
* const { results } = await client.removePost("post_123");
|
|
18401
|
+
* // results.youtube?.success === true
|
|
18402
|
+
* ```
|
|
18403
|
+
*/
|
|
18404
|
+
async removePost(id) {
|
|
18405
|
+
const response = await this.http.post(`${this.basePath}/${id}/remove`, {});
|
|
18406
|
+
return response.result;
|
|
18407
|
+
}
|
|
17508
18408
|
/**
|
|
17509
18409
|
* Get next and previous post IDs
|
|
17510
18410
|
* @param id - Current Post ID
|
|
@@ -17850,6 +18750,260 @@ var SocialPublisherPostClient = class {
|
|
|
17850
18750
|
async publishShortVideo(options) {
|
|
17851
18751
|
return this.publishShortVideoToWorkspace(options);
|
|
17852
18752
|
}
|
|
18753
|
+
// ─── Long video (up to 60 minutes) ───────────────────────────────────────
|
|
18754
|
+
/**
|
|
18755
|
+
* Price a long video before publishing it. Neither creates nor charges
|
|
18756
|
+
* anything.
|
|
18757
|
+
*
|
|
18758
|
+
* The server reads the video, measures its duration, and returns the exact
|
|
18759
|
+
* cost plus what each platform would do with a video that long. Show this
|
|
18760
|
+
* before the user commits — the units come from the same function the create
|
|
18761
|
+
* call charges with, so the quote and the bill cannot disagree.
|
|
18762
|
+
*
|
|
18763
|
+
* @param videoURL - URL of an uploaded or externally hosted video
|
|
18764
|
+
*
|
|
18765
|
+
* @example
|
|
18766
|
+
* ```ts
|
|
18767
|
+
* const quote = await client.getLongVideoQuote(fileURL);
|
|
18768
|
+
* if (!quote.withinLimit) throw new Error(quote.reason);
|
|
18769
|
+
* console.log(`${quote.durationSeconds}s costs ${quote.credits} credits`);
|
|
18770
|
+
* const blocked = quote.platforms.filter((p) => !p.accepted);
|
|
18771
|
+
* ```
|
|
18772
|
+
*/
|
|
18773
|
+
async getLongVideoQuote(videoURL) {
|
|
18774
|
+
if (!videoURL) {
|
|
18775
|
+
throw new Error("videoURL is required");
|
|
18776
|
+
}
|
|
18777
|
+
const response = await this.http.post(`${this.basePath}/long-video/quote`, { videoURL });
|
|
18778
|
+
return response.result;
|
|
18779
|
+
}
|
|
18780
|
+
/**
|
|
18781
|
+
* Publish a video of up to 60 minutes to every account connected to a
|
|
18782
|
+
* workspace.
|
|
18783
|
+
*
|
|
18784
|
+
* Handles the whole sequence for an uploaded file: request an upload
|
|
18785
|
+
* destination, push the bytes, then create the post. Pass a URL instead of a
|
|
18786
|
+
* `File` to publish something already hosted elsewhere.
|
|
18787
|
+
*
|
|
18788
|
+
* Cost is duration-based — 50 credits per started 5 minutes — so a 12-minute
|
|
18789
|
+
* video costs 150. Call {@link getLongVideoQuote} first if you need to show
|
|
18790
|
+
* the price. The duration is measured server-side; there is no duration
|
|
18791
|
+
* option here because a client-supplied one would be a client-supplied price.
|
|
18792
|
+
*
|
|
18793
|
+
* Platforms differ on what they accept: a 40-minute video publishes to
|
|
18794
|
+
* YouTube and Facebook but is refused by Instagram, whose Reels cap at 15
|
|
18795
|
+
* minutes. Those targets come back in `refusedTargets` — the post still
|
|
18796
|
+
* publishes to the rest.
|
|
18797
|
+
*
|
|
18798
|
+
* @example
|
|
18799
|
+
* ```ts
|
|
18800
|
+
* const result = await client.publishLongVideoToWorkspace({
|
|
18801
|
+
* workspaceId: "ws_123",
|
|
18802
|
+
* video: recordingFile,
|
|
18803
|
+
* youtube: { title: "Full session", description: "...", tags: ["workshop"] },
|
|
18804
|
+
* onProgress: (p) => console.log(`${p}%`),
|
|
18805
|
+
* });
|
|
18806
|
+
* console.log(`Charged ${result.credits} credits for ${result.durationSeconds}s`);
|
|
18807
|
+
* for (const t of result.refusedTargets) console.warn(t.reason);
|
|
18808
|
+
* ```
|
|
18809
|
+
*/
|
|
18810
|
+
async publishLongVideoToWorkspace(options) {
|
|
18811
|
+
if (!options.workspaceId) {
|
|
18812
|
+
throw new Error("workspaceId is required");
|
|
18813
|
+
}
|
|
18814
|
+
if (!options.video) {
|
|
18815
|
+
throw new Error("video is required");
|
|
18816
|
+
}
|
|
18817
|
+
if (!options.youtube && !options.tiktok && !options.facebook && !options.instagram) {
|
|
18818
|
+
throw new Error("Provide at least one platform configuration (youtube / tiktok / facebook / instagram)");
|
|
18819
|
+
}
|
|
18820
|
+
const isFile2 = this.detectVideoSource(options.video) === "file";
|
|
18821
|
+
const upload = isFile2 ? await this.uploadLongVideo(
|
|
18822
|
+
options.video,
|
|
18823
|
+
options.thumbnail,
|
|
18824
|
+
{
|
|
18825
|
+
onProgress: options.onProgress,
|
|
18826
|
+
onUploadUrl: options.onUploadUrl,
|
|
18827
|
+
resumeFrom: options.resumeFrom,
|
|
18828
|
+
signal: options.signal,
|
|
18829
|
+
terminateOnAbort: options.terminateOnAbort
|
|
18830
|
+
}
|
|
18831
|
+
) : void 0;
|
|
18832
|
+
const videoURL = upload ? upload.videoURL : options.video;
|
|
18833
|
+
const postId = upload?.postId;
|
|
18834
|
+
const thumb = await this.handleThumbnailUpload(options.thumbnail, upload?.uploadUrls);
|
|
18835
|
+
const body = {
|
|
18836
|
+
workspaceId: options.workspaceId,
|
|
18837
|
+
youtube: options.youtube,
|
|
18838
|
+
tiktok: options.tiktok,
|
|
18839
|
+
facebook: options.facebook,
|
|
18840
|
+
instagram: options.instagram,
|
|
18841
|
+
schedule: this.buildSchedule(options.schedule),
|
|
18842
|
+
source: isFile2 ? "video-file" : "video-url",
|
|
18843
|
+
videoURL,
|
|
18844
|
+
thumbURL: thumb?.thumbFileURL,
|
|
18845
|
+
tag: options.tag,
|
|
18846
|
+
refId: options.refId,
|
|
18847
|
+
comment: options.comment
|
|
18848
|
+
};
|
|
18849
|
+
const target = isFile2 ? "by-file" : "by-url";
|
|
18850
|
+
const id = postId ?? thumb?.postId;
|
|
18851
|
+
const url2 = id ? `${this.basePath}/long-video/workspace/${target}/${id}` : `${this.basePath}/long-video/workspace/${target}`;
|
|
18852
|
+
const response = await this.http.post(url2, { ...body, createdFrom: "npmPackage" });
|
|
18853
|
+
return this.normaliseLongVideoResult(response.result);
|
|
18854
|
+
}
|
|
18855
|
+
/**
|
|
18856
|
+
* Publish a video of up to 60 minutes to a single connected account.
|
|
18857
|
+
*
|
|
18858
|
+
* With one target there is no partial success: if that platform will not take
|
|
18859
|
+
* a video this long, the whole call is refused and nothing is charged. See
|
|
18860
|
+
* {@link publishLongVideoToWorkspace} for the cost model.
|
|
18861
|
+
*/
|
|
18862
|
+
async publishLongVideoToAccount(options) {
|
|
18863
|
+
if (!options.accountId) {
|
|
18864
|
+
throw new Error("accountId is required");
|
|
18865
|
+
}
|
|
18866
|
+
if (!options.video) {
|
|
18867
|
+
throw new Error("video is required");
|
|
18868
|
+
}
|
|
18869
|
+
if (!options.youtube && !options.tiktok && !options.facebook && !options.instagram) {
|
|
18870
|
+
throw new Error("Provide the platform configuration matching the account (youtube / tiktok / facebook / instagram)");
|
|
18871
|
+
}
|
|
18872
|
+
const isFile2 = this.detectVideoSource(options.video) === "file";
|
|
18873
|
+
const upload = isFile2 ? await this.uploadLongVideo(
|
|
18874
|
+
options.video,
|
|
18875
|
+
options.thumbnail,
|
|
18876
|
+
{
|
|
18877
|
+
onProgress: options.onProgress,
|
|
18878
|
+
onUploadUrl: options.onUploadUrl,
|
|
18879
|
+
resumeFrom: options.resumeFrom,
|
|
18880
|
+
signal: options.signal,
|
|
18881
|
+
terminateOnAbort: options.terminateOnAbort
|
|
18882
|
+
}
|
|
18883
|
+
) : void 0;
|
|
18884
|
+
const videoURL = upload ? upload.videoURL : options.video;
|
|
18885
|
+
const postId = upload?.postId;
|
|
18886
|
+
const thumb = await this.handleThumbnailUpload(options.thumbnail, upload?.uploadUrls);
|
|
18887
|
+
const body = {
|
|
18888
|
+
accountId: options.accountId,
|
|
18889
|
+
youtube: options.youtube,
|
|
18890
|
+
tiktok: options.tiktok,
|
|
18891
|
+
facebook: options.facebook,
|
|
18892
|
+
instagram: options.instagram,
|
|
18893
|
+
schedule: this.buildSchedule(options.schedule),
|
|
18894
|
+
source: isFile2 ? "video-file" : "video-url",
|
|
18895
|
+
videoURL,
|
|
18896
|
+
thumbURL: thumb?.thumbFileURL,
|
|
18897
|
+
tag: options.tag,
|
|
18898
|
+
refId: options.refId,
|
|
18899
|
+
comment: options.comment
|
|
18900
|
+
};
|
|
18901
|
+
const target = isFile2 ? "by-file" : "by-url";
|
|
18902
|
+
const id = postId ?? thumb?.postId;
|
|
18903
|
+
const url2 = id ? `${this.basePath}/long-video/account/${target}/${id}` : `${this.basePath}/long-video/account/${target}`;
|
|
18904
|
+
const response = await this.http.post(url2, { ...body, createdFrom: "npmPackage" });
|
|
18905
|
+
return this.normaliseLongVideoResult(response.result);
|
|
18906
|
+
}
|
|
18907
|
+
/**
|
|
18908
|
+
* Re-schedule a post that has not published yet, or send it out now.
|
|
18909
|
+
*
|
|
18910
|
+
* Free — this costs no credits. Only posts still pending with a future
|
|
18911
|
+
* publish time are eligible; anything that has started publishing is refused
|
|
18912
|
+
* by the server with a reason.
|
|
18913
|
+
*
|
|
18914
|
+
* @example
|
|
18915
|
+
* ```ts
|
|
18916
|
+
* await client.reschedulePost("post_123", { schedule: new Date("2026-09-01T09:00:00Z") });
|
|
18917
|
+
* await client.reschedulePost("post_123", { schedule: "now" });
|
|
18918
|
+
* ```
|
|
18919
|
+
*/
|
|
18920
|
+
async reschedulePost(id, data) {
|
|
18921
|
+
if (!id) {
|
|
18922
|
+
throw new Error("id is required");
|
|
18923
|
+
}
|
|
18924
|
+
await this.http.put(`${this.basePath}/${id}`, {
|
|
18925
|
+
schedule: this.buildSchedule(data.schedule),
|
|
18926
|
+
...data.caption !== void 0 ? { caption: data.caption } : {}
|
|
18927
|
+
});
|
|
18928
|
+
}
|
|
18929
|
+
/**
|
|
18930
|
+
* Delete a post that has not published yet, releasing its uploaded media in
|
|
18931
|
+
* the same request.
|
|
18932
|
+
*
|
|
18933
|
+
* Free, and nothing is refunded — nothing was charged for a post that never
|
|
18934
|
+
* went out. A post that HAS published is refused; use {@link removePost} to
|
|
18935
|
+
* take down media that is already live.
|
|
18936
|
+
*
|
|
18937
|
+
* @example
|
|
18938
|
+
* ```ts
|
|
18939
|
+
* await client.deletePost("post_123");
|
|
18940
|
+
* ```
|
|
18941
|
+
*/
|
|
18942
|
+
async deletePost(id) {
|
|
18943
|
+
if (!id) {
|
|
18944
|
+
throw new Error("id is required");
|
|
18945
|
+
}
|
|
18946
|
+
await this.http.delete(`${this.basePath}/${id}`);
|
|
18947
|
+
}
|
|
18948
|
+
/**
|
|
18949
|
+
* Upload a long video and return the URL to publish from.
|
|
18950
|
+
*
|
|
18951
|
+
* Declares `postType: "longVideo"` so the server refuses now — on plan gating
|
|
18952
|
+
* or an empty balance — rather than after an hour of transfer.
|
|
18953
|
+
*/
|
|
18954
|
+
async uploadLongVideo(video, thumb, controls = {}) {
|
|
18955
|
+
const { onProgress, onUploadUrl, resumeFrom, signal, terminateOnAbort } = controls;
|
|
18956
|
+
if (video.size > this.maxVideoUploadSizeBytes) {
|
|
18957
|
+
throw new Error(`Video file size (${video.size} bytes) exceeds maximum allowed size (${this.maxVideoUploadSizeBytes} bytes)`);
|
|
18958
|
+
}
|
|
18959
|
+
const allowedVideoTypes = [".mp4", ".mov", ".avi", ".mkv", ".webm"];
|
|
18960
|
+
const videoExtension = "." + video.name.split(".").pop()?.toLowerCase();
|
|
18961
|
+
if (!allowedVideoTypes.includes(videoExtension)) {
|
|
18962
|
+
throw new Error(`Invalid video file type. Allowed types: ${allowedVideoTypes.join(", ")}`);
|
|
18963
|
+
}
|
|
18964
|
+
const uploadUrls = await this.generateUploadUrls({
|
|
18965
|
+
videoFileType: video.type,
|
|
18966
|
+
thumbFileType: thumb instanceof File ? thumb.type : void 0,
|
|
18967
|
+
postType: "longVideo"
|
|
18968
|
+
});
|
|
18969
|
+
if (supportsResumableUpload(uploadUrls.video)) {
|
|
18970
|
+
await uploadResumable(uploadUrls.video, video, {
|
|
18971
|
+
onProgress,
|
|
18972
|
+
onUploadUrl,
|
|
18973
|
+
uploadUrl: resumeFrom,
|
|
18974
|
+
signal,
|
|
18975
|
+
terminateOnAbort
|
|
18976
|
+
});
|
|
18977
|
+
} else {
|
|
18978
|
+
await uploadToR2(uploadUrls.video.uploadFileURL, video, {
|
|
18979
|
+
contentType: video.type,
|
|
18980
|
+
onProgress
|
|
18981
|
+
});
|
|
18982
|
+
}
|
|
18983
|
+
return { videoURL: uploadUrls.video.fileURL, postId: uploadUrls.postId, uploadUrls };
|
|
18984
|
+
}
|
|
18985
|
+
/** Translate the friendly `"now" | Date` form into the wire shape. */
|
|
18986
|
+
buildSchedule(schedule) {
|
|
18987
|
+
if (!schedule) return void 0;
|
|
18988
|
+
return {
|
|
18989
|
+
type: schedule === "now" ? "now" : "schedule",
|
|
18990
|
+
scheduledAt: schedule instanceof Date ? schedule : void 0
|
|
18991
|
+
};
|
|
18992
|
+
}
|
|
18993
|
+
/**
|
|
18994
|
+
* Guarantee the shape callers destructure. An older server that does not yet
|
|
18995
|
+
* return the duration fields would otherwise hand back `undefined` where the
|
|
18996
|
+
* types promise numbers.
|
|
18997
|
+
*/
|
|
18998
|
+
normaliseLongVideoResult(result) {
|
|
18999
|
+
return {
|
|
19000
|
+
_id: result?._id,
|
|
19001
|
+
durationSeconds: result?.durationSeconds ?? 0,
|
|
19002
|
+
creditUnits: result?.creditUnits ?? 0,
|
|
19003
|
+
credits: result?.credits ?? 0,
|
|
19004
|
+
refusedTargets: result?.refusedTargets ?? []
|
|
19005
|
+
};
|
|
19006
|
+
}
|
|
17853
19007
|
/**
|
|
17854
19008
|
* Auto-detect video source type.
|
|
17855
19009
|
*
|
|
@@ -17866,6 +19020,13 @@ var SocialPublisherPostClient = class {
|
|
|
17866
19020
|
throw new Error("Invalid video type. Must be File or string URL");
|
|
17867
19021
|
}
|
|
17868
19022
|
};
|
|
19023
|
+
|
|
19024
|
+
// src/interfaces/requests/index.ts
|
|
19025
|
+
var MAX_POST_COMMENTS = 5;
|
|
19026
|
+
var MAX_COMMENT_LENGTH = 2200;
|
|
19027
|
+
var MAX_COMMENT_DELAY_MINUTES = 24 * 60;
|
|
19028
|
+
var LONG_VIDEO_MAX_DURATION_SECONDS = 3600;
|
|
19029
|
+
var LONG_VIDEO_CREDIT_UNIT_SECONDS = 300;
|
|
17869
19030
|
/*! Bundled license information:
|
|
17870
19031
|
|
|
17871
19032
|
mime-db/index.js:
|
|
@@ -17885,6 +19046,6 @@ mime-types/index.js:
|
|
|
17885
19046
|
*)
|
|
17886
19047
|
*/
|
|
17887
19048
|
|
|
17888
|
-
export { HttpClient, SocialPublisherPostClient, uploadToR2 };
|
|
19049
|
+
export { DEFAULT_CHUNK_SIZE2 as DEFAULT_CHUNK_SIZE, HttpClient, LONG_VIDEO_CREDIT_UNIT_SECONDS, LONG_VIDEO_MAX_DURATION_SECONDS, MAX_COMMENT_DELAY_MINUTES, MAX_COMMENT_LENGTH, MAX_POST_COMMENTS, SocialPublisherPostClient, supportsResumableUpload, terminateUpload, uploadResumable, uploadToR2 };
|
|
17889
19050
|
//# sourceMappingURL=index.mjs.map
|
|
17890
19051
|
//# sourceMappingURL=index.mjs.map
|