autosync_backend2 1.2.23 → 1.2.25
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/index.d.ts +202 -0
- package/dist/index.js +406 -239
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -100539,143 +100539,6 @@ var $ = (v, b, A, Q, O) => {
|
|
|
100539
100539
|
return null;
|
|
100540
100540
|
};
|
|
100541
100541
|
var import_fast_decode_uri_component4 = __toESM2(require_fast_decode_uri_component(), 1);
|
|
100542
|
-
var fullFormats = { date, time: getTime(true), "date-time": getDateTime(true), "iso-time": getTime(false), "iso-date-time": getDateTime(false), duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/, uri, "uri-reference": /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i, "uri-template": /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i, url: /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu, email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, hostname: /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i, ipv4: /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/, ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i, regex, uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i, "json-pointer": /^(?:\/(?:[^~/]|~0|~1)*)*$/, "json-pointer-uri-fragment": /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i, "relative-json-pointer": /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/, byte, int32: { type: "number", validate: validateInt32 }, int64: { type: "number", validate: validateInt64 }, float: { type: "number", validate: validateNumber }, double: { type: "number", validate: validateNumber }, password: true, binary: true };
|
|
100543
|
-
function isLeapYear(year) {
|
|
100544
|
-
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
100545
|
-
}
|
|
100546
|
-
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
100547
|
-
var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
100548
|
-
function date(str) {
|
|
100549
|
-
let matches = DATE.exec(str);
|
|
100550
|
-
if (!matches)
|
|
100551
|
-
return false;
|
|
100552
|
-
let year = +matches[1], month = +matches[2], day = +matches[3];
|
|
100553
|
-
return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month]);
|
|
100554
|
-
}
|
|
100555
|
-
var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
|
|
100556
|
-
function getTime(strictTimeZone) {
|
|
100557
|
-
return function(str) {
|
|
100558
|
-
let matches = TIME.exec(str);
|
|
100559
|
-
if (!matches)
|
|
100560
|
-
return false;
|
|
100561
|
-
let hr = +matches[1], min = +matches[2], sec = +matches[3], tz = matches[4], tzSign = matches[5] === "-" ? -1 : 1, tzH = +(matches[6] || 0), tzM = +(matches[7] || 0);
|
|
100562
|
-
if (tzH > 23 || tzM > 59 || strictTimeZone && !tz)
|
|
100563
|
-
return false;
|
|
100564
|
-
if (hr <= 23 && min <= 59 && sec < 60)
|
|
100565
|
-
return true;
|
|
100566
|
-
let utcMin = min - tzM * tzSign, utcHr = hr - tzH * tzSign - (utcMin < 0 ? 1 : 0);
|
|
100567
|
-
return (utcHr === 23 || utcHr === -1) && (utcMin === 59 || utcMin === -1) && sec < 61;
|
|
100568
|
-
};
|
|
100569
|
-
}
|
|
100570
|
-
var parseDateTimeEmptySpace = (str) => {
|
|
100571
|
-
if (str.charCodeAt(str.length - 6) === 32)
|
|
100572
|
-
return str.slice(0, -6) + "+" + str.slice(-5);
|
|
100573
|
-
return str;
|
|
100574
|
-
};
|
|
100575
|
-
var DATE_TIME_SEPARATOR = /t|\s/i;
|
|
100576
|
-
function getDateTime(strictTimeZone) {
|
|
100577
|
-
let time = getTime(strictTimeZone);
|
|
100578
|
-
return function(str) {
|
|
100579
|
-
let dateTime = str.split(DATE_TIME_SEPARATOR);
|
|
100580
|
-
return dateTime.length === 2 && date(dateTime[0]) && time(dateTime[1]);
|
|
100581
|
-
};
|
|
100582
|
-
}
|
|
100583
|
-
var NOT_URI_FRAGMENT = /\/|:/;
|
|
100584
|
-
var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
100585
|
-
function uri(str) {
|
|
100586
|
-
return NOT_URI_FRAGMENT.test(str) && URI.test(str);
|
|
100587
|
-
}
|
|
100588
|
-
var BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
|
|
100589
|
-
function byte(str) {
|
|
100590
|
-
return BYTE.lastIndex = 0, BYTE.test(str);
|
|
100591
|
-
}
|
|
100592
|
-
var MIN_INT32 = -2147483648;
|
|
100593
|
-
var MAX_INT32 = 2147483647;
|
|
100594
|
-
function validateInt32(value) {
|
|
100595
|
-
return Number.isInteger(value) && value <= MAX_INT32 && value >= MIN_INT32;
|
|
100596
|
-
}
|
|
100597
|
-
function validateInt64(value) {
|
|
100598
|
-
return Number.isInteger(value);
|
|
100599
|
-
}
|
|
100600
|
-
function validateNumber() {
|
|
100601
|
-
return true;
|
|
100602
|
-
}
|
|
100603
|
-
var Z_ANCHOR = /[^\\]\\Z/;
|
|
100604
|
-
function regex(str) {
|
|
100605
|
-
if (Z_ANCHOR.test(str))
|
|
100606
|
-
return false;
|
|
100607
|
-
try {
|
|
100608
|
-
return new RegExp(str), true;
|
|
100609
|
-
} catch (e) {
|
|
100610
|
-
return false;
|
|
100611
|
-
}
|
|
100612
|
-
}
|
|
100613
|
-
var isISO8601 = /(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/;
|
|
100614
|
-
var isFormalDate = /(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/;
|
|
100615
|
-
var isShortenDate = /^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/;
|
|
100616
|
-
var _validateDate = fullFormats.date;
|
|
100617
|
-
var _validateDateTime = fullFormats["date-time"];
|
|
100618
|
-
if (!exports_format.Has("date"))
|
|
100619
|
-
exports_format.Set("date", (value) => {
|
|
100620
|
-
let temp = parseDateTimeEmptySpace(value).replace(/"/g, "");
|
|
100621
|
-
if (isISO8601.test(temp) || isFormalDate.test(temp) || isShortenDate.test(temp) || _validateDate(temp)) {
|
|
100622
|
-
let date2 = new Date(temp);
|
|
100623
|
-
if (!Number.isNaN(date2.getTime()))
|
|
100624
|
-
return true;
|
|
100625
|
-
}
|
|
100626
|
-
return false;
|
|
100627
|
-
});
|
|
100628
|
-
if (!exports_format.Has("date-time"))
|
|
100629
|
-
exports_format.Set("date-time", (value) => {
|
|
100630
|
-
let temp = value.replace(/"/g, "");
|
|
100631
|
-
if (isISO8601.test(temp) || isFormalDate.test(temp) || isShortenDate.test(temp) || _validateDateTime(temp)) {
|
|
100632
|
-
let date2 = new Date(temp);
|
|
100633
|
-
if (!Number.isNaN(date2.getTime()))
|
|
100634
|
-
return true;
|
|
100635
|
-
}
|
|
100636
|
-
return false;
|
|
100637
|
-
});
|
|
100638
|
-
Object.entries(fullFormats).forEach((formatEntry) => {
|
|
100639
|
-
let [formatName, formatValue] = formatEntry;
|
|
100640
|
-
if (!exports_format.Has(formatName)) {
|
|
100641
|
-
if (formatValue instanceof RegExp)
|
|
100642
|
-
exports_format.Set(formatName, (value) => formatValue.test(value));
|
|
100643
|
-
else if (typeof formatValue === "function")
|
|
100644
|
-
exports_format.Set(formatName, formatValue);
|
|
100645
|
-
}
|
|
100646
|
-
});
|
|
100647
|
-
if (!exports_format.Has("numeric"))
|
|
100648
|
-
exports_format.Set("numeric", (value) => !!value && !isNaN(+value));
|
|
100649
|
-
if (!exports_format.Has("integer"))
|
|
100650
|
-
exports_format.Set("integer", (value) => !!value && Number.isInteger(+value));
|
|
100651
|
-
if (!exports_format.Has("boolean"))
|
|
100652
|
-
exports_format.Set("boolean", (value) => value === "true" || value === "false");
|
|
100653
|
-
if (!exports_format.Has("ObjectString"))
|
|
100654
|
-
exports_format.Set("ObjectString", (value) => {
|
|
100655
|
-
let start = value.charCodeAt(0);
|
|
100656
|
-
if (start === 9 || start === 10 || start === 32)
|
|
100657
|
-
start = value.trimStart().charCodeAt(0);
|
|
100658
|
-
if (start !== 123 && start !== 91)
|
|
100659
|
-
return false;
|
|
100660
|
-
try {
|
|
100661
|
-
return JSON.parse(value), true;
|
|
100662
|
-
} catch {
|
|
100663
|
-
return false;
|
|
100664
|
-
}
|
|
100665
|
-
});
|
|
100666
|
-
if (!exports_format.Has("ArrayString"))
|
|
100667
|
-
exports_format.Set("ArrayString", (value) => {
|
|
100668
|
-
let start = value.charCodeAt(0);
|
|
100669
|
-
if (start === 9 || start === 10 || start === 32)
|
|
100670
|
-
start = value.trimStart().charCodeAt(0);
|
|
100671
|
-
if (start !== 123 && start !== 91)
|
|
100672
|
-
return false;
|
|
100673
|
-
try {
|
|
100674
|
-
return JSON.parse(value), true;
|
|
100675
|
-
} catch {
|
|
100676
|
-
return false;
|
|
100677
|
-
}
|
|
100678
|
-
});
|
|
100679
100542
|
var isBun = typeof Bun < "u";
|
|
100680
100543
|
var mime = { aac: "audio/aac", abw: "application/x-abiword", ai: "application/postscript", arc: "application/octet-stream", avi: "video/x-msvideo", azw: "application/vnd.amazon.ebook", bin: "application/octet-stream", bz: "application/x-bzip", bz2: "application/x-bzip2", csh: "application/x-csh", css: "text/css", csv: "text/csv", doc: "application/msword", dll: "application/octet-stream", eot: "application/vnd.ms-fontobject", epub: "application/epub+zip", gif: "image/gif", htm: "text/html", html: "text/html", ico: "image/x-icon", ics: "text/calendar", jar: "application/java-archive", jpeg: "image/jpeg", jpg: "image/jpeg", js: "application/javascript", json: "application/json", mid: "audio/midi", midi: "audio/midi", mp2: "audio/mpeg", mp3: "audio/mpeg", mp4: "video/mp4", mpa: "video/mpeg", mpe: "video/mpeg", mpeg: "video/mpeg", mpkg: "application/vnd.apple.installer+xml", odp: "application/vnd.oasis.opendocument.presentation", ods: "application/vnd.oasis.opendocument.spreadsheet", odt: "application/vnd.oasis.opendocument.text", oga: "audio/ogg", ogv: "video/ogg", ogx: "application/ogg", otf: "font/otf", png: "image/png", pdf: "application/pdf", ppt: "application/vnd.ms-powerpoint", rar: "application/x-rar-compressed", rtf: "application/rtf", sh: "application/x-sh", svg: "image/svg+xml", swf: "application/x-shockwave-flash", tar: "application/x-tar", tif: "image/tiff", tiff: "image/tiff", ts: "application/typescript", ttf: "font/ttf", txt: "text/plain", vsd: "application/vnd.visio", wav: "audio/x-wav", weba: "audio/webm", webm: "video/webm", webp: "image/webp", woff: "font/woff", woff2: "font/woff2", xhtml: "application/xhtml+xml", xls: "application/vnd.ms-excel", xlsx: "application/vnd.ms-excel", xlsx_OLD: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", xml: "application/xml", xul: "application/vnd.mozilla.xul+xml", zip: "application/zip", "3gp": "video/3gpp", "3gp_DOES_NOT_CONTAIN_VIDEO": "audio/3gpp", "3gp2": "video/3gpp2", "3gp2_DOES_NOT_CONTAIN_VIDEO": "audio/3gpp2", "7z": "application/x-7z-compressed" };
|
|
100681
100544
|
var getFileExtension = (path) => {
|
|
@@ -101273,12 +101136,13 @@ class ValidationError extends Error {
|
|
|
101273
101136
|
type;
|
|
101274
101137
|
validator;
|
|
101275
101138
|
value;
|
|
101139
|
+
allowUnsafeValidationDetails;
|
|
101276
101140
|
code = "VALIDATION";
|
|
101277
101141
|
status = 422;
|
|
101278
101142
|
valueError;
|
|
101279
101143
|
expected;
|
|
101280
101144
|
customError;
|
|
101281
|
-
constructor(type, validator, value, errors) {
|
|
101145
|
+
constructor(type, validator, value, allowUnsafeValidationDetails = false, errors) {
|
|
101282
101146
|
let message = "", error, expected, customError;
|
|
101283
101147
|
if (validator?.provider === "standard" || "~standard" in validator || validator.schema && "~standard" in validator.schema) {
|
|
101284
101148
|
let standard = ("~standard" in validator ? validator : validator.schema)["~standard"];
|
|
@@ -101292,15 +101156,15 @@ class ValidationError extends Error {
|
|
|
101292
101156
|
value = value.response;
|
|
101293
101157
|
error = errors?.First() ?? ("Errors" in validator ? validator.Errors(value).First() : exports_value2.Errors(validator, value).First());
|
|
101294
101158
|
let accessor = error?.path || "root", schema = validator?.schema ?? validator;
|
|
101295
|
-
if (!isProduction)
|
|
101159
|
+
if (!isProduction && !allowUnsafeValidationDetails)
|
|
101296
101160
|
try {
|
|
101297
101161
|
expected = exports_value2.Create(schema);
|
|
101298
101162
|
} catch (error2) {
|
|
101299
101163
|
expected = { type: "Could not create expected value", message: error2?.message, error: error2 };
|
|
101300
101164
|
}
|
|
101301
|
-
if (customError = error?.schema?.message || error?.schema?.error !== undefined ? typeof error.schema.error === "function" ? error.schema.error(isProduction ? { type: "validation", on: type, found: value } : { type: "validation", on: type, value, property: accessor, message: error?.message, summary: mapValueError(error).summary, found: value, expected, errors: "Errors" in validator ? [...validator.Errors(value)].map(mapValueError) : [...exports_value2.Errors(validator, value)].map(mapValueError) }, validator) : error.schema.error : undefined, customError !== undefined)
|
|
101165
|
+
if (customError = error?.schema?.message || error?.schema?.error !== undefined ? typeof error.schema.error === "function" ? error.schema.error(isProduction && !allowUnsafeValidationDetails ? { type: "validation", on: type, found: value } : { type: "validation", on: type, value, property: accessor, message: error?.message, summary: mapValueError(error).summary, found: value, expected, errors: "Errors" in validator ? [...validator.Errors(value)].map(mapValueError) : [...exports_value2.Errors(validator, value)].map(mapValueError) }, validator) : error.schema.error : undefined, customError !== undefined)
|
|
101302
101166
|
message = typeof customError === "object" ? JSON.stringify(customError) : customError + "";
|
|
101303
|
-
else if (isProduction)
|
|
101167
|
+
else if (isProduction && !allowUnsafeValidationDetails)
|
|
101304
101168
|
message = JSON.stringify({ type: "validation", on: type, found: value });
|
|
101305
101169
|
else
|
|
101306
101170
|
message = JSON.stringify({ type: "validation", on: type, property: accessor, message: error?.message, summary: mapValueError(error).summary, expected, found: value, errors: "Errors" in validator ? [...validator.Errors(value)].map(mapValueError) : [...exports_value2.Errors(validator, value)].map(mapValueError) }, null, 2);
|
|
@@ -101309,9 +101173,12 @@ class ValidationError extends Error {
|
|
|
101309
101173
|
this.type = type;
|
|
101310
101174
|
this.validator = validator;
|
|
101311
101175
|
this.value = value;
|
|
101176
|
+
this.allowUnsafeValidationDetails = allowUnsafeValidationDetails;
|
|
101312
101177
|
this.valueError = error, this.expected = expected, this.customError = customError, Object.setPrototypeOf(this, ValidationError.prototype);
|
|
101313
101178
|
}
|
|
101314
101179
|
get all() {
|
|
101180
|
+
if (this.validator?.provider === "standard" || "~standard" in this.validator || "schema" in this.validator && this.validator.schema && "~standard" in this.validator.schema)
|
|
101181
|
+
return ("~standard" in this.validator ? this.validator : this.validator.schema)["~standard"].validate(this.value).issues?.map((issue) => ({ summary: issue.message, path: issue.path?.join(".") || "root", message: issue.message, value: this.value })) || [];
|
|
101315
101182
|
return "Errors" in this.validator ? [...this.validator.Errors(this.value)].map(mapValueError) : [...exports_value2.Errors(this.validator, this.value)].map(mapValueError);
|
|
101316
101183
|
}
|
|
101317
101184
|
static simplifyModel(validator) {
|
|
@@ -101334,7 +101201,7 @@ class ValidationError extends Error {
|
|
|
101334
101201
|
if (!this.customError)
|
|
101335
101202
|
return this.message;
|
|
101336
101203
|
let validator = this.validator, value = this.value, expected = this.expected, errors = this.all;
|
|
101337
|
-
return isProduction ? { type: "validation", on: this.type, found: value, message } : { type: "validation", on: this.type, property: this.valueError?.path || "root", message, summary: mapValueError(this.valueError).summary, found: value, expected, errors };
|
|
101204
|
+
return isProduction && !this.allowUnsafeValidationDetails ? { type: "validation", on: this.type, found: value, message } : { type: "validation", on: this.type, property: this.valueError?.path || "root", message, summary: mapValueError(this.valueError).summary, found: value, expected, errors };
|
|
101338
101205
|
}
|
|
101339
101206
|
}
|
|
101340
101207
|
var tryParse = (v, schema) => {
|
|
@@ -101430,6 +101297,143 @@ var validateFile = (options, value) => {
|
|
|
101430
101297
|
}
|
|
101431
101298
|
return true;
|
|
101432
101299
|
};
|
|
101300
|
+
var fullFormats = { date, time: getTime(true), "date-time": getDateTime(true), "iso-time": getTime(false), "iso-date-time": getDateTime(false), duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/, uri, "uri-reference": /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i, "uri-template": /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i, url: /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu, email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, hostname: /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i, ipv4: /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/, ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i, regex, uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i, "json-pointer": /^(?:\/(?:[^~/]|~0|~1)*)*$/, "json-pointer-uri-fragment": /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i, "relative-json-pointer": /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/, byte, int32: { type: "number", validate: validateInt32 }, int64: { type: "number", validate: validateInt64 }, float: { type: "number", validate: validateNumber }, double: { type: "number", validate: validateNumber }, password: true, binary: true };
|
|
101301
|
+
function isLeapYear(year) {
|
|
101302
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
101303
|
+
}
|
|
101304
|
+
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
101305
|
+
var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
101306
|
+
function date(str) {
|
|
101307
|
+
let matches = DATE.exec(str);
|
|
101308
|
+
if (!matches)
|
|
101309
|
+
return false;
|
|
101310
|
+
let year = +matches[1], month = +matches[2], day = +matches[3];
|
|
101311
|
+
return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month]);
|
|
101312
|
+
}
|
|
101313
|
+
var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
|
|
101314
|
+
function getTime(strictTimeZone) {
|
|
101315
|
+
return function(str) {
|
|
101316
|
+
let matches = TIME.exec(str);
|
|
101317
|
+
if (!matches)
|
|
101318
|
+
return false;
|
|
101319
|
+
let hr = +matches[1], min = +matches[2], sec = +matches[3], tz = matches[4], tzSign = matches[5] === "-" ? -1 : 1, tzH = +(matches[6] || 0), tzM = +(matches[7] || 0);
|
|
101320
|
+
if (tzH > 23 || tzM > 59 || strictTimeZone && !tz)
|
|
101321
|
+
return false;
|
|
101322
|
+
if (hr <= 23 && min <= 59 && sec < 60)
|
|
101323
|
+
return true;
|
|
101324
|
+
let utcMin = min - tzM * tzSign, utcHr = hr - tzH * tzSign - (utcMin < 0 ? 1 : 0);
|
|
101325
|
+
return (utcHr === 23 || utcHr === -1) && (utcMin === 59 || utcMin === -1) && sec < 61;
|
|
101326
|
+
};
|
|
101327
|
+
}
|
|
101328
|
+
var parseDateTimeEmptySpace = (str) => {
|
|
101329
|
+
if (str.charCodeAt(str.length - 6) === 32)
|
|
101330
|
+
return str.slice(0, -6) + "+" + str.slice(-5);
|
|
101331
|
+
return str;
|
|
101332
|
+
};
|
|
101333
|
+
var DATE_TIME_SEPARATOR = /t|\s/i;
|
|
101334
|
+
function getDateTime(strictTimeZone) {
|
|
101335
|
+
let time = getTime(strictTimeZone);
|
|
101336
|
+
return function(str) {
|
|
101337
|
+
let dateTime = str.split(DATE_TIME_SEPARATOR);
|
|
101338
|
+
return dateTime.length === 2 && date(dateTime[0]) && time(dateTime[1]);
|
|
101339
|
+
};
|
|
101340
|
+
}
|
|
101341
|
+
var NOT_URI_FRAGMENT = /\/|:/;
|
|
101342
|
+
var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
101343
|
+
function uri(str) {
|
|
101344
|
+
return NOT_URI_FRAGMENT.test(str) && URI.test(str);
|
|
101345
|
+
}
|
|
101346
|
+
var BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
|
|
101347
|
+
function byte(str) {
|
|
101348
|
+
return BYTE.lastIndex = 0, BYTE.test(str);
|
|
101349
|
+
}
|
|
101350
|
+
var MIN_INT32 = -2147483648;
|
|
101351
|
+
var MAX_INT32 = 2147483647;
|
|
101352
|
+
function validateInt32(value) {
|
|
101353
|
+
return Number.isInteger(value) && value <= MAX_INT32 && value >= MIN_INT32;
|
|
101354
|
+
}
|
|
101355
|
+
function validateInt64(value) {
|
|
101356
|
+
return Number.isInteger(value);
|
|
101357
|
+
}
|
|
101358
|
+
function validateNumber() {
|
|
101359
|
+
return true;
|
|
101360
|
+
}
|
|
101361
|
+
var Z_ANCHOR = /[^\\]\\Z/;
|
|
101362
|
+
function regex(str) {
|
|
101363
|
+
if (Z_ANCHOR.test(str))
|
|
101364
|
+
return false;
|
|
101365
|
+
try {
|
|
101366
|
+
return new RegExp(str), true;
|
|
101367
|
+
} catch (e) {
|
|
101368
|
+
return false;
|
|
101369
|
+
}
|
|
101370
|
+
}
|
|
101371
|
+
var isISO8601 = /(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/;
|
|
101372
|
+
var isFormalDate = /(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/;
|
|
101373
|
+
var isShortenDate = /^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/;
|
|
101374
|
+
var _validateDate = fullFormats.date;
|
|
101375
|
+
var _validateDateTime = fullFormats["date-time"];
|
|
101376
|
+
if (!exports_format.Has("date"))
|
|
101377
|
+
exports_format.Set("date", (value) => {
|
|
101378
|
+
let temp = parseDateTimeEmptySpace(value).replace(/"/g, "");
|
|
101379
|
+
if (isISO8601.test(temp) || isFormalDate.test(temp) || isShortenDate.test(temp) || _validateDate(temp)) {
|
|
101380
|
+
let date2 = new Date(temp);
|
|
101381
|
+
if (!Number.isNaN(date2.getTime()))
|
|
101382
|
+
return true;
|
|
101383
|
+
}
|
|
101384
|
+
return false;
|
|
101385
|
+
});
|
|
101386
|
+
if (!exports_format.Has("date-time"))
|
|
101387
|
+
exports_format.Set("date-time", (value) => {
|
|
101388
|
+
let temp = value.replace(/"/g, "");
|
|
101389
|
+
if (isISO8601.test(temp) || isFormalDate.test(temp) || isShortenDate.test(temp) || _validateDateTime(temp)) {
|
|
101390
|
+
let date2 = new Date(temp);
|
|
101391
|
+
if (!Number.isNaN(date2.getTime()))
|
|
101392
|
+
return true;
|
|
101393
|
+
}
|
|
101394
|
+
return false;
|
|
101395
|
+
});
|
|
101396
|
+
Object.entries(fullFormats).forEach((formatEntry) => {
|
|
101397
|
+
let [formatName, formatValue] = formatEntry;
|
|
101398
|
+
if (!exports_format.Has(formatName)) {
|
|
101399
|
+
if (formatValue instanceof RegExp)
|
|
101400
|
+
exports_format.Set(formatName, (value) => formatValue.test(value));
|
|
101401
|
+
else if (typeof formatValue === "function")
|
|
101402
|
+
exports_format.Set(formatName, formatValue);
|
|
101403
|
+
}
|
|
101404
|
+
});
|
|
101405
|
+
if (!exports_format.Has("numeric"))
|
|
101406
|
+
exports_format.Set("numeric", (value) => !!value && !isNaN(+value));
|
|
101407
|
+
if (!exports_format.Has("integer"))
|
|
101408
|
+
exports_format.Set("integer", (value) => !!value && Number.isInteger(+value));
|
|
101409
|
+
if (!exports_format.Has("boolean"))
|
|
101410
|
+
exports_format.Set("boolean", (value) => value === "true" || value === "false");
|
|
101411
|
+
if (!exports_format.Has("ObjectString"))
|
|
101412
|
+
exports_format.Set("ObjectString", (value) => {
|
|
101413
|
+
let start = value.charCodeAt(0);
|
|
101414
|
+
if (start === 9 || start === 10 || start === 32)
|
|
101415
|
+
start = value.trimStart().charCodeAt(0);
|
|
101416
|
+
if (start !== 123 && start !== 91)
|
|
101417
|
+
return false;
|
|
101418
|
+
try {
|
|
101419
|
+
return JSON.parse(value), true;
|
|
101420
|
+
} catch {
|
|
101421
|
+
return false;
|
|
101422
|
+
}
|
|
101423
|
+
});
|
|
101424
|
+
if (!exports_format.Has("ArrayString"))
|
|
101425
|
+
exports_format.Set("ArrayString", (value) => {
|
|
101426
|
+
let start = value.charCodeAt(0);
|
|
101427
|
+
if (start === 9 || start === 10 || start === 32)
|
|
101428
|
+
start = value.trimStart().charCodeAt(0);
|
|
101429
|
+
if (start !== 123 && start !== 91)
|
|
101430
|
+
return false;
|
|
101431
|
+
try {
|
|
101432
|
+
return JSON.parse(value), true;
|
|
101433
|
+
} catch {
|
|
101434
|
+
return false;
|
|
101435
|
+
}
|
|
101436
|
+
});
|
|
101433
101437
|
var t = Object.assign({}, Type);
|
|
101434
101438
|
createType("UnionEnum", (schema, value) => (typeof value === "number" || typeof value === "string" || value === null) && schema.enum.includes(value));
|
|
101435
101439
|
createType("ArrayBuffer", (schema, value) => value instanceof ArrayBuffer);
|
|
@@ -101840,10 +101844,11 @@ var serializeCookie = (cookies) => {
|
|
|
101840
101844
|
return set2[0];
|
|
101841
101845
|
return set2;
|
|
101842
101846
|
};
|
|
101847
|
+
var env2 = isBun ? Bun.env : typeof process < "u" && process?.env ? process.env : {};
|
|
101843
101848
|
var handleFile = (response, set2) => {
|
|
101844
101849
|
if (!isBun && response instanceof Promise)
|
|
101845
101850
|
return response.then((res) => handleFile(res, set2));
|
|
101846
|
-
let size = response.size, immutable = set2 && (set2.status === 206 || set2.status === 304 || set2.status === 412 || set2.status === 416), defaultHeader = immutable ? {
|
|
101851
|
+
let size = response.size, immutable = set2 && (set2.status === 206 || set2.status === 304 || set2.status === 412 || set2.status === 416), defaultHeader = immutable ? {} : { "accept-ranges": "bytes", "content-range": size ? `bytes 0-${size - 1}/${size}` : undefined };
|
|
101847
101852
|
if (!set2 && !size)
|
|
101848
101853
|
return new Response(response);
|
|
101849
101854
|
if (!set2)
|
|
@@ -101902,6 +101907,7 @@ var responseToSetHeaders = (response, set2) => {
|
|
|
101902
101907
|
}
|
|
101903
101908
|
return set2;
|
|
101904
101909
|
};
|
|
101910
|
+
var allowRapidStream = env2.ELYSIA_RAPID_STREAM === "true";
|
|
101905
101911
|
var createStreamHandler = ({ mapResponse, mapCompactResponse }) => async (generator, set2, request) => {
|
|
101906
101912
|
let init = generator.next?.();
|
|
101907
101913
|
if (set2)
|
|
@@ -101927,6 +101933,7 @@ var createStreamHandler = ({ mapResponse, mapCompactResponse }) => async (genera
|
|
|
101927
101933
|
set2.headers["cache-control"] = "no-cache";
|
|
101928
101934
|
} else
|
|
101929
101935
|
set2 = { status: 200, headers: { "content-type": contentType, "transfer-encoding": "chunked", "cache-control": "no-cache", connection: "keep-alive" } };
|
|
101936
|
+
let isBrowser = request?.headers.has("Origin");
|
|
101930
101937
|
return new Response(new ReadableStream({ async start(controller) {
|
|
101931
101938
|
let end = false;
|
|
101932
101939
|
if (request?.signal?.addEventListener("abort", () => {
|
|
@@ -101964,7 +101971,7 @@ var createStreamHandler = ({ mapResponse, mapCompactResponse }) => async (genera
|
|
|
101964
101971
|
}
|
|
101965
101972
|
else
|
|
101966
101973
|
controller.enqueue(format(chunk.toString()));
|
|
101967
|
-
if (!isSSE)
|
|
101974
|
+
if (!allowRapidStream && isBrowser && !isSSE)
|
|
101968
101975
|
await new Promise((resolve) => setTimeout(() => resolve(), 0));
|
|
101969
101976
|
}
|
|
101970
101977
|
}
|
|
@@ -102035,6 +102042,25 @@ var createResponseHandler = (handler) => {
|
|
|
102035
102042
|
return response;
|
|
102036
102043
|
};
|
|
102037
102044
|
};
|
|
102045
|
+
async function tee(source, branches = 2) {
|
|
102046
|
+
let buffer = [], done = false, waiting = [];
|
|
102047
|
+
(async () => {
|
|
102048
|
+
for await (let value of source)
|
|
102049
|
+
buffer.push(value), waiting.forEach((w) => w.resolve()), waiting = [];
|
|
102050
|
+
done = true, waiting.forEach((w) => w.resolve());
|
|
102051
|
+
})();
|
|
102052
|
+
async function* makeIterator() {
|
|
102053
|
+
let i2 = 0;
|
|
102054
|
+
while (true)
|
|
102055
|
+
if (i2 < buffer.length)
|
|
102056
|
+
yield buffer[i2++];
|
|
102057
|
+
else if (done)
|
|
102058
|
+
return;
|
|
102059
|
+
else
|
|
102060
|
+
await new Promise((resolve) => waiting.push({ resolve }));
|
|
102061
|
+
}
|
|
102062
|
+
return Array.from({ length: branches }, makeIterator);
|
|
102063
|
+
}
|
|
102038
102064
|
var handleElysiaFile = (file2, set2 = { headers: {} }) => {
|
|
102039
102065
|
let path = file2.path, contentType = mime[path.slice(path.lastIndexOf(".") + 1)];
|
|
102040
102066
|
if (contentType)
|
|
@@ -102343,7 +102369,7 @@ else c.body[key]=value}`;
|
|
|
102343
102369
|
if (!app.server)
|
|
102344
102370
|
throw Error("Elysia isn't running. Call `app.listen` to start the server.");
|
|
102345
102371
|
if (app.server) {
|
|
102346
|
-
if (app.server.stop(closeActiveConnections), app.server = null, app.event.stop?.length)
|
|
102372
|
+
if (await app.server.stop(closeActiveConnections), app.server = null, app.event.stop?.length)
|
|
102347
102373
|
for (let i2 = 0;i2 < app.event.stop.length; i2++)
|
|
102348
102374
|
app.event.stop[i2].fn(app);
|
|
102349
102375
|
}
|
|
@@ -102366,12 +102392,12 @@ else p=u.substring(s, qi)
|
|
|
102366
102392
|
return fnLiteral += decoratorsLiteral, fnLiteral += `}
|
|
102367
102393
|
`, fnLiteral;
|
|
102368
102394
|
}, error404(hasEventHook, hasErrorHook, afterHandle = "") {
|
|
102369
|
-
let findDynamicRoute = "if(route===null){" + afterHandle + `
|
|
102395
|
+
let findDynamicRoute = "if(route===null){" + afterHandle + (hasErrorHook ? "" : "c.set.status=404") + `
|
|
102370
102396
|
return `;
|
|
102371
102397
|
if (hasErrorHook)
|
|
102372
102398
|
findDynamicRoute += `app.handleError(c,notFound,false,${this.parameters})`;
|
|
102373
102399
|
else
|
|
102374
|
-
findDynamicRoute += hasEventHook ? "new Response(error404Message,{status:c.set.status===200?404:c.set.status,headers:c.set.headers})" : "error404.clone()";
|
|
102400
|
+
findDynamicRoute += hasEventHook ? "c.response=c.responseValue=new Response(error404Message,{status:c.set.status===200?404:c.set.status,headers:c.set.headers})" : "c.response=c.responseValue=error404.clone()";
|
|
102375
102401
|
return findDynamicRoute += "}", { declare: hasErrorHook ? "" : `const error404Message=notFound.message.toString()
|
|
102376
102402
|
const error404=new Response(error404Message,{status:404})
|
|
102377
102403
|
`, code: findDynamicRoute };
|
|
@@ -104170,7 +104196,7 @@ var mergeObjectSchemas = (schemas) => {
|
|
|
104170
104196
|
newSchema = schema;
|
|
104171
104197
|
continue;
|
|
104172
104198
|
}
|
|
104173
|
-
newSchema = { ...newSchema, ...schema, properties: { ...newSchema.properties, ...schema.properties }, required: [...newSchema?.required ?? [], ...schema.required] };
|
|
104199
|
+
newSchema = { ...newSchema, ...schema, properties: { ...newSchema.properties, ...schema.properties }, required: [...newSchema?.required ?? [], ...schema.required ?? []] };
|
|
104174
104200
|
}
|
|
104175
104201
|
if (newSchema) {
|
|
104176
104202
|
if (newSchema.required)
|
|
@@ -104253,16 +104279,18 @@ var createReport = ({ context = "c", trace = [], addFn }) => {
|
|
|
104253
104279
|
for (let i2 = 0;i2 < trace.length; i2++)
|
|
104254
104280
|
addFn(`let report${i2},reportChild${i2},reportErr${i2},reportErrChild${i2};let trace${i2}=${context}[ELYSIA_TRACE]?.[${i2}]??trace[${i2}](${context});
|
|
104255
104281
|
`);
|
|
104256
|
-
return (event, { name, total = 0 } = {}) => {
|
|
104282
|
+
return (event, { name, total = 0, alias } = {}) => {
|
|
104257
104283
|
if (!name)
|
|
104258
104284
|
name = "anonymous";
|
|
104259
104285
|
let reporter = event === "error" ? "reportErr" : "report";
|
|
104260
104286
|
for (let i2 = 0;i2 < trace.length; i2++)
|
|
104261
|
-
addFn(`${reporter}${i2}
|
|
104287
|
+
if (addFn(`${alias ? "const " : ""}${alias ?? reporter}${i2}=trace${i2}.${event}({id,event:'${event}',name:'${name}',begin:performance.now(),total:${total}})
|
|
104288
|
+
`), alias)
|
|
104289
|
+
addFn(`${reporter}${i2}=${alias}${i2}
|
|
104262
104290
|
`);
|
|
104263
104291
|
return { resolve() {
|
|
104264
104292
|
for (let i2 = 0;i2 < trace.length; i2++)
|
|
104265
|
-
addFn(`${reporter}${i2}.resolve()
|
|
104293
|
+
addFn(`${alias ?? reporter}${i2}.resolve()
|
|
104266
104294
|
`);
|
|
104267
104295
|
}, resolveChild(name2) {
|
|
104268
104296
|
for (let i2 = 0;i2 < trace.length; i2++)
|
|
@@ -104294,7 +104322,7 @@ var composeCleaner = ({ schema, name, type, typeAlias = type, normalize, ignoreT
|
|
|
104294
104322
|
`;
|
|
104295
104323
|
return "";
|
|
104296
104324
|
};
|
|
104297
|
-
var composeValidationFactory = ({ injectResponse = "", normalize = false, validator, encodeSchema = false, isStaticResponse = false, hasSanitize = false }) => ({ validate: (type, value = `c.${type}`, error) => `c.set.status=422;throw new ValidationError('${type}',validator.${type},${value}${error ? "," + error : ""})`, response: (name = "r") => {
|
|
104325
|
+
var composeValidationFactory = ({ injectResponse = "", normalize = false, validator, encodeSchema = false, isStaticResponse = false, hasSanitize = false, allowUnsafeValidationDetails = false }) => ({ validate: (type, value = `c.${type}`, error) => `c.set.status=422;throw new ValidationError('${type}',validator.${type},${value},${allowUnsafeValidationDetails}${error ? "," + error : ""})`, response: (name = "r") => {
|
|
104298
104326
|
if (isStaticResponse || !validator.response)
|
|
104299
104327
|
return "";
|
|
104300
104328
|
let code = injectResponse + `
|
|
@@ -104307,7 +104335,7 @@ case ${status2}:
|
|
|
104307
104335
|
`, value.provider === "standard") {
|
|
104308
104336
|
code += `let vare${status2}=validator.response[${status2}].Check(${name})
|
|
104309
104337
|
if(vare${status2} instanceof Promise)vare${status2}=await vare${status2}
|
|
104310
|
-
if(vare${status2}.issues)throw new ValidationError('response',validator.response[${status2}],${name},vare${status2}.issues)
|
|
104338
|
+
if(vare${status2}.issues)throw new ValidationError('response',validator.response[${status2}],${name},${allowUnsafeValidationDetails},vare${status2}.issues)
|
|
104311
104339
|
${name}=vare${status2}.value
|
|
104312
104340
|
c.set.status=${status2}
|
|
104313
104341
|
break
|
|
@@ -104330,12 +104358,12 @@ break
|
|
|
104330
104358
|
code += clean2({ ignoreTryCatch: true });
|
|
104331
104359
|
code += `c.set.status=${status2}}catch{` + (applyErrorCleaner ? `try{
|
|
104332
104360
|
` + clean2({ ignoreTryCatch: true }) + `${name}=validator.response[${status2}].Encode(${name})
|
|
104333
|
-
}catch{throw new ValidationError('response',validator.response[${status2}],${name})}` : `throw new ValidationError('response',validator.response[${status2}],${name})`) + "}";
|
|
104361
|
+
}catch{throw new ValidationError('response',validator.response[${status2}],${name},${allowUnsafeValidationDetails})}` : `throw new ValidationError('response',validator.response[${status2}],${name}),${allowUnsafeValidationDetails}`) + "}";
|
|
104334
104362
|
} else {
|
|
104335
104363
|
if (!appliedCleaner)
|
|
104336
104364
|
code += clean2();
|
|
104337
104365
|
if (!noValidate)
|
|
104338
|
-
code += `if(validator.response[${status2}].Check(${name})===false)throw new ValidationError('response',validator.response[${status2}],${name})
|
|
104366
|
+
code += `if(validator.response[${status2}].Check(${name})===false)throw new ValidationError('response',validator.response[${status2}],${name},${allowUnsafeValidationDetails})
|
|
104339
104367
|
c.set.status=${status2}
|
|
104340
104368
|
`;
|
|
104341
104369
|
}
|
|
@@ -104386,8 +104414,8 @@ var isGenerator = (v) => {
|
|
|
104386
104414
|
let fn = v?.fn ?? v;
|
|
104387
104415
|
return fn.constructor.name === "AsyncGeneratorFunction" || fn.constructor.name === "GeneratorFunction";
|
|
104388
104416
|
};
|
|
104389
|
-
var coerceTransformDecodeError = (fnLiteral, type, value = `c.${type}`) => `try{${fnLiteral}}catch(error){if(error.constructor.name === 'TransformDecodeError'){c.set.status=422
|
|
104390
|
-
throw error.error ?? new ValidationError('${type}',validator.${type},${value})}}`;
|
|
104417
|
+
var coerceTransformDecodeError = (fnLiteral, type, allowUnsafeValidationDetails = false, value = `c.${type}`) => `try{${fnLiteral}}catch(error){if(error.constructor.name === 'TransformDecodeError'){c.set.status=422
|
|
104418
|
+
throw error.error ?? new ValidationError('${type}',validator.${type},${value},${allowUnsafeValidationDetails})}}`;
|
|
104391
104419
|
var composeHandler = ({ app, path, method, hooks, validator, handler, allowMeta = false, inference }) => {
|
|
104392
104420
|
let adapter = app["~adapter"].composeHandler, adapterHandler = app["~adapter"].handler, isHandleFn = typeof handler === "function";
|
|
104393
104421
|
if (!isHandleFn) {
|
|
@@ -104433,7 +104461,7 @@ if(_setCookie){`, cookieMeta.sign === true)
|
|
|
104433
104461
|
`;
|
|
104434
104462
|
}
|
|
104435
104463
|
return _encodeCookie;
|
|
104436
|
-
}, normalize = app.config.normalize, encodeSchema = app.config.encodeSchema, validation = composeValidationFactory({ normalize, validator, encodeSchema, isStaticResponse: handler instanceof Response, hasSanitize: !!app.config.sanitize });
|
|
104464
|
+
}, normalize = app.config.normalize, encodeSchema = app.config.encodeSchema, allowUnsafeValidationDetails = app.config.allowUnsafeValidationDetails, validation = composeValidationFactory({ normalize, validator, encodeSchema, isStaticResponse: handler instanceof Response, hasSanitize: !!app.config.sanitize, allowUnsafeValidationDetails });
|
|
104437
104465
|
if (hasHeaders)
|
|
104438
104466
|
fnLiteral += adapter.headers;
|
|
104439
104467
|
if (hasTrace)
|
|
@@ -104481,17 +104509,20 @@ c.cookie=await parseCookie(c.set,c.request.headers.get('cookie'),${options})
|
|
|
104481
104509
|
return _afterResponse;
|
|
104482
104510
|
if (!hooks.afterResponse?.length && !hasTrace)
|
|
104483
104511
|
return "";
|
|
104484
|
-
let afterResponse2 = ""
|
|
104512
|
+
let afterResponse2 = "";
|
|
104485
104513
|
afterResponse2 += `
|
|
104486
|
-
setImmediate(
|
|
104514
|
+
setImmediate(async()=>{if(c.responseValue){if(c.responseValue instanceof ElysiaCustomStatusResponse) c.set.status=c.responseValue.code
|
|
104515
|
+
if(afterHandlerStreamListener)for await(const v of afterHandlerStreamListener){}
|
|
104516
|
+
}
|
|
104517
|
+
`;
|
|
104487
104518
|
let reporter = createReport({ trace: hooks.trace, addFn: (word) => {
|
|
104488
104519
|
afterResponse2 += word;
|
|
104489
104520
|
} })("afterResponse", { total: hooks.afterResponse?.length });
|
|
104490
104521
|
if (hooks.afterResponse?.length && hooks.afterResponse)
|
|
104491
104522
|
for (let i2 = 0;i2 < hooks.afterResponse.length; i2++) {
|
|
104492
|
-
let endUnit = reporter.resolveChild(hooks.afterResponse[i2].fn.name),
|
|
104523
|
+
let endUnit = reporter.resolveChild(hooks.afterResponse[i2].fn.name), prefix = isAsync(hooks.afterResponse[i2]) ? "await " : "";
|
|
104493
104524
|
afterResponse2 += `
|
|
104494
|
-
${
|
|
104525
|
+
${prefix}e.afterResponse[${i2}](c)
|
|
104495
104526
|
`, endUnit();
|
|
104496
104527
|
}
|
|
104497
104528
|
return reporter.resolve(), afterResponse2 += `})
|
|
@@ -104505,6 +104536,9 @@ ${prefix2}e.afterResponse[${i2}](c)
|
|
|
104505
104536
|
}, mapResponseContext = maybeStream || adapter.mapResponseContext ? `,${adapter.mapResponseContext}` : "";
|
|
104506
104537
|
if (hasTrace || inference.route)
|
|
104507
104538
|
fnLiteral += `c.route=\`${path}\`
|
|
104539
|
+
`;
|
|
104540
|
+
if (hasTrace || hooks.afterResponse?.length)
|
|
104541
|
+
fnLiteral += `let afterHandlerStreamListener
|
|
104508
104542
|
`;
|
|
104509
104543
|
let parseReporter = report("parse", { total: hooks.parse?.length });
|
|
104510
104544
|
if (hasBody) {
|
|
@@ -104708,7 +104742,7 @@ if(vah.issues){` + validation.validate("headers", undefined, "vah.issues") + `}e
|
|
|
104708
104742
|
fnLiteral += "if(validator.headers.Check(c.headers) === false){" + validation.validate("headers") + "}";
|
|
104709
104743
|
if (validator.headers.hasTransform)
|
|
104710
104744
|
fnLiteral += coerceTransformDecodeError(`c.headers=validator.headers.Decode(c.headers)
|
|
104711
|
-
`, "headers");
|
|
104745
|
+
`, "headers", allowUnsafeValidationDetails);
|
|
104712
104746
|
if (validator.headers.isOptional)
|
|
104713
104747
|
fnLiteral += "}";
|
|
104714
104748
|
}
|
|
@@ -104729,7 +104763,7 @@ if(vap.issues){` + validation.validate("params", undefined, "vap.issues") + `}el
|
|
|
104729
104763
|
fnLiteral += "if(validator.params.Check(c.params)===false){" + validation.validate("params") + "}";
|
|
104730
104764
|
if (validator.params.hasTransform)
|
|
104731
104765
|
fnLiteral += coerceTransformDecodeError(`c.params=validator.params.Decode(c.params)
|
|
104732
|
-
`, "params");
|
|
104766
|
+
`, "params", allowUnsafeValidationDetails);
|
|
104733
104767
|
}
|
|
104734
104768
|
if (validator.query) {
|
|
104735
104769
|
if (Kind in validator.query?.schema && validator.query.hasDefault)
|
|
@@ -104750,8 +104784,8 @@ if(vaq.issues){` + validation.validate("query", undefined, "vaq.issues") + `}els
|
|
|
104750
104784
|
fnLiteral += "if(validator.query.Check(c.query)===false){" + validation.validate("query") + "}";
|
|
104751
104785
|
if (validator.query.hasTransform)
|
|
104752
104786
|
fnLiteral += coerceTransformDecodeError(`c.query=validator.query.Decode(c.query)
|
|
104753
|
-
`, "query"), fnLiteral += coerceTransformDecodeError(`c.query=validator.query.Decode(c.query)
|
|
104754
|
-
`, "query");
|
|
104787
|
+
`, "query", allowUnsafeValidationDetails), fnLiteral += coerceTransformDecodeError(`c.query=validator.query.Decode(c.query)
|
|
104788
|
+
`, "query", allowUnsafeValidationDetails);
|
|
104755
104789
|
if (validator.query.isOptional)
|
|
104756
104790
|
fnLiteral += "}";
|
|
104757
104791
|
}
|
|
@@ -104803,7 +104837,7 @@ if(vab.issues){` + validation.validate("body", undefined, "vab.issues") + `}else
|
|
|
104803
104837
|
fnLiteral += "if(validator.body.Check(c.body)===false){" + validation.validate("body") + "}";
|
|
104804
104838
|
if (validator.body.hasTransform)
|
|
104805
104839
|
fnLiteral += coerceTransformDecodeError(`if(isNotEmptyObject)c.body=validator.body.Decode(c.body)
|
|
104806
|
-
`, "body");
|
|
104840
|
+
`, "body", allowUnsafeValidationDetails);
|
|
104807
104841
|
if (hasUnion && validator.body.schema.anyOf?.length) {
|
|
104808
104842
|
let iterator = Object.values(validator.body.schema.anyOf);
|
|
104809
104843
|
for (let i2 = 0;i2 < iterator.length; i2++) {
|
|
@@ -104868,7 +104902,7 @@ if(vac.issues){` + validation.validate("cookie", undefined, "vac.issues") + `}el
|
|
|
104868
104902
|
`;
|
|
104869
104903
|
else if (validator.body?.schema?.noValidate !== true) {
|
|
104870
104904
|
if (fnLiteral += "if(validator.cookie.Check(cookieValue)===false){" + validation.validate("cookie", "cookieValue") + "}", validator.cookie.hasTransform)
|
|
104871
|
-
fnLiteral += coerceTransformDecodeError("for(const [key,value] of Object.entries(validator.cookie.Decode(cookieValue))){c.cookie[key].value=value}", "cookie");
|
|
104905
|
+
fnLiteral += coerceTransformDecodeError("for(const [key,value] of Object.entries(validator.cookie.Decode(cookieValue))){c.cookie[key].value=value}", "cookie", allowUnsafeValidationDetails);
|
|
104872
104906
|
}
|
|
104873
104907
|
if (validator.cookie.isOptional)
|
|
104874
104908
|
fnLiteral += "}";
|
|
@@ -104945,8 +104979,21 @@ if(mr!==undefined)be=c.response=c.responseValue=mr}`, endUnit2();
|
|
|
104945
104979
|
}
|
|
104946
104980
|
reporter.resolve();
|
|
104947
104981
|
}
|
|
104982
|
+
function reportHandler(name) {
|
|
104983
|
+
let handleReporter = report("handle", { name, alias: "reportHandler" });
|
|
104984
|
+
return () => {
|
|
104985
|
+
if (hasTrace)
|
|
104986
|
+
fnLiteral += 'if(r&&(r[Symbol.iterator]||r[Symbol.asyncIterator])&&typeof r.next==="function"){' + (maybeAsync ? "" : "(async()=>{") + `const stream=await tee(r,3)
|
|
104987
|
+
r=stream[0]
|
|
104988
|
+
const listener=stream[1]
|
|
104989
|
+
` + (hasTrace || hooks.afterResponse?.length ? `afterHandlerStreamListener=stream[2]
|
|
104990
|
+
` : "") + `setImmediate(async ()=>{if(listener)for await(const v of listener){}
|
|
104991
|
+
`, handleReporter.resolve(), fnLiteral += "})" + (maybeAsync ? "" : "})()") + "}else{", handleReporter.resolve(), fnLiteral += `}
|
|
104992
|
+
`;
|
|
104993
|
+
};
|
|
104994
|
+
}
|
|
104948
104995
|
if (hooks.afterHandle?.length || hasTrace) {
|
|
104949
|
-
let
|
|
104996
|
+
let resolveHandler = reportHandler(isHandleFn ? handler.name : undefined);
|
|
104950
104997
|
if (hooks.afterHandle?.length)
|
|
104951
104998
|
fnLiteral += isAsyncHandler ? `let r=c.response=c.responseValue=await ${handle}
|
|
104952
104999
|
` : `let r=c.response=c.responseValue=${handle}
|
|
@@ -104955,7 +105002,7 @@ if(mr!==undefined)be=c.response=c.responseValue=mr}`, endUnit2();
|
|
|
104955
105002
|
fnLiteral += isAsyncHandler ? `let r=await ${handle}
|
|
104956
105003
|
` : `let r=${handle}
|
|
104957
105004
|
`;
|
|
104958
|
-
|
|
105005
|
+
resolveHandler();
|
|
104959
105006
|
let reporter = report("afterHandle", { total: hooks.afterHandle?.length });
|
|
104960
105007
|
if (hooks.afterHandle?.length)
|
|
104961
105008
|
for (let i2 = 0;i2 < hooks.afterHandle.length; i2++) {
|
|
@@ -104987,11 +105034,11 @@ if(mr!==undefined)r=c.response=c.responseValue=mr
|
|
|
104987
105034
|
}
|
|
104988
105035
|
mapResponseReporter.resolve(), fnLiteral += mapResponse3();
|
|
104989
105036
|
} else {
|
|
104990
|
-
let
|
|
105037
|
+
let resolveHandler = reportHandler(isHandleFn ? handler.name : undefined);
|
|
104991
105038
|
if (validator.response || hooks.mapResponse?.length || hasTrace) {
|
|
104992
105039
|
if (fnLiteral += isAsyncHandler ? `let r=await ${handle}
|
|
104993
105040
|
` : `let r=${handle}
|
|
104994
|
-
`,
|
|
105041
|
+
`, resolveHandler(), validator.response)
|
|
104995
105042
|
fnLiteral += validation.response();
|
|
104996
105043
|
let mapResponseReporter = report("mapResponse", { total: hooks.mapResponse?.length });
|
|
104997
105044
|
if (hooks.mapResponse?.length) {
|
|
@@ -105015,7 +105062,7 @@ else return ${handle}.clone()` : `return ${handle}.clone()`, fnLiteral += `
|
|
|
105015
105062
|
} else if (hasCookie || hasTrace) {
|
|
105016
105063
|
fnLiteral += isAsyncHandler ? `let r=await ${handle}
|
|
105017
105064
|
` : `let r=${handle}
|
|
105018
|
-
`,
|
|
105065
|
+
`, resolveHandler();
|
|
105019
105066
|
let mapResponseReporter = report("mapResponse", { total: hooks.mapResponse?.length });
|
|
105020
105067
|
if (hooks.mapResponse?.length) {
|
|
105021
105068
|
fnLiteral += `c.response=c.responseValue= r
|
|
@@ -105028,7 +105075,7 @@ if(mr!==undefined)r=c.response=c.responseValue=mr}`, endUnit();
|
|
|
105028
105075
|
}
|
|
105029
105076
|
mapResponseReporter.resolve(), fnLiteral += encodeCookie() + mapResponse3();
|
|
105030
105077
|
} else {
|
|
105031
|
-
|
|
105078
|
+
resolveHandler();
|
|
105032
105079
|
let handled = isAsyncHandler ? `await ${handle}` : handle;
|
|
105033
105080
|
if (handler instanceof Response)
|
|
105034
105081
|
fnLiteral += afterResponse(), fnLiteral += inference.set ? `if(isNotEmpty(c.set.headers)||c.set.status!==200||c.set.redirect||c.set.cookie)return mapResponse(${saveResponse}${handle}.clone(),c.set${mapResponseContext})
|
|
@@ -105097,7 +105144,7 @@ if(mep!==undefined)er=mep
|
|
|
105097
105144
|
if (errorReporter.resolve(), fnLiteral += "return handleError(c,error,true)", !maybeAsync && hooks.error?.length)
|
|
105098
105145
|
fnLiteral += "})()";
|
|
105099
105146
|
fnLiteral += "}";
|
|
105100
|
-
let adapterVariables = adapter.inject ? Object.keys(adapter.inject).join(",") + "," : "", init = "const {handler,handleError,hooks:e, " + allocateIf("validator,", hasValidation) + "mapResponse,mapCompactResponse,mapEarlyResponse,isNotEmpty,utils:{" + allocateIf("parseQuery,", hasBody) + allocateIf("parseQueryFromURL,", hasQuery) + "},error:{" + allocateIf("ValidationError,", hasValidation) + allocateIf("ParseError", hasBody) + "},fileType,schema,definitions,ERROR_CODE," + allocateIf("parseCookie,", hasCookie) + allocateIf("signCookie,", hasCookie) + allocateIf("decodeURIComponent,", hasQuery) + "ElysiaCustomStatusResponse," + allocateIf("ELYSIA_TRACE,", hasTrace) + allocateIf("ELYSIA_REQUEST_ID,", hasTrace) + allocateIf("parser,", hooks.parse?.length) + allocateIf("getServer,", inference.server) + allocateIf("fileUnions,", fileUnions.length) + adapterVariables + allocateIf("TypeBoxError", hasValidation) + `}=hooks
|
|
105147
|
+
let adapterVariables = adapter.inject ? Object.keys(adapter.inject).join(",") + "," : "", init = "const {handler,handleError,hooks:e, " + allocateIf("validator,", hasValidation) + "mapResponse,mapCompactResponse,mapEarlyResponse,isNotEmpty,utils:{" + allocateIf("parseQuery,", hasBody) + allocateIf("parseQueryFromURL,", hasQuery) + "},error:{" + allocateIf("ValidationError,", hasValidation) + allocateIf("ParseError", hasBody) + "},fileType,schema,definitions,tee,ERROR_CODE," + allocateIf("parseCookie,", hasCookie) + allocateIf("signCookie,", hasCookie) + allocateIf("decodeURIComponent,", hasQuery) + "ElysiaCustomStatusResponse," + allocateIf("ELYSIA_TRACE,", hasTrace) + allocateIf("ELYSIA_REQUEST_ID,", hasTrace) + allocateIf("parser,", hooks.parse?.length) + allocateIf("getServer,", inference.server) + allocateIf("fileUnions,", fileUnions.length) + adapterVariables + allocateIf("TypeBoxError", hasValidation) + `}=hooks
|
|
105101
105148
|
const trace=e.trace
|
|
105102
105149
|
return ${maybeAsync ? "async " : ""}function handle(c){`;
|
|
105103
105150
|
if (hooks.beforeHandle?.length)
|
|
@@ -105116,7 +105163,7 @@ c.defs=definitions
|
|
|
105116
105163
|
fnLiteral = init + fnLiteral + "}", init = "";
|
|
105117
105164
|
try {
|
|
105118
105165
|
return Function("hooks", `"use strict";
|
|
105119
|
-
` + fnLiteral)({ handler, hooks: lifeCycleToFn(hooks), validator: hasValidation ? validator : undefined, handleError: app.handleError, mapResponse: adapterHandler.mapResponse, mapCompactResponse: adapterHandler.mapCompactResponse, mapEarlyResponse: adapterHandler.mapEarlyResponse, isNotEmpty, utils: { parseQuery: hasBody ? parseQuery : undefined, parseQueryFromURL: hasQuery ? validator.query?.provider === "standard" ? parseQueryStandardSchema : parseQueryFromURL : undefined }, error: { ValidationError: hasValidation ? ValidationError : undefined, ParseError: hasBody ? ParseError2 : undefined }, fileType, schema: app.router.history, definitions: app.definitions.type, ERROR_CODE, parseCookie: hasCookie ? parseCookie : undefined, signCookie: hasCookie ? signCookie : undefined, decodeURIComponent: hasQuery ? import_fast_decode_uri_component3.default : undefined, ElysiaCustomStatusResponse, ELYSIA_TRACE: hasTrace ? ELYSIA_TRACE : undefined, ELYSIA_REQUEST_ID: hasTrace ? ELYSIA_REQUEST_ID : undefined, getServer: inference.server ? () => app.getServer() : undefined, fileUnions: fileUnions.length ? fileUnions : undefined, TypeBoxError: hasValidation ? TypeBoxError : undefined, parser: app["~parser"], ...adapter.inject });
|
|
105166
|
+
` + fnLiteral)({ handler, hooks: lifeCycleToFn(hooks), validator: hasValidation ? validator : undefined, handleError: app.handleError, mapResponse: adapterHandler.mapResponse, mapCompactResponse: adapterHandler.mapCompactResponse, mapEarlyResponse: adapterHandler.mapEarlyResponse, isNotEmpty, utils: { parseQuery: hasBody ? parseQuery : undefined, parseQueryFromURL: hasQuery ? validator.query?.provider === "standard" ? parseQueryStandardSchema : parseQueryFromURL : undefined }, error: { ValidationError: hasValidation ? ValidationError : undefined, ParseError: hasBody ? ParseError2 : undefined }, fileType, schema: app.router.history, definitions: app.definitions.type, tee, ERROR_CODE, parseCookie: hasCookie ? parseCookie : undefined, signCookie: hasCookie ? signCookie : undefined, decodeURIComponent: hasQuery ? import_fast_decode_uri_component3.default : undefined, ElysiaCustomStatusResponse, ELYSIA_TRACE: hasTrace ? ELYSIA_TRACE : undefined, ELYSIA_REQUEST_ID: hasTrace ? ELYSIA_REQUEST_ID : undefined, getServer: inference.server ? () => app.getServer() : undefined, fileUnions: fileUnions.length ? fileUnions : undefined, TypeBoxError: hasValidation ? TypeBoxError : undefined, parser: app["~parser"], ...adapter.inject });
|
|
105120
105167
|
} catch (error) {
|
|
105121
105168
|
let debugHooks = lifeCycleToFn(hooks);
|
|
105122
105169
|
console.log("[Composer] failed to generate optimized handler"), console.log("---"), console.log({ handler: typeof handler === "function" ? handler.toString() : handler, instruction: fnLiteral, hooks: { ...debugHooks, transform: debugHooks?.transform?.map?.((x2) => x2.toString()), resolve: debugHooks?.resolve?.map?.((x2) => x2.toString()), beforeHandle: debugHooks?.beforeHandle?.map?.((x2) => x2.toString()), afterHandle: debugHooks?.afterHandle?.map?.((x2) => x2.toString()), mapResponse: debugHooks?.mapResponse?.map?.((x2) => x2.toString()), parse: debugHooks?.parse?.map?.((x2) => x2.toString()), error: debugHooks?.error?.map?.((x2) => x2.toString()), afterResponse: debugHooks?.afterResponse?.map?.((x2) => x2.toString()), stop: debugHooks?.stop?.map?.((x2) => x2.toString()) }, validator, definitions: app.definitions.type, error }), console.log("---"), process.exit(1);
|
|
@@ -105172,7 +105219,8 @@ c.error=notFound
|
|
|
105172
105219
|
`;
|
|
105173
105220
|
let prefix = app.event.afterResponse.some(isAsync) ? "async" : "";
|
|
105174
105221
|
afterResponse += `
|
|
105175
|
-
setImmediate(${prefix}()=>{
|
|
105222
|
+
setImmediate(${prefix}()=>{if(c.responseValue instanceof ElysiaCustomStatusResponse) c.set.status=c.responseValue.code
|
|
105223
|
+
`;
|
|
105176
105224
|
for (let i2 = 0;i2 < app.event.afterResponse.length; i2++) {
|
|
105177
105225
|
let fn2 = app.event.afterResponse[i2].fn;
|
|
105178
105226
|
afterResponse += `
|
|
@@ -105235,7 +105283,7 @@ return new Response(null,{status:_res.status,statusText:_res.statusText,headers:
|
|
|
105235
105283
|
}
|
|
105236
105284
|
let maybeAsync = !!app.event.request?.some(isAsync), adapterVariables = adapter.inject ? Object.keys(adapter.inject).join(",") + "," : "";
|
|
105237
105285
|
if (fnLiteral += `
|
|
105238
|
-
const {app,mapEarlyResponse,NotFoundError,randomId,handleError,status,redirect,getResponseLength,` + allocateIf("parseQueryFromURL,", app.inference.query) + allocateIf("ELYSIA_TRACE,", hasTrace) + allocateIf("ELYSIA_REQUEST_ID,", hasTrace) + adapterVariables + `}=data
|
|
105286
|
+
const {app,mapEarlyResponse,NotFoundError,randomId,handleError,status,redirect,getResponseLength,ElysiaCustomStatusResponse,` + allocateIf("parseQueryFromURL,", app.inference.query) + allocateIf("ELYSIA_TRACE,", hasTrace) + allocateIf("ELYSIA_REQUEST_ID,", hasTrace) + adapterVariables + `}=data
|
|
105239
105287
|
const store=app.singleton.store
|
|
105240
105288
|
const decorator=app.singleton.decorator
|
|
105241
105289
|
const staticRouter=app.router.static.http
|
|
@@ -105268,7 +105316,7 @@ map: switch(p){
|
|
|
105268
105316
|
let handleError = composeErrorHandler(app);
|
|
105269
105317
|
app.handleError = handleError;
|
|
105270
105318
|
let fn = Function("data", `"use strict";
|
|
105271
|
-
` + fnLiteral)({ app, mapEarlyResponse: app["~adapter"].handler.mapEarlyResponse, NotFoundError, randomId, handleError, status, redirect, getResponseLength, parseQueryFromURL: app.inference.query ? parseQueryFromURL : undefined, ELYSIA_TRACE: hasTrace ? ELYSIA_TRACE : undefined, ELYSIA_REQUEST_ID: hasTrace ? ELYSIA_REQUEST_ID : undefined, ...adapter.inject });
|
|
105319
|
+
` + fnLiteral)({ app, mapEarlyResponse: app["~adapter"].handler.mapEarlyResponse, NotFoundError, randomId, handleError, status, redirect, getResponseLength, ElysiaCustomStatusResponse, parseQueryFromURL: app.inference.query ? parseQueryFromURL : undefined, ELYSIA_TRACE: hasTrace ? ELYSIA_TRACE : undefined, ELYSIA_REQUEST_ID: hasTrace ? ELYSIA_REQUEST_ID : undefined, ...adapter.inject });
|
|
105272
105320
|
if (isBun)
|
|
105273
105321
|
Bun.gc(false);
|
|
105274
105322
|
return fn;
|
|
@@ -105696,9 +105744,9 @@ for(const [k,v] of c.request.headers.entries())c.headers[k]=v
|
|
|
105696
105744
|
app.event.start[i2].fn(app);
|
|
105697
105745
|
if (callback)
|
|
105698
105746
|
callback(app.server);
|
|
105699
|
-
process.on("beforeExit", () => {
|
|
105747
|
+
process.on("beforeExit", async () => {
|
|
105700
105748
|
if (app.server) {
|
|
105701
|
-
if (app.server.stop?.(), app.server = null, app.event.stop)
|
|
105749
|
+
if (await app.server.stop?.(), app.server = null, app.event.stop)
|
|
105702
105750
|
for (let i2 = 0;i2 < app.event.stop.length; i2++)
|
|
105703
105751
|
app.event.stop[i2].fn(app);
|
|
105704
105752
|
}
|
|
@@ -105708,7 +105756,7 @@ for(const [k,v] of c.request.headers.entries())c.headers[k]=v
|
|
|
105708
105756
|
};
|
|
105709
105757
|
}, async stop(app, closeActiveConnections) {
|
|
105710
105758
|
if (app.server) {
|
|
105711
|
-
if (app.server.stop(closeActiveConnections), app.server = null, app.event.stop?.length)
|
|
105759
|
+
if (await app.server.stop(closeActiveConnections), app.server = null, app.event.stop?.length)
|
|
105712
105760
|
for (let i2 = 0;i2 < app.event.stop.length; i2++)
|
|
105713
105761
|
app.event.stop[i2].fn(app);
|
|
105714
105762
|
} else
|
|
@@ -105791,7 +105839,6 @@ for(const [k,v] of c.request.headers.entries())c.headers[k]=v
|
|
|
105791
105839
|
return set2.status = 400, "Expected a websocket connection";
|
|
105792
105840
|
}, { ...rest, websocket: options });
|
|
105793
105841
|
} };
|
|
105794
|
-
var env2 = isBun ? Bun.env : typeof process < "u" && process?.env ? process.env : {};
|
|
105795
105842
|
var injectDefaultValues = (typeChecker, obj2) => {
|
|
105796
105843
|
let schema = typeChecker.schema;
|
|
105797
105844
|
if (!schema)
|
|
@@ -106308,7 +106355,7 @@ class Elysia {
|
|
|
106308
106355
|
let encoded = encodePath(path, { dynamic: true });
|
|
106309
106356
|
if (path !== encoded)
|
|
106310
106357
|
this.router.dynamic.add(method, encoded, { validator, hooks, content: localHook?.type, handle, route: path });
|
|
106311
|
-
if (this.config.strictPath
|
|
106358
|
+
if (!this.config.strictPath) {
|
|
106312
106359
|
let loosePath = getLoosePath(path);
|
|
106313
106360
|
this.router.dynamic.add(method, loosePath, { validator, hooks, content: localHook?.type, handle, route: path });
|
|
106314
106361
|
let encoded2 = encodePath(loosePath);
|
|
@@ -106319,7 +106366,7 @@ class Elysia {
|
|
|
106319
106366
|
return;
|
|
106320
106367
|
}
|
|
106321
106368
|
let adapter = this["~adapter"].handler, nativeStaticHandler = typeof handle !== "function" ? () => {
|
|
106322
|
-
let context = { redirect, request: this["~adapter"].isWebStandard ? new Request(`http://
|
|
106369
|
+
let context = { redirect, request: this["~adapter"].isWebStandard ? new Request(`http://ely.sia${path}`, { method }) : undefined, server: null, set: { headers: Object.assign({}, this.setHeaders) }, status, store: this.store };
|
|
106323
106370
|
try {
|
|
106324
106371
|
this.event.request?.map((x2) => {
|
|
106325
106372
|
if (typeof x2.fn === "function")
|
|
@@ -143099,7 +143146,8 @@ var warehouseItemTable = warehouseSchema.table("item", {
|
|
|
143099
143146
|
safetyStock: numeric({ mode: "number" }).notNull(),
|
|
143100
143147
|
shelfNumber: varchar(),
|
|
143101
143148
|
description: text(),
|
|
143102
|
-
isOrdered: boolean4().notNull().default(false)
|
|
143149
|
+
isOrdered: boolean4().notNull().default(false),
|
|
143150
|
+
order: numeric({ mode: "number" }).notNull().default(1)
|
|
143103
143151
|
}, (t2) => [unique().on(t2.warehouseId, t2.productId)]);
|
|
143104
143152
|
var warehouseTransactionTypeEnum = warehouseSchema.enum("transaction_type", ["IN", "OUT"]);
|
|
143105
143153
|
var warehouseTransactionKindEnum = warehouseSchema.enum("transaction_kind", ["TRANSFER", "RETURN", "ADJUSTMENT", "REJECTION", "ORDER", "SALES"]);
|
|
@@ -148620,6 +148668,20 @@ class OrderedObjParser {
|
|
|
148620
148668
|
this.saveTextToParentTag = saveTextToParentTag;
|
|
148621
148669
|
this.addChild = addChild;
|
|
148622
148670
|
this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
|
|
148671
|
+
if (this.options.stopNodes && this.options.stopNodes.length > 0) {
|
|
148672
|
+
this.stopNodesExact = new Set;
|
|
148673
|
+
this.stopNodesWildcard = new Set;
|
|
148674
|
+
for (let i2 = 0;i2 < this.options.stopNodes.length; i2++) {
|
|
148675
|
+
const stopNodeExp = this.options.stopNodes[i2];
|
|
148676
|
+
if (typeof stopNodeExp !== "string")
|
|
148677
|
+
continue;
|
|
148678
|
+
if (stopNodeExp.startsWith("*.")) {
|
|
148679
|
+
this.stopNodesWildcard.add(stopNodeExp.substring(2));
|
|
148680
|
+
} else {
|
|
148681
|
+
this.stopNodesExact.add(stopNodeExp);
|
|
148682
|
+
}
|
|
148683
|
+
}
|
|
148684
|
+
}
|
|
148623
148685
|
}
|
|
148624
148686
|
}
|
|
148625
148687
|
function addExternalEntities(externalEntities) {
|
|
@@ -148823,7 +148885,7 @@ var parseXml = function(xmlData) {
|
|
|
148823
148885
|
jPath += jPath ? "." + tagName : tagName;
|
|
148824
148886
|
}
|
|
148825
148887
|
const startIndex = i2;
|
|
148826
|
-
if (this.isItStopNode(this.
|
|
148888
|
+
if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, jPath, tagName)) {
|
|
148827
148889
|
let tagContent = "";
|
|
148828
148890
|
if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
|
|
148829
148891
|
if (tagName[tagName.length - 1] === "/") {
|
|
@@ -148932,13 +148994,11 @@ function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
|
|
|
148932
148994
|
}
|
|
148933
148995
|
return textData;
|
|
148934
148996
|
}
|
|
148935
|
-
function isItStopNode(
|
|
148936
|
-
|
|
148937
|
-
|
|
148938
|
-
|
|
148939
|
-
|
|
148940
|
-
return true;
|
|
148941
|
-
}
|
|
148997
|
+
function isItStopNode(stopNodesExact, stopNodesWildcard, jPath, currentTagName) {
|
|
148998
|
+
if (stopNodesWildcard && stopNodesWildcard.has(currentTagName))
|
|
148999
|
+
return true;
|
|
149000
|
+
if (stopNodesExact && stopNodesExact.has(jPath))
|
|
149001
|
+
return true;
|
|
148942
149002
|
return false;
|
|
148943
149003
|
}
|
|
148944
149004
|
function tagExpWithClosingIndex(xmlData, i2, closingChar = ">") {
|
|
@@ -149240,6 +149300,21 @@ class NonError extends Error {
|
|
|
149240
149300
|
}
|
|
149241
149301
|
}
|
|
149242
149302
|
|
|
149303
|
+
// node_modules/ky/distribution/errors/ForceRetryError.js
|
|
149304
|
+
class ForceRetryError extends Error {
|
|
149305
|
+
name = "ForceRetryError";
|
|
149306
|
+
customDelay;
|
|
149307
|
+
code;
|
|
149308
|
+
customRequest;
|
|
149309
|
+
constructor(options) {
|
|
149310
|
+
const cause = options?.cause ? options.cause instanceof Error ? options.cause : new NonError(options.cause) : undefined;
|
|
149311
|
+
super(options?.code ? `Forced retry: ${options.code}` : "Forced retry", cause ? { cause } : undefined);
|
|
149312
|
+
this.customDelay = options?.delay;
|
|
149313
|
+
this.code = options?.code;
|
|
149314
|
+
this.customRequest = options?.request;
|
|
149315
|
+
}
|
|
149316
|
+
}
|
|
149317
|
+
|
|
149243
149318
|
// node_modules/ky/distribution/core/constants.js
|
|
149244
149319
|
var supportsRequestStreams = (() => {
|
|
149245
149320
|
let duplexAccessed = false;
|
|
@@ -149285,6 +149360,14 @@ var responseTypes = {
|
|
|
149285
149360
|
var maxSafeTimeout = 2147483647;
|
|
149286
149361
|
var usualFormBoundarySize = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length;
|
|
149287
149362
|
var stop = Symbol("stop");
|
|
149363
|
+
|
|
149364
|
+
class RetryMarker {
|
|
149365
|
+
options;
|
|
149366
|
+
constructor(options) {
|
|
149367
|
+
this.options = options;
|
|
149368
|
+
}
|
|
149369
|
+
}
|
|
149370
|
+
var retry = (options) => new RetryMarker(options);
|
|
149288
149371
|
var kyOptionKeys = {
|
|
149289
149372
|
json: true,
|
|
149290
149373
|
parseJson: true,
|
|
@@ -149563,22 +149646,22 @@ var defaultRetryOptions = {
|
|
|
149563
149646
|
jitter: undefined,
|
|
149564
149647
|
retryOnTimeout: false
|
|
149565
149648
|
};
|
|
149566
|
-
var normalizeRetryOptions = (
|
|
149567
|
-
if (typeof
|
|
149649
|
+
var normalizeRetryOptions = (retry2 = {}) => {
|
|
149650
|
+
if (typeof retry2 === "number") {
|
|
149568
149651
|
return {
|
|
149569
149652
|
...defaultRetryOptions,
|
|
149570
|
-
limit:
|
|
149653
|
+
limit: retry2
|
|
149571
149654
|
};
|
|
149572
149655
|
}
|
|
149573
|
-
if (
|
|
149656
|
+
if (retry2.methods && !Array.isArray(retry2.methods)) {
|
|
149574
149657
|
throw new Error("retry.methods must be an array");
|
|
149575
149658
|
}
|
|
149576
|
-
if (
|
|
149659
|
+
if (retry2.statusCodes && !Array.isArray(retry2.statusCodes)) {
|
|
149577
149660
|
throw new Error("retry.statusCodes must be an array");
|
|
149578
149661
|
}
|
|
149579
149662
|
return {
|
|
149580
149663
|
...defaultRetryOptions,
|
|
149581
|
-
...
|
|
149664
|
+
...retry2
|
|
149582
149665
|
};
|
|
149583
149666
|
};
|
|
149584
149667
|
|
|
@@ -149676,13 +149759,21 @@ class Ky {
|
|
|
149676
149759
|
await Promise.resolve();
|
|
149677
149760
|
let response = await ky.#fetch();
|
|
149678
149761
|
for (const hook of ky.#options.hooks.afterResponse) {
|
|
149679
|
-
const
|
|
149762
|
+
const clonedResponse = ky.#decorateResponse(response.clone());
|
|
149763
|
+
const modifiedResponse = await hook(ky.request, ky.#getNormalizedOptions(), clonedResponse, { retryCount: ky.#retryCount });
|
|
149680
149764
|
if (modifiedResponse instanceof globalThis.Response) {
|
|
149681
149765
|
response = modifiedResponse;
|
|
149682
149766
|
}
|
|
149767
|
+
if (modifiedResponse instanceof RetryMarker) {
|
|
149768
|
+
await Promise.all([
|
|
149769
|
+
clonedResponse.body?.cancel(),
|
|
149770
|
+
response.body?.cancel()
|
|
149771
|
+
]);
|
|
149772
|
+
throw new ForceRetryError(modifiedResponse.options);
|
|
149773
|
+
}
|
|
149683
149774
|
}
|
|
149684
149775
|
ky.#decorateResponse(response);
|
|
149685
|
-
if (!response.ok && ky.#options.throwHttpErrors) {
|
|
149776
|
+
if (!response.ok && (typeof ky.#options.throwHttpErrors === "function" ? ky.#options.throwHttpErrors(response.status) : ky.#options.throwHttpErrors)) {
|
|
149686
149777
|
let error3 = new HTTPError(response, ky.request, ky.#getNormalizedOptions());
|
|
149687
149778
|
for (const hook of ky.#options.hooks.beforeError) {
|
|
149688
149779
|
error3 = await hook(error3, { retryCount: ky.#retryCount });
|
|
@@ -149700,8 +149791,7 @@ class Ky {
|
|
|
149700
149791
|
}
|
|
149701
149792
|
return response;
|
|
149702
149793
|
};
|
|
149703
|
-
const
|
|
149704
|
-
const result = (isRetriableMethod ? ky.#retry(function_) : function_()).finally(async () => {
|
|
149794
|
+
const result = ky.#retry(function_).finally(async () => {
|
|
149705
149795
|
const originalRequest = ky.#originalRequest;
|
|
149706
149796
|
const cleanupPromises = [];
|
|
149707
149797
|
if (originalRequest && !originalRequest.bodyUsed) {
|
|
@@ -149765,7 +149855,7 @@ class Ky {
|
|
|
149765
149855
|
method: normalizeRequestMethod(options.method ?? this.#input.method ?? "GET"),
|
|
149766
149856
|
prefixUrl: String(options.prefixUrl || ""),
|
|
149767
149857
|
retry: normalizeRetryOptions(options.retry),
|
|
149768
|
-
throwHttpErrors: options.throwHttpErrors
|
|
149858
|
+
throwHttpErrors: options.throwHttpErrors ?? true,
|
|
149769
149859
|
timeout: options.timeout ?? 1e4,
|
|
149770
149860
|
fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
|
|
149771
149861
|
context: options.context ?? {}
|
|
@@ -149803,7 +149893,7 @@ class Ky {
|
|
|
149803
149893
|
const textSearchParams = typeof this.#options.searchParams === "string" ? this.#options.searchParams.replace(/^\?/, "") : new URLSearchParams(Ky.#normalizeSearchParams(this.#options.searchParams)).toString();
|
|
149804
149894
|
const searchParams = "?" + textSearchParams;
|
|
149805
149895
|
const url2 = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, searchParams);
|
|
149806
|
-
this.request = new globalThis.Request(
|
|
149896
|
+
this.request = new globalThis.Request(url2, this.#options);
|
|
149807
149897
|
}
|
|
149808
149898
|
if (this.#options.onUploadProgress) {
|
|
149809
149899
|
if (typeof this.#options.onUploadProgress !== "function") {
|
|
@@ -149812,10 +149902,7 @@ class Ky {
|
|
|
149812
149902
|
if (!supportsRequestStreams) {
|
|
149813
149903
|
throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");
|
|
149814
149904
|
}
|
|
149815
|
-
|
|
149816
|
-
if (originalBody) {
|
|
149817
|
-
this.request = streamRequest(this.request, this.#options.onUploadProgress, this.#options.body);
|
|
149818
|
-
}
|
|
149905
|
+
this.request = this.#wrapRequestWithUploadProgress(this.request, this.#options.body ?? undefined);
|
|
149819
149906
|
}
|
|
149820
149907
|
}
|
|
149821
149908
|
#calculateDelay() {
|
|
@@ -149837,6 +149924,12 @@ class Ky {
|
|
|
149837
149924
|
throw error3;
|
|
149838
149925
|
}
|
|
149839
149926
|
const errorObject = error3 instanceof Error ? error3 : new NonError(error3);
|
|
149927
|
+
if (errorObject instanceof ForceRetryError) {
|
|
149928
|
+
return errorObject.customDelay ?? this.#calculateDelay();
|
|
149929
|
+
}
|
|
149930
|
+
if (!this.#options.retry.methods.includes(this.request.method.toLowerCase())) {
|
|
149931
|
+
throw error3;
|
|
149932
|
+
}
|
|
149840
149933
|
if (this.#options.retry.shouldRetry !== undefined) {
|
|
149841
149934
|
const result = await this.#options.retry.shouldRetry({ error: errorObject, retryCount: this.#retryCount });
|
|
149842
149935
|
if (result === false) {
|
|
@@ -149885,6 +149978,10 @@ class Ky {
|
|
|
149885
149978
|
throw error3;
|
|
149886
149979
|
}
|
|
149887
149980
|
await delay(ms2, this.#userProvidedAbortSignal ? { signal: this.#userProvidedAbortSignal } : {});
|
|
149981
|
+
if (error3 instanceof ForceRetryError && error3.customRequest) {
|
|
149982
|
+
const managedRequest = this.#options.signal ? new globalThis.Request(error3.customRequest, { signal: this.#options.signal }) : new globalThis.Request(error3.customRequest);
|
|
149983
|
+
this.#assignRequest(managedRequest);
|
|
149984
|
+
}
|
|
149888
149985
|
for (const hook of this.#options.hooks.beforeRetry) {
|
|
149889
149986
|
const hookResult = await hook({
|
|
149890
149987
|
request: this.request,
|
|
@@ -149893,7 +149990,7 @@ class Ky {
|
|
|
149893
149990
|
retryCount: this.#retryCount
|
|
149894
149991
|
});
|
|
149895
149992
|
if (hookResult instanceof globalThis.Request) {
|
|
149896
|
-
this
|
|
149993
|
+
this.#assignRequest(hookResult);
|
|
149897
149994
|
break;
|
|
149898
149995
|
}
|
|
149899
149996
|
if (hookResult instanceof globalThis.Response) {
|
|
@@ -149914,13 +150011,13 @@ class Ky {
|
|
|
149914
150011
|
}
|
|
149915
150012
|
for (const hook of this.#options.hooks.beforeRequest) {
|
|
149916
150013
|
const result = await hook(this.request, this.#getNormalizedOptions(), { retryCount: this.#retryCount });
|
|
149917
|
-
if (result instanceof Request) {
|
|
149918
|
-
this.request = result;
|
|
149919
|
-
break;
|
|
149920
|
-
}
|
|
149921
150014
|
if (result instanceof Response) {
|
|
149922
150015
|
return result;
|
|
149923
150016
|
}
|
|
150017
|
+
if (result instanceof globalThis.Request) {
|
|
150018
|
+
this.#assignRequest(result);
|
|
150019
|
+
break;
|
|
150020
|
+
}
|
|
149924
150021
|
}
|
|
149925
150022
|
const nonRequestOptions = findUnknownOptions(this.request, this.#options);
|
|
149926
150023
|
this.#originalRequest = this.request;
|
|
@@ -149937,6 +150034,16 @@ class Ky {
|
|
|
149937
150034
|
}
|
|
149938
150035
|
return this.#cachedNormalizedOptions;
|
|
149939
150036
|
}
|
|
150037
|
+
#assignRequest(request) {
|
|
150038
|
+
this.#cachedNormalizedOptions = undefined;
|
|
150039
|
+
this.request = this.#wrapRequestWithUploadProgress(request);
|
|
150040
|
+
}
|
|
150041
|
+
#wrapRequestWithUploadProgress(request, originalBody) {
|
|
150042
|
+
if (!this.#options.onUploadProgress || !request.body) {
|
|
150043
|
+
return request;
|
|
150044
|
+
}
|
|
150045
|
+
return streamRequest(request, this.#options.onUploadProgress, originalBody ?? this.#options.body ?? undefined);
|
|
150046
|
+
}
|
|
149940
150047
|
}
|
|
149941
150048
|
|
|
149942
150049
|
// node_modules/ky/distribution/index.js
|
|
@@ -149954,6 +150061,7 @@ var createInstance = (defaults2) => {
|
|
|
149954
150061
|
return createInstance(validateAndMerge(defaults2, newDefaults));
|
|
149955
150062
|
};
|
|
149956
150063
|
ky.stop = stop;
|
|
150064
|
+
ky.retry = retry;
|
|
149957
150065
|
return ky;
|
|
149958
150066
|
};
|
|
149959
150067
|
var ky = createInstance();
|
|
@@ -150956,13 +151064,13 @@ var CrmCpOrderLogic;
|
|
|
150956
151064
|
paidAmount: sql3`
|
|
150957
151065
|
COALESCE((select sum(${crmCpOrderPaymentTable.amount}) from ${crmCpOrderPaymentTable} where ${crmCpOrderPaymentTable.cpOrderId} = ${crmCpOrderTable.id} and ${crmCpOrderPaymentTable.state} = 'PAID' and ${crmCpOrderPaymentTable.deletedAt} is null), 0)
|
|
150958
151066
|
`.mapWith(Number).as("paid_amount")
|
|
150959
|
-
}).from(crmCpOrderTable).leftJoin(crmVehicleTable, eq(crmVehicleTable.id, crmCpOrderTable.vehicleId)).leftJoin(crmCustomerTable, eq(crmCustomerTable.id, crmCpOrderTable.customerId)).leftJoin(model, eq(model.id, crmVehicleTable.vehicleKindId)).leftJoin(make, eq(make.id, model.parentId)).where(filter).
|
|
151067
|
+
}).from(crmCpOrderTable).leftJoin(crmVehicleTable, eq(crmVehicleTable.id, crmCpOrderTable.vehicleId)).leftJoin(crmCustomerTable, eq(crmCustomerTable.id, crmCpOrderTable.customerId)).leftJoin(model, eq(model.id, crmVehicleTable.vehicleKindId)).leftJoin(make, eq(make.id, model.parentId)).where(filter).having((t2) => query.isPaid === undefined ? undefined : query.isPaid ? sql3`${t2.totalAmount} - ${t2.paidAmount} = 0` : sql3`${t2.totalAmount} - ${t2.paidAmount} != 0`).groupBy((t2) => [
|
|
150960
151068
|
t2.order.id,
|
|
150961
151069
|
t2.vehicle.id,
|
|
150962
151070
|
t2.make.id,
|
|
150963
151071
|
t2.model.id,
|
|
150964
151072
|
t2.customer.id
|
|
150965
|
-
]).$dynamic();
|
|
151073
|
+
]).orderBy(desc(crmCpOrderTable.createdAt), desc(crmCpOrderItemTable.createdAt)).$dynamic();
|
|
150966
151074
|
const result = await pagination_helper_default(baseQuery, query.pagination);
|
|
150967
151075
|
const content = {
|
|
150968
151076
|
totalCount: result[0]?.totalCount ?? 0,
|
|
@@ -151727,7 +151835,7 @@ var payment_default = paymentRoutes;
|
|
|
151727
151835
|
var cpOrderRoutes = new Elysia({
|
|
151728
151836
|
prefix: "/cp-order",
|
|
151729
151837
|
tags: ["CrmCpOrder"]
|
|
151730
|
-
}).use(better_auth_default).use(item_default).use(payment_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default14.select(query, user2)
|
|
151838
|
+
}).use(better_auth_default).use(item_default).use(payment_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default14.select(query, user2), {
|
|
151731
151839
|
query: model_default9.select
|
|
151732
151840
|
}).post("/", async ({ body, user: user2 }) => {
|
|
151733
151841
|
const created = await logic_default14.create(body, user2);
|
|
@@ -152568,7 +152676,7 @@ var CrmReportsLogic;
|
|
|
152568
152676
|
totalPrice: sql3`CASE WHEN ${crmCpOrderTable.isNoat} = FALSE THEN ${crmCpOrderItemTable.priceTotal} ELSE 0 END`.as("total_price"),
|
|
152569
152677
|
totalPriceNoat: sql3`CASE WHEN ${crmCpOrderTable.isNoat} = TRUE THEN ${crmCpOrderItemTable.priceTotal} * 1.1 ELSE 0 END`.as("total_price_noat"),
|
|
152570
152678
|
totalCount: totalCountSql
|
|
152571
|
-
}).from(crmCpOrderItemTable).leftJoin(crmCpOrderTable, eq(crmCpOrderTable.id, crmCpOrderItemTable.cpOrderId)).leftJoin(crmCustomerTable, eq(crmCustomerTable.id, crmCpOrderTable.customerId)).leftJoin(crmVehicleTable, eq(crmVehicleTable.id, crmCpOrderTable.vehicleId)).leftJoin(warehouseProductTable, eq(warehouseProductTable.id, crmCpOrderItemTable.companyProductId)).leftJoin(companyServiceKindTable, eq(companyServiceKindTable.id, crmCpOrderItemTable.companyServiceKindId)).leftJoin(crmCpOrderItemEmployeeTable, eq(crmCpOrderItemEmployeeTable.cpOrderItemId, crmCpOrderItemTable.id)).leftJoin(companyEmployeeTable, eq(companyEmployeeTable.id, crmCpOrderItemEmployeeTable.employeeId)).leftJoin(crmDiscountApplyTable, eq(crmDiscountApplyTable.cpOrderItemId, crmCpOrderItemTable.id)).where(and(eq(crmCpOrderTable.companyId, user2.companyId), eq(crmCpOrderTable.companyBranchId, user2.branchId).if(user2.kind === "CUSTOMER"), isNotNull(crmCpOrderItemTable.companyProductId).if(query.type === "Product"), isNotNull(crmCpOrderItemTable.companyServiceKindId).if(query.type === "Service"), eq(crmCpOrderItemEmployeeTable.employeeId, query.employeeId).if(query.employeeId), gte(crmCpOrderTable.createdAt, query.startDate).if(query.startDate), lte(crmCpOrderTable.createdAt, query.endDate).if(query.endDate), eq(crmCustomerTable.phoneNumber, query.phoneNumber).if(query.phoneNumber), eq(crmVehicleTable.licensePlate, query.licensePlate).if(query.licensePlate))).groupBy((t2) => [
|
|
152679
|
+
}).from(crmCpOrderItemTable).leftJoin(crmCpOrderTable, eq(crmCpOrderTable.id, crmCpOrderItemTable.cpOrderId)).leftJoin(crmCustomerTable, eq(crmCustomerTable.id, crmCpOrderTable.customerId)).leftJoin(crmVehicleTable, eq(crmVehicleTable.id, crmCpOrderTable.vehicleId)).leftJoin(warehouseProductTable, eq(warehouseProductTable.id, crmCpOrderItemTable.companyProductId)).leftJoin(companyServiceKindTable, eq(companyServiceKindTable.id, crmCpOrderItemTable.companyServiceKindId)).leftJoin(crmCpOrderItemEmployeeTable, eq(crmCpOrderItemEmployeeTable.cpOrderItemId, crmCpOrderItemTable.id)).leftJoin(companyEmployeeTable, eq(companyEmployeeTable.id, crmCpOrderItemEmployeeTable.employeeId)).leftJoin(crmDiscountApplyTable, eq(crmDiscountApplyTable.cpOrderItemId, crmCpOrderItemTable.id)).where(and(eq(crmCpOrderTable.companyId, user2.companyId), eq(crmCpOrderTable.companyBranchId, user2.branchId).if(user2.kind === "CUSTOMER"), isNotNull(crmCpOrderItemTable.companyProductId).if(query.type === "Product"), isNotNull(crmCpOrderItemTable.companyServiceKindId).if(query.type === "Service"), eq(crmCpOrderItemEmployeeTable.employeeId, query.employeeId).if(query.employeeId), gte(crmCpOrderTable.createdAt, query.startDate).if(query.startDate), lte(crmCpOrderTable.createdAt, query.endDate).if(query.endDate), eq(crmCustomerTable.phoneNumber, query.phoneNumber).if(query.phoneNumber), eq(crmVehicleTable.licensePlate, query.licensePlate).if(query.licensePlate), eq(crmCpOrderTable.type, query.orderType).if(query.orderType), ilike(warehouseProductTable.partNumber, `%${query.partNumber}%`).if(query.partNumber), ilike(companyServiceKindTable.name, `%${query.serviceKindName}%`).if(query.serviceKindName), ilike(warehouseProductTable.name, `%${query.productName}%`).if(query.productName))).groupBy((t2) => [
|
|
152572
152680
|
t2.createdAt,
|
|
152573
152681
|
t2.orderId,
|
|
152574
152682
|
t2.phone,
|
|
@@ -152677,7 +152785,13 @@ var CrmReportsModel;
|
|
|
152677
152785
|
startDate: t.String({ format: "date" }),
|
|
152678
152786
|
endDate: t.String({ format: "date" }),
|
|
152679
152787
|
phoneNumber: t.String(),
|
|
152680
|
-
licensePlate: t.String()
|
|
152788
|
+
licensePlate: t.String(),
|
|
152789
|
+
orderType: t.UnionEnum(crmCpOrderTable.type.enumValues, {
|
|
152790
|
+
default: undefined
|
|
152791
|
+
}),
|
|
152792
|
+
partNumber: t.String(),
|
|
152793
|
+
productName: t.String(),
|
|
152794
|
+
serviceKindName: t.String()
|
|
152681
152795
|
})),
|
|
152682
152796
|
PaginationSchema
|
|
152683
152797
|
]);
|
|
@@ -154016,6 +154130,55 @@ var fieldGroupRoutes = new Elysia({
|
|
|
154016
154130
|
}).delete("/:id", async ({ params: { id } }) => logic_default26.remove(id)).get("/:id/field", async ({ params: { id } }) => logic_default25.select(id));
|
|
154017
154131
|
var fieldGroup_default = fieldGroupRoutes;
|
|
154018
154132
|
|
|
154133
|
+
// src/routes/fleet/inspection/logic.ts
|
|
154134
|
+
var InspectionLogic;
|
|
154135
|
+
((InspectionLogic) => {
|
|
154136
|
+
InspectionLogic.select = async (query, user2) => {
|
|
154137
|
+
const filter = and(eq(inspectionTable.machineId, query.machineId).if(query.machineId), eq(inspectionTable.templateId, query.templateId).if(query.templateId), eq(inspectionTable.state, query.state).if(query.state), gte(inspectionTable.createdAt, query.startDate).if(query.startDate), lte(inspectionTable.createdAt, query.endDate).if(query.endDate), eq(inspectionTemplateTable.companyId, user2.companyId));
|
|
154138
|
+
const baseQuery = db_default.select({
|
|
154139
|
+
inspection: inspectionTable,
|
|
154140
|
+
totalCount: totalCountSql,
|
|
154141
|
+
template: {
|
|
154142
|
+
name: inspectionTemplateTable.name
|
|
154143
|
+
}
|
|
154144
|
+
}).from(inspectionTable).leftJoin(inspectionTemplateTable, eq(inspectionTemplateTable.id, inspectionTable.templateId)).where(filter).$dynamic();
|
|
154145
|
+
const result = await pagination_helper_default(baseQuery, query.pagination);
|
|
154146
|
+
return getPaginationContent(result, query.pagination.size);
|
|
154147
|
+
};
|
|
154148
|
+
InspectionLogic.create = async (body) => {
|
|
154149
|
+
await db_default.insert(inspectionTable).values(body);
|
|
154150
|
+
};
|
|
154151
|
+
InspectionLogic.update = async (id, body) => {
|
|
154152
|
+
await db_default.update(inspectionTable).set(body).where(eq(inspectionTable.id, id));
|
|
154153
|
+
};
|
|
154154
|
+
InspectionLogic.remove = async (id) => {
|
|
154155
|
+
await db_default.delete(inspectionTable).where(eq(inspectionTable.id, id));
|
|
154156
|
+
};
|
|
154157
|
+
})(InspectionLogic ||= {});
|
|
154158
|
+
var logic_default27 = InspectionLogic;
|
|
154159
|
+
|
|
154160
|
+
// src/routes/fleet/inspection/model.ts
|
|
154161
|
+
var InspectionModel;
|
|
154162
|
+
((InspectionModel) => {
|
|
154163
|
+
const createSchema = createInsertSchema2(inspectionTable);
|
|
154164
|
+
const updateSchema = createUpdateSchema(inspectionTable);
|
|
154165
|
+
InspectionModel.create = OmitBaseSchema(createSchema);
|
|
154166
|
+
InspectionModel.update = OmitBaseSchema(updateSchema);
|
|
154167
|
+
InspectionModel.select = t.Composite([
|
|
154168
|
+
PaginationSchema,
|
|
154169
|
+
t.Partial(t.Object({
|
|
154170
|
+
machineId: t.String({ format: "uuid" }),
|
|
154171
|
+
templateId: t.String({ format: "uuid" }),
|
|
154172
|
+
state: t.UnionEnum(inspectionTable.state.enumValues, {
|
|
154173
|
+
default: undefined
|
|
154174
|
+
}),
|
|
154175
|
+
startDate: t.String({ format: "date" }),
|
|
154176
|
+
endDate: t.String({ format: "date" })
|
|
154177
|
+
}))
|
|
154178
|
+
]);
|
|
154179
|
+
})(InspectionModel ||= {});
|
|
154180
|
+
var model_default27 = InspectionModel;
|
|
154181
|
+
|
|
154019
154182
|
// src/routes/fleet/inspection/schedule/logic.ts
|
|
154020
154183
|
var InspectionScheduleLogic;
|
|
154021
154184
|
((InspectionScheduleLogic) => {
|
|
@@ -154044,7 +154207,7 @@ var InspectionScheduleLogic;
|
|
|
154044
154207
|
}).where(and(eq(inspectionScheduleTable.id, id), eq(inspectionScheduleTable.companyId, user2.companyId)));
|
|
154045
154208
|
};
|
|
154046
154209
|
})(InspectionScheduleLogic ||= {});
|
|
154047
|
-
var
|
|
154210
|
+
var logic_default28 = InspectionScheduleLogic;
|
|
154048
154211
|
|
|
154049
154212
|
// src/routes/fleet/inspection/schedule/model.ts
|
|
154050
154213
|
var InspectionScheduleModel;
|
|
@@ -154055,18 +154218,18 @@ var InspectionScheduleModel;
|
|
|
154055
154218
|
InspectionScheduleModel.update = OmitBaseSchema(updateSchema);
|
|
154056
154219
|
InspectionScheduleModel.select = t.Composite([PaginationSchema]);
|
|
154057
154220
|
})(InspectionScheduleModel ||= {});
|
|
154058
|
-
var
|
|
154221
|
+
var model_default28 = InspectionScheduleModel;
|
|
154059
154222
|
|
|
154060
154223
|
// src/routes/fleet/inspection/schedule/index.ts
|
|
154061
154224
|
var scheduleRoutes = new Elysia({
|
|
154062
154225
|
prefix: "/schedule"
|
|
154063
|
-
}).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) =>
|
|
154064
|
-
query:
|
|
154065
|
-
}).post("/", async ({ body, user: user2 }) =>
|
|
154066
|
-
body:
|
|
154226
|
+
}).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default28.select(query, user2), {
|
|
154227
|
+
query: model_default28.select
|
|
154228
|
+
}).post("/", async ({ body, user: user2 }) => logic_default28.create(body, user2), {
|
|
154229
|
+
body: model_default28.create
|
|
154067
154230
|
}).guard({
|
|
154068
154231
|
params: IdSchema
|
|
154069
|
-
}).put("/:id", async ({ body, params: { id }, user: user2 }) =>
|
|
154232
|
+
}).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default28.update(id, body, user2), { body: model_default28.update }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default28.remove(id, user2));
|
|
154070
154233
|
var schedule_default = scheduleRoutes;
|
|
154071
154234
|
|
|
154072
154235
|
// src/routes/fleet/inspection/template/logic.ts
|
|
@@ -154125,7 +154288,7 @@ var InspectionTemplateLogic;
|
|
|
154125
154288
|
}).where(eq(inspectionTemplateFieldTable.id, id));
|
|
154126
154289
|
};
|
|
154127
154290
|
})(InspectionTemplateLogic ||= {});
|
|
154128
|
-
var
|
|
154291
|
+
var logic_default29 = InspectionTemplateLogic;
|
|
154129
154292
|
|
|
154130
154293
|
// src/routes/fleet/inspection/template/model.ts
|
|
154131
154294
|
var InspectionTemplateModel;
|
|
@@ -154140,7 +154303,7 @@ var InspectionTemplateModel;
|
|
|
154140
154303
|
"templateId"
|
|
154141
154304
|
]);
|
|
154142
154305
|
})(InspectionTemplateModel ||= {});
|
|
154143
|
-
var
|
|
154306
|
+
var model_default29 = InspectionTemplateModel;
|
|
154144
154307
|
|
|
154145
154308
|
// src/routes/fleet/inspection/template/index.ts
|
|
154146
154309
|
var templateRoutes = new Elysia({
|
|
@@ -154148,23 +154311,27 @@ var templateRoutes = new Elysia({
|
|
|
154148
154311
|
tags: ["InspectionTemplate"]
|
|
154149
154312
|
}).use(better_auth_default).guard({
|
|
154150
154313
|
userKind: "COMPANY_ADMIN"
|
|
154151
|
-
}).get("/", async ({ query, user: user2 }) =>
|
|
154152
|
-
query:
|
|
154153
|
-
}).post("/", async ({ body, user: user2 }) =>
|
|
154154
|
-
body:
|
|
154314
|
+
}).get("/", async ({ query, user: user2 }) => logic_default29.select(query, user2), {
|
|
154315
|
+
query: model_default29.select
|
|
154316
|
+
}).post("/", async ({ body, user: user2 }) => logic_default29.create(body, user2), {
|
|
154317
|
+
body: model_default29.create
|
|
154155
154318
|
}).guard({
|
|
154156
154319
|
params: IdSchema
|
|
154157
|
-
}).get("/:id", async ({ params: { id }, user: user2 }) =>
|
|
154158
|
-
body:
|
|
154159
|
-
}).delete("/:id", async ({ params: { id }, user: user2 }) =>
|
|
154160
|
-
body:
|
|
154161
|
-
}).delete("/field/:id", async ({ params: { id } }) =>
|
|
154320
|
+
}).get("/:id", async ({ params: { id }, user: user2 }) => logic_default29.selectById(id, user2)).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default29.update(id, body, user2), {
|
|
154321
|
+
body: model_default29.update
|
|
154322
|
+
}).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default29.remove(id, user2)).get("/:id/field", async ({ params: { id } }) => logic_default29.selectField(id)).post("/:id/field", async ({ body, params: { id } }) => logic_default29.addField(id, body), {
|
|
154323
|
+
body: model_default29.createField
|
|
154324
|
+
}).delete("/field/:id", async ({ params: { id } }) => logic_default29.removeField(id));
|
|
154162
154325
|
var template_default = templateRoutes;
|
|
154163
154326
|
|
|
154164
154327
|
// src/routes/fleet/inspection/index.ts
|
|
154165
154328
|
var inspectionRoutes2 = new Elysia({
|
|
154166
154329
|
prefix: "/inspection"
|
|
154167
|
-
}).use(fieldGroup_default).use(field_default).use(template_default).use(schedule_default)
|
|
154330
|
+
}).use(fieldGroup_default).use(field_default).use(template_default).use(schedule_default).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default27.select(query, user2), {
|
|
154331
|
+
query: model_default27.select
|
|
154332
|
+
}).post("/", async ({ body }) => logic_default27.create(body), {
|
|
154333
|
+
body: model_default27.create
|
|
154334
|
+
});
|
|
154168
154335
|
var inspection_default2 = inspectionRoutes2;
|
|
154169
154336
|
|
|
154170
154337
|
// src/routes/fleet/index.ts
|