autosync_backend2 1.2.23 → 1.2.24
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 +93 -0
- package/dist/index.js +322 -215
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -3852,6 +3852,99 @@ export declare const app: Elysia<"", {
|
|
|
3852
3852
|
};
|
|
3853
3853
|
headers: unknown;
|
|
3854
3854
|
response: {
|
|
3855
|
+
200: {
|
|
3856
|
+
totalCount: number;
|
|
3857
|
+
totalPage: number;
|
|
3858
|
+
result: {
|
|
3859
|
+
order: {
|
|
3860
|
+
companyId: string;
|
|
3861
|
+
companyBranchId: string;
|
|
3862
|
+
customerId: string | null;
|
|
3863
|
+
vehicleId: string | null;
|
|
3864
|
+
orderId: string;
|
|
3865
|
+
state: "CREATED" | "PROGRESSING" | "COMPLETE";
|
|
3866
|
+
isNoat: boolean | null;
|
|
3867
|
+
timeCompleted: string | null;
|
|
3868
|
+
km: number;
|
|
3869
|
+
type: "Service" | "ProductSell";
|
|
3870
|
+
id: string;
|
|
3871
|
+
createdAt: string;
|
|
3872
|
+
updatedAt: string;
|
|
3873
|
+
deletedAt: string | null;
|
|
3874
|
+
oldId: number | null;
|
|
3875
|
+
};
|
|
3876
|
+
vehicle: {
|
|
3877
|
+
customerId: string | null;
|
|
3878
|
+
vehicleKindId: string;
|
|
3879
|
+
vin: string | null;
|
|
3880
|
+
licensePlate: string | null;
|
|
3881
|
+
color: string | null;
|
|
3882
|
+
engineCc: string | null;
|
|
3883
|
+
cylinder: string | null;
|
|
3884
|
+
gasType: string | null;
|
|
3885
|
+
transmissionType: string | null;
|
|
3886
|
+
vehicleType: string | null;
|
|
3887
|
+
yearManufacture: number | null;
|
|
3888
|
+
yearImport: number | null;
|
|
3889
|
+
steering: string | null;
|
|
3890
|
+
engineCode: string | null;
|
|
3891
|
+
transmissionCode: string | null;
|
|
3892
|
+
driveTrain: string | null;
|
|
3893
|
+
km: number;
|
|
3894
|
+
customData: unknown;
|
|
3895
|
+
companyId: string | null;
|
|
3896
|
+
id: string;
|
|
3897
|
+
createdAt: string;
|
|
3898
|
+
updatedAt: string;
|
|
3899
|
+
deletedAt: string | null;
|
|
3900
|
+
oldId: number | null;
|
|
3901
|
+
} | null;
|
|
3902
|
+
make: {
|
|
3903
|
+
vehicleKindEnum: "MAKE" | "MODEL_GROUP" | "MODEL";
|
|
3904
|
+
parentId: string | null;
|
|
3905
|
+
name: string;
|
|
3906
|
+
description: string | null;
|
|
3907
|
+
yearStart: number | null;
|
|
3908
|
+
yearEnd: number | null;
|
|
3909
|
+
imagePath: string | null;
|
|
3910
|
+
id: string;
|
|
3911
|
+
createdAt: string;
|
|
3912
|
+
updatedAt: string;
|
|
3913
|
+
deletedAt: string | null;
|
|
3914
|
+
oldId: number | null;
|
|
3915
|
+
} | null;
|
|
3916
|
+
model: {
|
|
3917
|
+
vehicleKindEnum: "MAKE" | "MODEL_GROUP" | "MODEL";
|
|
3918
|
+
parentId: string | null;
|
|
3919
|
+
name: string;
|
|
3920
|
+
description: string | null;
|
|
3921
|
+
yearStart: number | null;
|
|
3922
|
+
yearEnd: number | null;
|
|
3923
|
+
imagePath: string | null;
|
|
3924
|
+
id: string;
|
|
3925
|
+
createdAt: string;
|
|
3926
|
+
updatedAt: string;
|
|
3927
|
+
deletedAt: string | null;
|
|
3928
|
+
oldId: number | null;
|
|
3929
|
+
} | null;
|
|
3930
|
+
customer: {
|
|
3931
|
+
companyId: string | null;
|
|
3932
|
+
firstname: string | null;
|
|
3933
|
+
lastname: string | null;
|
|
3934
|
+
phoneNumber: string;
|
|
3935
|
+
email: string | null;
|
|
3936
|
+
regNum: string | null;
|
|
3937
|
+
id: string;
|
|
3938
|
+
createdAt: string;
|
|
3939
|
+
updatedAt: string;
|
|
3940
|
+
deletedAt: string | null;
|
|
3941
|
+
oldId: number | null;
|
|
3942
|
+
} | null;
|
|
3943
|
+
isDeleteAble: unknown;
|
|
3944
|
+
totalAmount: number;
|
|
3945
|
+
paidAmount: number;
|
|
3946
|
+
}[];
|
|
3947
|
+
};
|
|
3855
3948
|
401: "Session not found";
|
|
3856
3949
|
422: {
|
|
3857
3950
|
type: "validation";
|
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")
|
|
@@ -148620,6 +148667,20 @@ class OrderedObjParser {
|
|
|
148620
148667
|
this.saveTextToParentTag = saveTextToParentTag;
|
|
148621
148668
|
this.addChild = addChild;
|
|
148622
148669
|
this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
|
|
148670
|
+
if (this.options.stopNodes && this.options.stopNodes.length > 0) {
|
|
148671
|
+
this.stopNodesExact = new Set;
|
|
148672
|
+
this.stopNodesWildcard = new Set;
|
|
148673
|
+
for (let i2 = 0;i2 < this.options.stopNodes.length; i2++) {
|
|
148674
|
+
const stopNodeExp = this.options.stopNodes[i2];
|
|
148675
|
+
if (typeof stopNodeExp !== "string")
|
|
148676
|
+
continue;
|
|
148677
|
+
if (stopNodeExp.startsWith("*.")) {
|
|
148678
|
+
this.stopNodesWildcard.add(stopNodeExp.substring(2));
|
|
148679
|
+
} else {
|
|
148680
|
+
this.stopNodesExact.add(stopNodeExp);
|
|
148681
|
+
}
|
|
148682
|
+
}
|
|
148683
|
+
}
|
|
148623
148684
|
}
|
|
148624
148685
|
}
|
|
148625
148686
|
function addExternalEntities(externalEntities) {
|
|
@@ -148823,7 +148884,7 @@ var parseXml = function(xmlData) {
|
|
|
148823
148884
|
jPath += jPath ? "." + tagName : tagName;
|
|
148824
148885
|
}
|
|
148825
148886
|
const startIndex = i2;
|
|
148826
|
-
if (this.isItStopNode(this.
|
|
148887
|
+
if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, jPath, tagName)) {
|
|
148827
148888
|
let tagContent = "";
|
|
148828
148889
|
if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
|
|
148829
148890
|
if (tagName[tagName.length - 1] === "/") {
|
|
@@ -148932,13 +148993,11 @@ function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
|
|
|
148932
148993
|
}
|
|
148933
148994
|
return textData;
|
|
148934
148995
|
}
|
|
148935
|
-
function isItStopNode(
|
|
148936
|
-
|
|
148937
|
-
|
|
148938
|
-
|
|
148939
|
-
|
|
148940
|
-
return true;
|
|
148941
|
-
}
|
|
148996
|
+
function isItStopNode(stopNodesExact, stopNodesWildcard, jPath, currentTagName) {
|
|
148997
|
+
if (stopNodesWildcard && stopNodesWildcard.has(currentTagName))
|
|
148998
|
+
return true;
|
|
148999
|
+
if (stopNodesExact && stopNodesExact.has(jPath))
|
|
149000
|
+
return true;
|
|
148942
149001
|
return false;
|
|
148943
149002
|
}
|
|
148944
149003
|
function tagExpWithClosingIndex(xmlData, i2, closingChar = ">") {
|
|
@@ -149240,6 +149299,21 @@ class NonError extends Error {
|
|
|
149240
149299
|
}
|
|
149241
149300
|
}
|
|
149242
149301
|
|
|
149302
|
+
// node_modules/ky/distribution/errors/ForceRetryError.js
|
|
149303
|
+
class ForceRetryError extends Error {
|
|
149304
|
+
name = "ForceRetryError";
|
|
149305
|
+
customDelay;
|
|
149306
|
+
code;
|
|
149307
|
+
customRequest;
|
|
149308
|
+
constructor(options) {
|
|
149309
|
+
const cause = options?.cause ? options.cause instanceof Error ? options.cause : new NonError(options.cause) : undefined;
|
|
149310
|
+
super(options?.code ? `Forced retry: ${options.code}` : "Forced retry", cause ? { cause } : undefined);
|
|
149311
|
+
this.customDelay = options?.delay;
|
|
149312
|
+
this.code = options?.code;
|
|
149313
|
+
this.customRequest = options?.request;
|
|
149314
|
+
}
|
|
149315
|
+
}
|
|
149316
|
+
|
|
149243
149317
|
// node_modules/ky/distribution/core/constants.js
|
|
149244
149318
|
var supportsRequestStreams = (() => {
|
|
149245
149319
|
let duplexAccessed = false;
|
|
@@ -149285,6 +149359,14 @@ var responseTypes = {
|
|
|
149285
149359
|
var maxSafeTimeout = 2147483647;
|
|
149286
149360
|
var usualFormBoundarySize = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length;
|
|
149287
149361
|
var stop = Symbol("stop");
|
|
149362
|
+
|
|
149363
|
+
class RetryMarker {
|
|
149364
|
+
options;
|
|
149365
|
+
constructor(options) {
|
|
149366
|
+
this.options = options;
|
|
149367
|
+
}
|
|
149368
|
+
}
|
|
149369
|
+
var retry = (options) => new RetryMarker(options);
|
|
149288
149370
|
var kyOptionKeys = {
|
|
149289
149371
|
json: true,
|
|
149290
149372
|
parseJson: true,
|
|
@@ -149563,22 +149645,22 @@ var defaultRetryOptions = {
|
|
|
149563
149645
|
jitter: undefined,
|
|
149564
149646
|
retryOnTimeout: false
|
|
149565
149647
|
};
|
|
149566
|
-
var normalizeRetryOptions = (
|
|
149567
|
-
if (typeof
|
|
149648
|
+
var normalizeRetryOptions = (retry2 = {}) => {
|
|
149649
|
+
if (typeof retry2 === "number") {
|
|
149568
149650
|
return {
|
|
149569
149651
|
...defaultRetryOptions,
|
|
149570
|
-
limit:
|
|
149652
|
+
limit: retry2
|
|
149571
149653
|
};
|
|
149572
149654
|
}
|
|
149573
|
-
if (
|
|
149655
|
+
if (retry2.methods && !Array.isArray(retry2.methods)) {
|
|
149574
149656
|
throw new Error("retry.methods must be an array");
|
|
149575
149657
|
}
|
|
149576
|
-
if (
|
|
149658
|
+
if (retry2.statusCodes && !Array.isArray(retry2.statusCodes)) {
|
|
149577
149659
|
throw new Error("retry.statusCodes must be an array");
|
|
149578
149660
|
}
|
|
149579
149661
|
return {
|
|
149580
149662
|
...defaultRetryOptions,
|
|
149581
|
-
...
|
|
149663
|
+
...retry2
|
|
149582
149664
|
};
|
|
149583
149665
|
};
|
|
149584
149666
|
|
|
@@ -149676,13 +149758,21 @@ class Ky {
|
|
|
149676
149758
|
await Promise.resolve();
|
|
149677
149759
|
let response = await ky.#fetch();
|
|
149678
149760
|
for (const hook of ky.#options.hooks.afterResponse) {
|
|
149679
|
-
const
|
|
149761
|
+
const clonedResponse = ky.#decorateResponse(response.clone());
|
|
149762
|
+
const modifiedResponse = await hook(ky.request, ky.#getNormalizedOptions(), clonedResponse, { retryCount: ky.#retryCount });
|
|
149680
149763
|
if (modifiedResponse instanceof globalThis.Response) {
|
|
149681
149764
|
response = modifiedResponse;
|
|
149682
149765
|
}
|
|
149766
|
+
if (modifiedResponse instanceof RetryMarker) {
|
|
149767
|
+
await Promise.all([
|
|
149768
|
+
clonedResponse.body?.cancel(),
|
|
149769
|
+
response.body?.cancel()
|
|
149770
|
+
]);
|
|
149771
|
+
throw new ForceRetryError(modifiedResponse.options);
|
|
149772
|
+
}
|
|
149683
149773
|
}
|
|
149684
149774
|
ky.#decorateResponse(response);
|
|
149685
|
-
if (!response.ok && ky.#options.throwHttpErrors) {
|
|
149775
|
+
if (!response.ok && (typeof ky.#options.throwHttpErrors === "function" ? ky.#options.throwHttpErrors(response.status) : ky.#options.throwHttpErrors)) {
|
|
149686
149776
|
let error3 = new HTTPError(response, ky.request, ky.#getNormalizedOptions());
|
|
149687
149777
|
for (const hook of ky.#options.hooks.beforeError) {
|
|
149688
149778
|
error3 = await hook(error3, { retryCount: ky.#retryCount });
|
|
@@ -149700,8 +149790,7 @@ class Ky {
|
|
|
149700
149790
|
}
|
|
149701
149791
|
return response;
|
|
149702
149792
|
};
|
|
149703
|
-
const
|
|
149704
|
-
const result = (isRetriableMethod ? ky.#retry(function_) : function_()).finally(async () => {
|
|
149793
|
+
const result = ky.#retry(function_).finally(async () => {
|
|
149705
149794
|
const originalRequest = ky.#originalRequest;
|
|
149706
149795
|
const cleanupPromises = [];
|
|
149707
149796
|
if (originalRequest && !originalRequest.bodyUsed) {
|
|
@@ -149765,7 +149854,7 @@ class Ky {
|
|
|
149765
149854
|
method: normalizeRequestMethod(options.method ?? this.#input.method ?? "GET"),
|
|
149766
149855
|
prefixUrl: String(options.prefixUrl || ""),
|
|
149767
149856
|
retry: normalizeRetryOptions(options.retry),
|
|
149768
|
-
throwHttpErrors: options.throwHttpErrors
|
|
149857
|
+
throwHttpErrors: options.throwHttpErrors ?? true,
|
|
149769
149858
|
timeout: options.timeout ?? 1e4,
|
|
149770
149859
|
fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
|
|
149771
149860
|
context: options.context ?? {}
|
|
@@ -149803,7 +149892,7 @@ class Ky {
|
|
|
149803
149892
|
const textSearchParams = typeof this.#options.searchParams === "string" ? this.#options.searchParams.replace(/^\?/, "") : new URLSearchParams(Ky.#normalizeSearchParams(this.#options.searchParams)).toString();
|
|
149804
149893
|
const searchParams = "?" + textSearchParams;
|
|
149805
149894
|
const url2 = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, searchParams);
|
|
149806
|
-
this.request = new globalThis.Request(
|
|
149895
|
+
this.request = new globalThis.Request(url2, this.#options);
|
|
149807
149896
|
}
|
|
149808
149897
|
if (this.#options.onUploadProgress) {
|
|
149809
149898
|
if (typeof this.#options.onUploadProgress !== "function") {
|
|
@@ -149812,10 +149901,7 @@ class Ky {
|
|
|
149812
149901
|
if (!supportsRequestStreams) {
|
|
149813
149902
|
throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");
|
|
149814
149903
|
}
|
|
149815
|
-
|
|
149816
|
-
if (originalBody) {
|
|
149817
|
-
this.request = streamRequest(this.request, this.#options.onUploadProgress, this.#options.body);
|
|
149818
|
-
}
|
|
149904
|
+
this.request = this.#wrapRequestWithUploadProgress(this.request, this.#options.body ?? undefined);
|
|
149819
149905
|
}
|
|
149820
149906
|
}
|
|
149821
149907
|
#calculateDelay() {
|
|
@@ -149837,6 +149923,12 @@ class Ky {
|
|
|
149837
149923
|
throw error3;
|
|
149838
149924
|
}
|
|
149839
149925
|
const errorObject = error3 instanceof Error ? error3 : new NonError(error3);
|
|
149926
|
+
if (errorObject instanceof ForceRetryError) {
|
|
149927
|
+
return errorObject.customDelay ?? this.#calculateDelay();
|
|
149928
|
+
}
|
|
149929
|
+
if (!this.#options.retry.methods.includes(this.request.method.toLowerCase())) {
|
|
149930
|
+
throw error3;
|
|
149931
|
+
}
|
|
149840
149932
|
if (this.#options.retry.shouldRetry !== undefined) {
|
|
149841
149933
|
const result = await this.#options.retry.shouldRetry({ error: errorObject, retryCount: this.#retryCount });
|
|
149842
149934
|
if (result === false) {
|
|
@@ -149885,6 +149977,10 @@ class Ky {
|
|
|
149885
149977
|
throw error3;
|
|
149886
149978
|
}
|
|
149887
149979
|
await delay(ms2, this.#userProvidedAbortSignal ? { signal: this.#userProvidedAbortSignal } : {});
|
|
149980
|
+
if (error3 instanceof ForceRetryError && error3.customRequest) {
|
|
149981
|
+
const managedRequest = this.#options.signal ? new globalThis.Request(error3.customRequest, { signal: this.#options.signal }) : new globalThis.Request(error3.customRequest);
|
|
149982
|
+
this.#assignRequest(managedRequest);
|
|
149983
|
+
}
|
|
149888
149984
|
for (const hook of this.#options.hooks.beforeRetry) {
|
|
149889
149985
|
const hookResult = await hook({
|
|
149890
149986
|
request: this.request,
|
|
@@ -149893,7 +149989,7 @@ class Ky {
|
|
|
149893
149989
|
retryCount: this.#retryCount
|
|
149894
149990
|
});
|
|
149895
149991
|
if (hookResult instanceof globalThis.Request) {
|
|
149896
|
-
this
|
|
149992
|
+
this.#assignRequest(hookResult);
|
|
149897
149993
|
break;
|
|
149898
149994
|
}
|
|
149899
149995
|
if (hookResult instanceof globalThis.Response) {
|
|
@@ -149914,13 +150010,13 @@ class Ky {
|
|
|
149914
150010
|
}
|
|
149915
150011
|
for (const hook of this.#options.hooks.beforeRequest) {
|
|
149916
150012
|
const result = await hook(this.request, this.#getNormalizedOptions(), { retryCount: this.#retryCount });
|
|
149917
|
-
if (result instanceof Request) {
|
|
149918
|
-
this.request = result;
|
|
149919
|
-
break;
|
|
149920
|
-
}
|
|
149921
150013
|
if (result instanceof Response) {
|
|
149922
150014
|
return result;
|
|
149923
150015
|
}
|
|
150016
|
+
if (result instanceof globalThis.Request) {
|
|
150017
|
+
this.#assignRequest(result);
|
|
150018
|
+
break;
|
|
150019
|
+
}
|
|
149924
150020
|
}
|
|
149925
150021
|
const nonRequestOptions = findUnknownOptions(this.request, this.#options);
|
|
149926
150022
|
this.#originalRequest = this.request;
|
|
@@ -149937,6 +150033,16 @@ class Ky {
|
|
|
149937
150033
|
}
|
|
149938
150034
|
return this.#cachedNormalizedOptions;
|
|
149939
150035
|
}
|
|
150036
|
+
#assignRequest(request) {
|
|
150037
|
+
this.#cachedNormalizedOptions = undefined;
|
|
150038
|
+
this.request = this.#wrapRequestWithUploadProgress(request);
|
|
150039
|
+
}
|
|
150040
|
+
#wrapRequestWithUploadProgress(request, originalBody) {
|
|
150041
|
+
if (!this.#options.onUploadProgress || !request.body) {
|
|
150042
|
+
return request;
|
|
150043
|
+
}
|
|
150044
|
+
return streamRequest(request, this.#options.onUploadProgress, originalBody ?? this.#options.body ?? undefined);
|
|
150045
|
+
}
|
|
149940
150046
|
}
|
|
149941
150047
|
|
|
149942
150048
|
// node_modules/ky/distribution/index.js
|
|
@@ -149954,6 +150060,7 @@ var createInstance = (defaults2) => {
|
|
|
149954
150060
|
return createInstance(validateAndMerge(defaults2, newDefaults));
|
|
149955
150061
|
};
|
|
149956
150062
|
ky.stop = stop;
|
|
150063
|
+
ky.retry = retry;
|
|
149957
150064
|
return ky;
|
|
149958
150065
|
};
|
|
149959
150066
|
var ky = createInstance();
|
|
@@ -151727,7 +151834,7 @@ var payment_default = paymentRoutes;
|
|
|
151727
151834
|
var cpOrderRoutes = new Elysia({
|
|
151728
151835
|
prefix: "/cp-order",
|
|
151729
151836
|
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)
|
|
151837
|
+
}).use(better_auth_default).use(item_default).use(payment_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default14.select(query, user2), {
|
|
151731
151838
|
query: model_default9.select
|
|
151732
151839
|
}).post("/", async ({ body, user: user2 }) => {
|
|
151733
151840
|
const created = await logic_default14.create(body, user2);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autosync_backend2",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.24",
|
|
4
4
|
"module": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"better-auth": "1.3.23",
|
|
32
32
|
"drizzle-orm": "^0.44.7",
|
|
33
33
|
"drizzle-typebox": "^0.3.3",
|
|
34
|
-
"elysia": "1.4.
|
|
34
|
+
"elysia": "1.4.15",
|
|
35
35
|
"exceljs": "^4.4.0",
|
|
36
36
|
"fast-xml-parser": "^5.2.5",
|
|
37
37
|
"generate-password": "^1.7.1",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@biomejs/biome": "^2.2.7",
|
|
50
50
|
"@electric-sql/pglite": "^0.3.6",
|
|
51
51
|
"@types/nodemailer": "^6.4.17",
|
|
52
|
-
"@types/pg": "^8.15.
|
|
52
|
+
"@types/pg": "^8.15.6",
|
|
53
53
|
"@types/react": "^19.1.8",
|
|
54
54
|
"@types/react-dom": "^19.1.6",
|
|
55
55
|
"bun-types": "1.3.1",
|