@syngrisi/syngrisi 2.2.3 → 2.2.5
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/dist/tsconfig.tsbuildinfo +1 -1
- package/mvc/views/react/admin/index.html +4 -4
- package/mvc/views/react/assets/{LogicalGroup.6c0a9f4a.js → LogicalGroup.0c7b572b.js} +20 -27
- package/mvc/views/react/assets/{PasswordInput.b97a4ef7.js → PasswordInput.85496f1d.js} +1 -1
- package/mvc/views/react/assets/{admin.6d843d1b.js → admin.a2a37a4a.js} +3 -3
- package/mvc/views/react/assets/{auth.ecf25364.js → auth.6b8a01d6.js} +2 -2
- package/mvc/views/react/assets/{root.25abcc85.js → root.b5915ec0.js} +2 -2
- package/mvc/views/react/assets/{use-form.10003abf.js → use-form.2c921e76.js} +361 -229
- package/mvc/views/react/auth/index.html +3 -3
- package/mvc/views/react/index2/index.html +3 -3
- package/package.json +2 -2
- package/src/server/controllers/auth.controller.ts.bak +83 -0
- package/src/ui-app/package-lock.json +292 -386
- package/src/ui-app/package.json +1 -1
- package/src/ui-app/tsconfig.node.json.bak +12 -0
- package/src/server/lib/parseDiff.js.bak +0 -72
- package/src/tasks/backup.js.bak +0 -84
- package/src/tasks/restore.js.bak +0 -100
- package/static/data/custom_devices.json +0 -14
- /package/{static → src/server/static/static}/js/canvasjs.min.js.bak +0 -0
- /package/{static → src/server/static/static}/js/chart.js.bak +0 -0
- /package/{static → src/server/static/static}/js/jquery-3.3.1.slim.js.bak +0 -0
- /package/{static → src/server/static/static}/js/jquery-3.3.1.slim.min.js.bak +0 -0
- /package/{static → src/server/static/static}/js/moment.min.js.bak +0 -0
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
1
7
|
function _mergeNamespaces(n2, m2) {
|
|
2
8
|
for (var i = 0; i < m2.length; i++) {
|
|
3
9
|
const e2 = m2[i];
|
|
@@ -10178,18 +10184,14 @@ var createCache = function createCache2(options) {
|
|
|
10178
10184
|
};
|
|
10179
10185
|
const createCache$1 = createCache;
|
|
10180
10186
|
function _extends() {
|
|
10181
|
-
_extends = Object.assign ? Object.assign.bind() : function(
|
|
10182
|
-
for (var
|
|
10183
|
-
var
|
|
10184
|
-
for (var
|
|
10185
|
-
|
|
10186
|
-
target[key] = source[key];
|
|
10187
|
-
}
|
|
10188
|
-
}
|
|
10187
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n2) {
|
|
10188
|
+
for (var e2 = 1; e2 < arguments.length; e2++) {
|
|
10189
|
+
var t2 = arguments[e2];
|
|
10190
|
+
for (var r2 in t2)
|
|
10191
|
+
({}).hasOwnProperty.call(t2, r2) && (n2[r2] = t2[r2]);
|
|
10189
10192
|
}
|
|
10190
|
-
return
|
|
10191
|
-
};
|
|
10192
|
-
return _extends.apply(this, arguments);
|
|
10193
|
+
return n2;
|
|
10194
|
+
}, _extends.apply(null, arguments);
|
|
10193
10195
|
}
|
|
10194
10196
|
var reactIs$1 = { exports: {} };
|
|
10195
10197
|
var reactIs_production_min = {};
|
|
@@ -21987,25 +21989,10 @@ class HTTPError extends Error {
|
|
|
21987
21989
|
const title = response.statusText || "";
|
|
21988
21990
|
const status = `${code} ${title}`.trim();
|
|
21989
21991
|
const reason = status ? `status code ${status}` : "an unknown error";
|
|
21990
|
-
super(`Request failed with ${reason}`);
|
|
21991
|
-
|
|
21992
|
-
|
|
21993
|
-
|
|
21994
|
-
writable: true,
|
|
21995
|
-
value: void 0
|
|
21996
|
-
});
|
|
21997
|
-
Object.defineProperty(this, "request", {
|
|
21998
|
-
enumerable: true,
|
|
21999
|
-
configurable: true,
|
|
22000
|
-
writable: true,
|
|
22001
|
-
value: void 0
|
|
22002
|
-
});
|
|
22003
|
-
Object.defineProperty(this, "options", {
|
|
22004
|
-
enumerable: true,
|
|
22005
|
-
configurable: true,
|
|
22006
|
-
writable: true,
|
|
22007
|
-
value: void 0
|
|
22008
|
-
});
|
|
21992
|
+
super(`Request failed with ${reason}: ${request.method} ${request.url}`);
|
|
21993
|
+
__publicField(this, "response");
|
|
21994
|
+
__publicField(this, "request");
|
|
21995
|
+
__publicField(this, "options");
|
|
22009
21996
|
this.name = "HTTPError";
|
|
22010
21997
|
this.response = response;
|
|
22011
21998
|
this.request = request;
|
|
@@ -22014,21 +22001,198 @@ class HTTPError extends Error {
|
|
|
22014
22001
|
}
|
|
22015
22002
|
class TimeoutError extends Error {
|
|
22016
22003
|
constructor(request) {
|
|
22017
|
-
super(
|
|
22018
|
-
|
|
22019
|
-
enumerable: true,
|
|
22020
|
-
configurable: true,
|
|
22021
|
-
writable: true,
|
|
22022
|
-
value: void 0
|
|
22023
|
-
});
|
|
22004
|
+
super(`Request timed out: ${request.method} ${request.url}`);
|
|
22005
|
+
__publicField(this, "request");
|
|
22024
22006
|
this.name = "TimeoutError";
|
|
22025
22007
|
this.request = request;
|
|
22026
22008
|
}
|
|
22027
22009
|
}
|
|
22010
|
+
const supportsRequestStreams = (() => {
|
|
22011
|
+
let duplexAccessed = false;
|
|
22012
|
+
let hasContentType = false;
|
|
22013
|
+
const supportsReadableStream = typeof globalThis.ReadableStream === "function";
|
|
22014
|
+
const supportsRequest = typeof globalThis.Request === "function";
|
|
22015
|
+
if (supportsReadableStream && supportsRequest) {
|
|
22016
|
+
try {
|
|
22017
|
+
hasContentType = new globalThis.Request("https://empty.invalid", {
|
|
22018
|
+
body: new globalThis.ReadableStream(),
|
|
22019
|
+
method: "POST",
|
|
22020
|
+
get duplex() {
|
|
22021
|
+
duplexAccessed = true;
|
|
22022
|
+
return "half";
|
|
22023
|
+
}
|
|
22024
|
+
}).headers.has("Content-Type");
|
|
22025
|
+
} catch (error) {
|
|
22026
|
+
if (error instanceof Error && error.message === "unsupported BodyInit type") {
|
|
22027
|
+
return false;
|
|
22028
|
+
}
|
|
22029
|
+
throw error;
|
|
22030
|
+
}
|
|
22031
|
+
}
|
|
22032
|
+
return duplexAccessed && !hasContentType;
|
|
22033
|
+
})();
|
|
22034
|
+
const supportsAbortController = typeof globalThis.AbortController === "function";
|
|
22035
|
+
const supportsResponseStreams = typeof globalThis.ReadableStream === "function";
|
|
22036
|
+
const supportsFormData = typeof globalThis.FormData === "function";
|
|
22037
|
+
const requestMethods = ["get", "post", "put", "patch", "head", "delete"];
|
|
22038
|
+
const responseTypes = {
|
|
22039
|
+
json: "application/json",
|
|
22040
|
+
text: "text/*",
|
|
22041
|
+
formData: "multipart/form-data",
|
|
22042
|
+
arrayBuffer: "*/*",
|
|
22043
|
+
blob: "*/*"
|
|
22044
|
+
};
|
|
22045
|
+
const maxSafeTimeout = 2147483647;
|
|
22046
|
+
const usualFormBoundarySize = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length;
|
|
22047
|
+
const stop = Symbol("stop");
|
|
22048
|
+
const kyOptionKeys = {
|
|
22049
|
+
json: true,
|
|
22050
|
+
parseJson: true,
|
|
22051
|
+
stringifyJson: true,
|
|
22052
|
+
searchParams: true,
|
|
22053
|
+
prefixUrl: true,
|
|
22054
|
+
retry: true,
|
|
22055
|
+
timeout: true,
|
|
22056
|
+
hooks: true,
|
|
22057
|
+
throwHttpErrors: true,
|
|
22058
|
+
onDownloadProgress: true,
|
|
22059
|
+
onUploadProgress: true,
|
|
22060
|
+
fetch: true
|
|
22061
|
+
};
|
|
22062
|
+
const requestOptionsRegistry = {
|
|
22063
|
+
method: true,
|
|
22064
|
+
headers: true,
|
|
22065
|
+
body: true,
|
|
22066
|
+
mode: true,
|
|
22067
|
+
credentials: true,
|
|
22068
|
+
cache: true,
|
|
22069
|
+
redirect: true,
|
|
22070
|
+
referrer: true,
|
|
22071
|
+
referrerPolicy: true,
|
|
22072
|
+
integrity: true,
|
|
22073
|
+
keepalive: true,
|
|
22074
|
+
signal: true,
|
|
22075
|
+
window: true,
|
|
22076
|
+
dispatcher: true,
|
|
22077
|
+
duplex: true,
|
|
22078
|
+
priority: true
|
|
22079
|
+
};
|
|
22080
|
+
const getBodySize = (body) => {
|
|
22081
|
+
if (!body) {
|
|
22082
|
+
return 0;
|
|
22083
|
+
}
|
|
22084
|
+
if (body instanceof FormData) {
|
|
22085
|
+
let size2 = 0;
|
|
22086
|
+
for (const [key, value] of body) {
|
|
22087
|
+
size2 += usualFormBoundarySize;
|
|
22088
|
+
size2 += new TextEncoder().encode(`Content-Disposition: form-data; name="${key}"`).length;
|
|
22089
|
+
size2 += typeof value === "string" ? new TextEncoder().encode(value).length : value.size;
|
|
22090
|
+
}
|
|
22091
|
+
return size2;
|
|
22092
|
+
}
|
|
22093
|
+
if (body instanceof Blob) {
|
|
22094
|
+
return body.size;
|
|
22095
|
+
}
|
|
22096
|
+
if (body instanceof ArrayBuffer) {
|
|
22097
|
+
return body.byteLength;
|
|
22098
|
+
}
|
|
22099
|
+
if (typeof body === "string") {
|
|
22100
|
+
return new TextEncoder().encode(body).length;
|
|
22101
|
+
}
|
|
22102
|
+
if (body instanceof URLSearchParams) {
|
|
22103
|
+
return new TextEncoder().encode(body.toString()).length;
|
|
22104
|
+
}
|
|
22105
|
+
if ("byteLength" in body) {
|
|
22106
|
+
return body.byteLength;
|
|
22107
|
+
}
|
|
22108
|
+
if (typeof body === "object" && body !== null) {
|
|
22109
|
+
try {
|
|
22110
|
+
const jsonString = JSON.stringify(body);
|
|
22111
|
+
return new TextEncoder().encode(jsonString).length;
|
|
22112
|
+
} catch {
|
|
22113
|
+
return 0;
|
|
22114
|
+
}
|
|
22115
|
+
}
|
|
22116
|
+
return 0;
|
|
22117
|
+
};
|
|
22118
|
+
const streamResponse = (response, onDownloadProgress) => {
|
|
22119
|
+
const totalBytes = Number(response.headers.get("content-length")) || 0;
|
|
22120
|
+
let transferredBytes = 0;
|
|
22121
|
+
if (response.status === 204) {
|
|
22122
|
+
if (onDownloadProgress) {
|
|
22123
|
+
onDownloadProgress({ percent: 1, totalBytes, transferredBytes }, new Uint8Array());
|
|
22124
|
+
}
|
|
22125
|
+
return new Response(null, {
|
|
22126
|
+
status: response.status,
|
|
22127
|
+
statusText: response.statusText,
|
|
22128
|
+
headers: response.headers
|
|
22129
|
+
});
|
|
22130
|
+
}
|
|
22131
|
+
return new Response(new ReadableStream({
|
|
22132
|
+
async start(controller) {
|
|
22133
|
+
const reader = response.body.getReader();
|
|
22134
|
+
if (onDownloadProgress) {
|
|
22135
|
+
onDownloadProgress({ percent: 0, transferredBytes: 0, totalBytes }, new Uint8Array());
|
|
22136
|
+
}
|
|
22137
|
+
async function read() {
|
|
22138
|
+
const { done, value } = await reader.read();
|
|
22139
|
+
if (done) {
|
|
22140
|
+
controller.close();
|
|
22141
|
+
return;
|
|
22142
|
+
}
|
|
22143
|
+
if (onDownloadProgress) {
|
|
22144
|
+
transferredBytes += value.byteLength;
|
|
22145
|
+
const percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
|
|
22146
|
+
onDownloadProgress({ percent, transferredBytes, totalBytes }, value);
|
|
22147
|
+
}
|
|
22148
|
+
controller.enqueue(value);
|
|
22149
|
+
await read();
|
|
22150
|
+
}
|
|
22151
|
+
await read();
|
|
22152
|
+
}
|
|
22153
|
+
}), {
|
|
22154
|
+
status: response.status,
|
|
22155
|
+
statusText: response.statusText,
|
|
22156
|
+
headers: response.headers
|
|
22157
|
+
});
|
|
22158
|
+
};
|
|
22159
|
+
const streamRequest = (request, onUploadProgress) => {
|
|
22160
|
+
const totalBytes = getBodySize(request.body);
|
|
22161
|
+
let transferredBytes = 0;
|
|
22162
|
+
return new Request(request, {
|
|
22163
|
+
duplex: "half",
|
|
22164
|
+
body: new ReadableStream({
|
|
22165
|
+
async start(controller) {
|
|
22166
|
+
const reader = request.body instanceof ReadableStream ? request.body.getReader() : new Response("").body.getReader();
|
|
22167
|
+
async function read() {
|
|
22168
|
+
const { done, value } = await reader.read();
|
|
22169
|
+
if (done) {
|
|
22170
|
+
if (onUploadProgress) {
|
|
22171
|
+
onUploadProgress({ percent: 1, transferredBytes, totalBytes: Math.max(totalBytes, transferredBytes) }, new Uint8Array());
|
|
22172
|
+
}
|
|
22173
|
+
controller.close();
|
|
22174
|
+
return;
|
|
22175
|
+
}
|
|
22176
|
+
transferredBytes += value.byteLength;
|
|
22177
|
+
let percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
|
|
22178
|
+
if (totalBytes < transferredBytes || percent === 1) {
|
|
22179
|
+
percent = 0.99;
|
|
22180
|
+
}
|
|
22181
|
+
if (onUploadProgress) {
|
|
22182
|
+
onUploadProgress({ percent: Number(percent.toFixed(2)), transferredBytes, totalBytes }, value);
|
|
22183
|
+
}
|
|
22184
|
+
controller.enqueue(value);
|
|
22185
|
+
await read();
|
|
22186
|
+
}
|
|
22187
|
+
await read();
|
|
22188
|
+
}
|
|
22189
|
+
})
|
|
22190
|
+
});
|
|
22191
|
+
};
|
|
22028
22192
|
const isObject = (value) => value !== null && typeof value === "object";
|
|
22029
22193
|
const validateAndMerge = (...sources) => {
|
|
22030
22194
|
for (const source of sources) {
|
|
22031
|
-
if ((!isObject(source) || Array.isArray(source)) &&
|
|
22195
|
+
if ((!isObject(source) || Array.isArray(source)) && source !== void 0) {
|
|
22032
22196
|
throw new TypeError("The `options` argument must be an object");
|
|
22033
22197
|
}
|
|
22034
22198
|
}
|
|
@@ -22047,9 +22211,20 @@ const mergeHeaders = (source1 = {}, source2 = {}) => {
|
|
|
22047
22211
|
}
|
|
22048
22212
|
return result;
|
|
22049
22213
|
};
|
|
22214
|
+
function newHookValue(original, incoming, property) {
|
|
22215
|
+
var _a, _b;
|
|
22216
|
+
return Object.hasOwn(incoming, property) && incoming[property] === void 0 ? [] : deepMerge((_a = original[property]) != null ? _a : [], (_b = incoming[property]) != null ? _b : []);
|
|
22217
|
+
}
|
|
22218
|
+
const mergeHooks = (original = {}, incoming = {}) => ({
|
|
22219
|
+
beforeRequest: newHookValue(original, incoming, "beforeRequest"),
|
|
22220
|
+
beforeRetry: newHookValue(original, incoming, "beforeRetry"),
|
|
22221
|
+
afterResponse: newHookValue(original, incoming, "afterResponse"),
|
|
22222
|
+
beforeError: newHookValue(original, incoming, "beforeError")
|
|
22223
|
+
});
|
|
22050
22224
|
const deepMerge = (...sources) => {
|
|
22051
22225
|
let returnValue = {};
|
|
22052
22226
|
let headers = {};
|
|
22227
|
+
let hooks = {};
|
|
22053
22228
|
for (const source of sources) {
|
|
22054
22229
|
if (Array.isArray(source)) {
|
|
22055
22230
|
if (!Array.isArray(returnValue)) {
|
|
@@ -22063,6 +22238,10 @@ const deepMerge = (...sources) => {
|
|
|
22063
22238
|
}
|
|
22064
22239
|
returnValue = { ...returnValue, [key]: value };
|
|
22065
22240
|
}
|
|
22241
|
+
if (isObject(source.hooks)) {
|
|
22242
|
+
hooks = mergeHooks(hooks, source.hooks);
|
|
22243
|
+
returnValue.hooks = hooks;
|
|
22244
|
+
}
|
|
22066
22245
|
if (isObject(source.headers)) {
|
|
22067
22246
|
headers = mergeHeaders(headers, source.headers);
|
|
22068
22247
|
returnValue.headers = headers;
|
|
@@ -22071,34 +22250,6 @@ const deepMerge = (...sources) => {
|
|
|
22071
22250
|
}
|
|
22072
22251
|
return returnValue;
|
|
22073
22252
|
};
|
|
22074
|
-
const supportsStreams = (() => {
|
|
22075
|
-
let duplexAccessed = false;
|
|
22076
|
-
let hasContentType = false;
|
|
22077
|
-
const supportsReadableStream = typeof globalThis.ReadableStream === "function";
|
|
22078
|
-
if (supportsReadableStream) {
|
|
22079
|
-
hasContentType = new globalThis.Request("https://a.com", {
|
|
22080
|
-
body: new globalThis.ReadableStream(),
|
|
22081
|
-
method: "POST",
|
|
22082
|
-
get duplex() {
|
|
22083
|
-
duplexAccessed = true;
|
|
22084
|
-
return "half";
|
|
22085
|
-
}
|
|
22086
|
-
}).headers.has("Content-Type");
|
|
22087
|
-
}
|
|
22088
|
-
return duplexAccessed && !hasContentType;
|
|
22089
|
-
})();
|
|
22090
|
-
const supportsAbortController = typeof globalThis.AbortController === "function";
|
|
22091
|
-
const supportsFormData = typeof globalThis.FormData === "function";
|
|
22092
|
-
const requestMethods = ["get", "post", "put", "patch", "head", "delete"];
|
|
22093
|
-
const responseTypes = {
|
|
22094
|
-
json: "application/json",
|
|
22095
|
-
text: "text/*",
|
|
22096
|
-
formData: "multipart/form-data",
|
|
22097
|
-
arrayBuffer: "*/*",
|
|
22098
|
-
blob: "*/*"
|
|
22099
|
-
};
|
|
22100
|
-
const maxSafeTimeout = 2147483647;
|
|
22101
|
-
const stop = Symbol("stop");
|
|
22102
22253
|
const normalizeRequestMethod = (input) => requestMethods.includes(input) ? input.toUpperCase() : input;
|
|
22103
22254
|
const retryMethods = ["get", "put", "head", "delete", "options", "trace"];
|
|
22104
22255
|
const retryStatusCodes = [408, 413, 429, 500, 502, 503, 504];
|
|
@@ -22108,7 +22259,9 @@ const defaultRetryOptions = {
|
|
|
22108
22259
|
methods: retryMethods,
|
|
22109
22260
|
statusCodes: retryStatusCodes,
|
|
22110
22261
|
afterStatusCodes: retryAfterStatusCodes,
|
|
22111
|
-
maxRetryAfter: Number.POSITIVE_INFINITY
|
|
22262
|
+
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
22263
|
+
backoffLimit: Number.POSITIVE_INFINITY,
|
|
22264
|
+
delay: (attemptCount) => 0.3 * 2 ** (attemptCount - 1) * 1e3
|
|
22112
22265
|
};
|
|
22113
22266
|
const normalizeRetryOptions = (retry = {}) => {
|
|
22114
22267
|
if (typeof retry === "number") {
|
|
@@ -22125,74 +22278,71 @@ const normalizeRetryOptions = (retry = {}) => {
|
|
|
22125
22278
|
}
|
|
22126
22279
|
return {
|
|
22127
22280
|
...defaultRetryOptions,
|
|
22128
|
-
...retry
|
|
22129
|
-
afterStatusCodes: retryAfterStatusCodes
|
|
22281
|
+
...retry
|
|
22130
22282
|
};
|
|
22131
22283
|
};
|
|
22132
|
-
|
|
22133
|
-
|
|
22134
|
-
|
|
22135
|
-
abortController
|
|
22284
|
+
async function timeout(request, init, abortController, options) {
|
|
22285
|
+
return new Promise((resolve, reject) => {
|
|
22286
|
+
const timeoutId = setTimeout(() => {
|
|
22287
|
+
if (abortController) {
|
|
22288
|
+
abortController.abort();
|
|
22289
|
+
}
|
|
22290
|
+
reject(new TimeoutError(request));
|
|
22291
|
+
}, options.timeout);
|
|
22292
|
+
void options.fetch(request, init).then(resolve).catch(reject).then(() => {
|
|
22293
|
+
clearTimeout(timeoutId);
|
|
22294
|
+
});
|
|
22295
|
+
});
|
|
22296
|
+
}
|
|
22297
|
+
async function delay(ms, { signal }) {
|
|
22298
|
+
return new Promise((resolve, reject) => {
|
|
22299
|
+
if (signal) {
|
|
22300
|
+
signal.throwIfAborted();
|
|
22301
|
+
signal.addEventListener("abort", abortHandler, { once: true });
|
|
22136
22302
|
}
|
|
22137
|
-
|
|
22138
|
-
|
|
22139
|
-
|
|
22140
|
-
|
|
22303
|
+
function abortHandler() {
|
|
22304
|
+
clearTimeout(timeoutId);
|
|
22305
|
+
reject(signal.reason);
|
|
22306
|
+
}
|
|
22307
|
+
const timeoutId = setTimeout(() => {
|
|
22308
|
+
signal == null ? void 0 : signal.removeEventListener("abort", abortHandler);
|
|
22309
|
+
resolve();
|
|
22310
|
+
}, ms);
|
|
22141
22311
|
});
|
|
22142
|
-
}
|
|
22143
|
-
const
|
|
22144
|
-
|
|
22145
|
-
|
|
22312
|
+
}
|
|
22313
|
+
const findUnknownOptions = (request, options) => {
|
|
22314
|
+
const unknownOptions = {};
|
|
22315
|
+
for (const key in options) {
|
|
22316
|
+
if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && !(key in request)) {
|
|
22317
|
+
unknownOptions[key] = options[key];
|
|
22318
|
+
}
|
|
22319
|
+
}
|
|
22320
|
+
return unknownOptions;
|
|
22321
|
+
};
|
|
22146
22322
|
class Ky {
|
|
22147
22323
|
constructor(input, options = {}) {
|
|
22148
|
-
|
|
22149
|
-
|
|
22150
|
-
|
|
22151
|
-
|
|
22152
|
-
|
|
22153
|
-
|
|
22154
|
-
});
|
|
22155
|
-
Object.defineProperty(this, "abortController", {
|
|
22156
|
-
enumerable: true,
|
|
22157
|
-
configurable: true,
|
|
22158
|
-
writable: true,
|
|
22159
|
-
value: void 0
|
|
22160
|
-
});
|
|
22161
|
-
Object.defineProperty(this, "_retryCount", {
|
|
22162
|
-
enumerable: true,
|
|
22163
|
-
configurable: true,
|
|
22164
|
-
writable: true,
|
|
22165
|
-
value: 0
|
|
22166
|
-
});
|
|
22167
|
-
Object.defineProperty(this, "_input", {
|
|
22168
|
-
enumerable: true,
|
|
22169
|
-
configurable: true,
|
|
22170
|
-
writable: true,
|
|
22171
|
-
value: void 0
|
|
22172
|
-
});
|
|
22173
|
-
Object.defineProperty(this, "_options", {
|
|
22174
|
-
enumerable: true,
|
|
22175
|
-
configurable: true,
|
|
22176
|
-
writable: true,
|
|
22177
|
-
value: void 0
|
|
22178
|
-
});
|
|
22324
|
+
__publicField(this, "request");
|
|
22325
|
+
__publicField(this, "abortController");
|
|
22326
|
+
__publicField(this, "_retryCount", 0);
|
|
22327
|
+
__publicField(this, "_input");
|
|
22328
|
+
__publicField(this, "_options");
|
|
22329
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i2;
|
|
22179
22330
|
this._input = input;
|
|
22180
22331
|
this._options = {
|
|
22181
|
-
credentials: this._input.credentials || "same-origin",
|
|
22182
22332
|
...options,
|
|
22183
22333
|
headers: mergeHeaders(this._input.headers, options.headers),
|
|
22184
|
-
hooks:
|
|
22334
|
+
hooks: mergeHooks({
|
|
22185
22335
|
beforeRequest: [],
|
|
22186
22336
|
beforeRetry: [],
|
|
22187
22337
|
beforeError: [],
|
|
22188
22338
|
afterResponse: []
|
|
22189
22339
|
}, options.hooks),
|
|
22190
|
-
method: normalizeRequestMethod((_a = options.method) != null ? _a : this._input.method),
|
|
22340
|
+
method: normalizeRequestMethod((_b = (_a = options.method) != null ? _a : this._input.method) != null ? _b : "GET"),
|
|
22191
22341
|
prefixUrl: String(options.prefixUrl || ""),
|
|
22192
22342
|
retry: normalizeRetryOptions(options.retry),
|
|
22193
22343
|
throwHttpErrors: options.throwHttpErrors !== false,
|
|
22194
|
-
timeout:
|
|
22195
|
-
fetch: (
|
|
22344
|
+
timeout: (_c = options.timeout) != null ? _c : 1e4,
|
|
22345
|
+
fetch: (_d = options.fetch) != null ? _d : globalThis.fetch.bind(globalThis)
|
|
22196
22346
|
};
|
|
22197
22347
|
if (typeof this._input !== "string" && !(this._input instanceof URL || this._input instanceof globalThis.Request)) {
|
|
22198
22348
|
throw new TypeError("`input` must be a string, URL, or Request");
|
|
@@ -22207,18 +22357,18 @@ class Ky {
|
|
|
22207
22357
|
this._input = this._options.prefixUrl + this._input;
|
|
22208
22358
|
}
|
|
22209
22359
|
if (supportsAbortController) {
|
|
22360
|
+
const originalSignal = (_e = this._options.signal) != null ? _e : this._input.signal;
|
|
22210
22361
|
this.abortController = new globalThis.AbortController();
|
|
22211
|
-
|
|
22212
|
-
this._options.signal.addEventListener("abort", () => {
|
|
22213
|
-
this.abortController.abort();
|
|
22214
|
-
});
|
|
22215
|
-
}
|
|
22216
|
-
this._options.signal = this.abortController.signal;
|
|
22362
|
+
this._options.signal = originalSignal ? AbortSignal.any([originalSignal, this.abortController.signal]) : this.abortController.signal;
|
|
22217
22363
|
}
|
|
22218
|
-
|
|
22219
|
-
|
|
22220
|
-
|
|
22364
|
+
if (supportsRequestStreams) {
|
|
22365
|
+
this._options.duplex = "half";
|
|
22366
|
+
}
|
|
22367
|
+
if (this._options.json !== void 0) {
|
|
22368
|
+
this._options.body = (_h = (_g = (_f = this._options).stringifyJson) == null ? void 0 : _g.call(_f, this._options.json)) != null ? _h : JSON.stringify(this._options.json);
|
|
22369
|
+
this._options.headers.set("content-type", (_i2 = this._options.headers.get("content-type")) != null ? _i2 : "application/json");
|
|
22221
22370
|
}
|
|
22371
|
+
this.request = new globalThis.Request(this._input, this._options);
|
|
22222
22372
|
if (this._options.searchParams) {
|
|
22223
22373
|
const textSearchParams = typeof this._options.searchParams === "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString();
|
|
22224
22374
|
const searchParams = "?" + textSearchParams;
|
|
@@ -22226,18 +22376,25 @@ class Ky {
|
|
|
22226
22376
|
if ((supportsFormData && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers["content-type"])) {
|
|
22227
22377
|
this.request.headers.delete("content-type");
|
|
22228
22378
|
}
|
|
22229
|
-
this.request = new globalThis.Request(new globalThis.Request(url, this.request), this._options);
|
|
22379
|
+
this.request = new globalThis.Request(new globalThis.Request(url, { ...this.request }), this._options);
|
|
22230
22380
|
}
|
|
22231
|
-
if (this._options.
|
|
22232
|
-
this._options.
|
|
22233
|
-
|
|
22234
|
-
|
|
22381
|
+
if (this._options.onUploadProgress) {
|
|
22382
|
+
if (typeof this._options.onUploadProgress !== "function") {
|
|
22383
|
+
throw new TypeError("The `onUploadProgress` option must be a function");
|
|
22384
|
+
}
|
|
22385
|
+
if (!supportsRequestStreams) {
|
|
22386
|
+
throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");
|
|
22387
|
+
}
|
|
22388
|
+
const originalBody = this.request.body;
|
|
22389
|
+
if (originalBody) {
|
|
22390
|
+
this.request = streamRequest(this.request, this._options.onUploadProgress);
|
|
22391
|
+
}
|
|
22235
22392
|
}
|
|
22236
22393
|
}
|
|
22237
22394
|
static create(input, options) {
|
|
22238
22395
|
const ky2 = new Ky(input, options);
|
|
22239
|
-
const
|
|
22240
|
-
if (ky2._options.timeout > maxSafeTimeout) {
|
|
22396
|
+
const function_ = async () => {
|
|
22397
|
+
if (typeof ky2._options.timeout === "number" && ky2._options.timeout > maxSafeTimeout) {
|
|
22241
22398
|
throw new RangeError(`The \`timeout\` option cannot be greater than ${maxSafeTimeout}`);
|
|
22242
22399
|
}
|
|
22243
22400
|
await Promise.resolve();
|
|
@@ -22260,24 +22417,33 @@ class Ky {
|
|
|
22260
22417
|
if (typeof ky2._options.onDownloadProgress !== "function") {
|
|
22261
22418
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
22262
22419
|
}
|
|
22263
|
-
if (!
|
|
22420
|
+
if (!supportsResponseStreams) {
|
|
22264
22421
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
22265
22422
|
}
|
|
22266
|
-
return
|
|
22423
|
+
return streamResponse(response.clone(), ky2._options.onDownloadProgress);
|
|
22267
22424
|
}
|
|
22268
22425
|
return response;
|
|
22269
22426
|
};
|
|
22270
22427
|
const isRetriableMethod = ky2._options.retry.methods.includes(ky2.request.method.toLowerCase());
|
|
22271
|
-
const result = isRetriableMethod ? ky2._retry(
|
|
22428
|
+
const result = (isRetriableMethod ? ky2._retry(function_) : function_()).finally(async () => {
|
|
22429
|
+
var _a;
|
|
22430
|
+
if (!ky2.request.bodyUsed) {
|
|
22431
|
+
await ((_a = ky2.request.body) == null ? void 0 : _a.cancel());
|
|
22432
|
+
}
|
|
22433
|
+
});
|
|
22272
22434
|
for (const [type, mimeType] of Object.entries(responseTypes)) {
|
|
22273
22435
|
result[type] = async () => {
|
|
22274
22436
|
ky2.request.headers.set("accept", ky2.request.headers.get("accept") || mimeType);
|
|
22275
|
-
const
|
|
22276
|
-
const response = awaitedResult.clone();
|
|
22437
|
+
const response = await result;
|
|
22277
22438
|
if (type === "json") {
|
|
22278
22439
|
if (response.status === 204) {
|
|
22279
22440
|
return "";
|
|
22280
22441
|
}
|
|
22442
|
+
const arrayBuffer = await response.clone().arrayBuffer();
|
|
22443
|
+
const responseSize = arrayBuffer.byteLength;
|
|
22444
|
+
if (responseSize === 0) {
|
|
22445
|
+
return "";
|
|
22446
|
+
}
|
|
22281
22447
|
if (options.parseJson) {
|
|
22282
22448
|
return options.parseJson(await response.text());
|
|
22283
22449
|
}
|
|
@@ -22288,33 +22454,32 @@ class Ky {
|
|
|
22288
22454
|
return result;
|
|
22289
22455
|
}
|
|
22290
22456
|
_calculateRetryDelay(error) {
|
|
22457
|
+
var _a, _b, _c, _d;
|
|
22291
22458
|
this._retryCount++;
|
|
22292
|
-
if (this._retryCount
|
|
22293
|
-
|
|
22294
|
-
|
|
22295
|
-
|
|
22296
|
-
|
|
22297
|
-
|
|
22298
|
-
|
|
22299
|
-
|
|
22300
|
-
|
|
22301
|
-
|
|
22302
|
-
|
|
22303
|
-
|
|
22304
|
-
|
|
22305
|
-
|
|
22306
|
-
return 0;
|
|
22307
|
-
}
|
|
22308
|
-
return after;
|
|
22309
|
-
}
|
|
22310
|
-
if (error.response.status === 413) {
|
|
22311
|
-
return 0;
|
|
22459
|
+
if (this._retryCount > this._options.retry.limit || error instanceof TimeoutError) {
|
|
22460
|
+
throw error;
|
|
22461
|
+
}
|
|
22462
|
+
if (error instanceof HTTPError) {
|
|
22463
|
+
if (!this._options.retry.statusCodes.includes(error.response.status)) {
|
|
22464
|
+
throw error;
|
|
22465
|
+
}
|
|
22466
|
+
const retryAfter = (_c = (_b = (_a = error.response.headers.get("Retry-After")) != null ? _a : error.response.headers.get("RateLimit-Reset")) != null ? _b : error.response.headers.get("X-RateLimit-Reset")) != null ? _c : error.response.headers.get("X-Rate-Limit-Reset");
|
|
22467
|
+
if (retryAfter && this._options.retry.afterStatusCodes.includes(error.response.status)) {
|
|
22468
|
+
let after = Number(retryAfter) * 1e3;
|
|
22469
|
+
if (Number.isNaN(after)) {
|
|
22470
|
+
after = Date.parse(retryAfter) - Date.now();
|
|
22471
|
+
} else if (after >= Date.parse("2024-01-01")) {
|
|
22472
|
+
after -= Date.now();
|
|
22312
22473
|
}
|
|
22474
|
+
const max2 = (_d = this._options.retry.maxRetryAfter) != null ? _d : after;
|
|
22475
|
+
return after < max2 ? after : max2;
|
|
22476
|
+
}
|
|
22477
|
+
if (error.response.status === 413) {
|
|
22478
|
+
throw error;
|
|
22313
22479
|
}
|
|
22314
|
-
const BACKOFF_FACTOR = 0.3;
|
|
22315
|
-
return BACKOFF_FACTOR * 2 ** (this._retryCount - 1) * 1e3;
|
|
22316
22480
|
}
|
|
22317
|
-
|
|
22481
|
+
const retryDelay = this._options.retry.delay(this._retryCount);
|
|
22482
|
+
return Math.min(this._options.retry.backoffLimit, retryDelay);
|
|
22318
22483
|
}
|
|
22319
22484
|
_decorateResponse(response) {
|
|
22320
22485
|
if (this._options.parseJson) {
|
|
@@ -22322,27 +22487,27 @@ class Ky {
|
|
|
22322
22487
|
}
|
|
22323
22488
|
return response;
|
|
22324
22489
|
}
|
|
22325
|
-
async _retry(
|
|
22490
|
+
async _retry(function_) {
|
|
22326
22491
|
try {
|
|
22327
|
-
return await
|
|
22492
|
+
return await function_();
|
|
22328
22493
|
} catch (error) {
|
|
22329
22494
|
const ms = Math.min(this._calculateRetryDelay(error), maxSafeTimeout);
|
|
22330
|
-
if (
|
|
22331
|
-
|
|
22332
|
-
|
|
22333
|
-
|
|
22334
|
-
|
|
22335
|
-
|
|
22336
|
-
|
|
22337
|
-
|
|
22338
|
-
|
|
22339
|
-
|
|
22340
|
-
|
|
22341
|
-
|
|
22495
|
+
if (this._retryCount < 1) {
|
|
22496
|
+
throw error;
|
|
22497
|
+
}
|
|
22498
|
+
await delay(ms, { signal: this._options.signal });
|
|
22499
|
+
for (const hook of this._options.hooks.beforeRetry) {
|
|
22500
|
+
const hookResult = await hook({
|
|
22501
|
+
request: this.request,
|
|
22502
|
+
options: this._options,
|
|
22503
|
+
error,
|
|
22504
|
+
retryCount: this._retryCount
|
|
22505
|
+
});
|
|
22506
|
+
if (hookResult === stop) {
|
|
22507
|
+
return;
|
|
22342
22508
|
}
|
|
22343
|
-
return this._retry(fn);
|
|
22344
22509
|
}
|
|
22345
|
-
|
|
22510
|
+
return this._retry(function_);
|
|
22346
22511
|
}
|
|
22347
22512
|
}
|
|
22348
22513
|
async _fetch() {
|
|
@@ -22356,51 +22521,13 @@ class Ky {
|
|
|
22356
22521
|
return result;
|
|
22357
22522
|
}
|
|
22358
22523
|
}
|
|
22524
|
+
const nonRequestOptions = findUnknownOptions(this.request, this._options);
|
|
22525
|
+
const mainRequest = this.request;
|
|
22526
|
+
this.request = mainRequest.clone();
|
|
22359
22527
|
if (this._options.timeout === false) {
|
|
22360
|
-
return this._options.fetch(
|
|
22361
|
-
}
|
|
22362
|
-
return timeout(this.request.clone(), this.abortController, this._options);
|
|
22363
|
-
}
|
|
22364
|
-
_stream(response, onDownloadProgress) {
|
|
22365
|
-
const totalBytes = Number(response.headers.get("content-length")) || 0;
|
|
22366
|
-
let transferredBytes = 0;
|
|
22367
|
-
if (response.status === 204) {
|
|
22368
|
-
if (onDownloadProgress) {
|
|
22369
|
-
onDownloadProgress({ percent: 1, totalBytes, transferredBytes }, new Uint8Array());
|
|
22370
|
-
}
|
|
22371
|
-
return new globalThis.Response(null, {
|
|
22372
|
-
status: response.status,
|
|
22373
|
-
statusText: response.statusText,
|
|
22374
|
-
headers: response.headers
|
|
22375
|
-
});
|
|
22528
|
+
return this._options.fetch(mainRequest, nonRequestOptions);
|
|
22376
22529
|
}
|
|
22377
|
-
return
|
|
22378
|
-
async start(controller) {
|
|
22379
|
-
const reader = response.body.getReader();
|
|
22380
|
-
if (onDownloadProgress) {
|
|
22381
|
-
onDownloadProgress({ percent: 0, transferredBytes: 0, totalBytes }, new Uint8Array());
|
|
22382
|
-
}
|
|
22383
|
-
async function read() {
|
|
22384
|
-
const { done, value } = await reader.read();
|
|
22385
|
-
if (done) {
|
|
22386
|
-
controller.close();
|
|
22387
|
-
return;
|
|
22388
|
-
}
|
|
22389
|
-
if (onDownloadProgress) {
|
|
22390
|
-
transferredBytes += value.byteLength;
|
|
22391
|
-
const percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
|
|
22392
|
-
onDownloadProgress({ percent, transferredBytes, totalBytes }, value);
|
|
22393
|
-
}
|
|
22394
|
-
controller.enqueue(value);
|
|
22395
|
-
await read();
|
|
22396
|
-
}
|
|
22397
|
-
await read();
|
|
22398
|
-
}
|
|
22399
|
-
}), {
|
|
22400
|
-
status: response.status,
|
|
22401
|
-
statusText: response.statusText,
|
|
22402
|
-
headers: response.headers
|
|
22403
|
-
});
|
|
22530
|
+
return timeout(mainRequest, nonRequestOptions, this.abortController, this._options);
|
|
22404
22531
|
}
|
|
22405
22532
|
}
|
|
22406
22533
|
/*! MIT License © Sindre Sorhus */
|
|
@@ -22410,7 +22537,12 @@ const createInstance = (defaults) => {
|
|
|
22410
22537
|
ky2[method] = (input, options) => Ky.create(input, validateAndMerge(defaults, options, { method }));
|
|
22411
22538
|
}
|
|
22412
22539
|
ky2.create = (newDefaults) => createInstance(validateAndMerge(newDefaults));
|
|
22413
|
-
ky2.extend = (newDefaults) =>
|
|
22540
|
+
ky2.extend = (newDefaults) => {
|
|
22541
|
+
if (typeof newDefaults === "function") {
|
|
22542
|
+
newDefaults = newDefaults(defaults != null ? defaults : {});
|
|
22543
|
+
}
|
|
22544
|
+
return createInstance(validateAndMerge(defaults, newDefaults));
|
|
22545
|
+
};
|
|
22414
22546
|
ky2.stop = stop;
|
|
22415
22547
|
return ky2;
|
|
22416
22548
|
};
|
|
@@ -23353,11 +23485,11 @@ const config = {
|
|
|
23353
23485
|
var queryString = {};
|
|
23354
23486
|
var strictUriEncode = (str) => encodeURIComponent(str).replace(/[!'()*]/g, (x2) => `%${x2.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
23355
23487
|
var token = "%[a-f0-9]{2}";
|
|
23356
|
-
var singleMatcher = new RegExp(token, "gi");
|
|
23488
|
+
var singleMatcher = new RegExp("(" + token + ")|([^%]+?)", "gi");
|
|
23357
23489
|
var multiMatcher = new RegExp("(" + token + ")+", "gi");
|
|
23358
23490
|
function decodeComponents(components, split) {
|
|
23359
23491
|
try {
|
|
23360
|
-
return decodeURIComponent(components.join(""));
|
|
23492
|
+
return [decodeURIComponent(components.join(""))];
|
|
23361
23493
|
} catch (err) {
|
|
23362
23494
|
}
|
|
23363
23495
|
if (components.length === 1) {
|
|
@@ -23372,10 +23504,10 @@ function decode(input) {
|
|
|
23372
23504
|
try {
|
|
23373
23505
|
return decodeURIComponent(input);
|
|
23374
23506
|
} catch (err) {
|
|
23375
|
-
var tokens = input.match(singleMatcher);
|
|
23507
|
+
var tokens = input.match(singleMatcher) || [];
|
|
23376
23508
|
for (var i = 1; i < tokens.length; i++) {
|
|
23377
23509
|
input = decodeComponents(tokens, i).join("");
|
|
23378
|
-
tokens = input.match(singleMatcher);
|
|
23510
|
+
tokens = input.match(singleMatcher) || [];
|
|
23379
23511
|
}
|
|
23380
23512
|
return input;
|
|
23381
23513
|
}
|
|
@@ -24098,21 +24230,21 @@ function getInputOnChange(setValue) {
|
|
|
24098
24230
|
}
|
|
24099
24231
|
};
|
|
24100
24232
|
}
|
|
24101
|
-
var
|
|
24233
|
+
var __defProp2 = Object.defineProperty;
|
|
24102
24234
|
var __defProps = Object.defineProperties;
|
|
24103
24235
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
24104
24236
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
24105
24237
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
24106
24238
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
24107
|
-
var
|
|
24239
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
24108
24240
|
var __spreadValues = (a, b2) => {
|
|
24109
24241
|
for (var prop in b2 || (b2 = {}))
|
|
24110
24242
|
if (__hasOwnProp.call(b2, prop))
|
|
24111
|
-
|
|
24243
|
+
__defNormalProp2(a, prop, b2[prop]);
|
|
24112
24244
|
if (__getOwnPropSymbols)
|
|
24113
24245
|
for (var prop of __getOwnPropSymbols(b2)) {
|
|
24114
24246
|
if (__propIsEnum.call(b2, prop))
|
|
24115
|
-
|
|
24247
|
+
__defNormalProp2(a, prop, b2[prop]);
|
|
24116
24248
|
}
|
|
24117
24249
|
return a;
|
|
24118
24250
|
};
|