Updates
This commit is contained in:
@@ -22,15 +22,26 @@ export default function grabParsedValue({
|
||||
encryptionKey,
|
||||
encryptionSalt,
|
||||
dataKey,
|
||||
}: Param): any {
|
||||
let newValue = value;
|
||||
}: Param): string | number | undefined {
|
||||
let newValue = value as string | number | undefined;
|
||||
|
||||
const targetFieldSchema = tableSchema
|
||||
? tableSchema?.fields?.find((field) => field.fieldName === dataKey)
|
||||
: null;
|
||||
|
||||
if (typeof newValue == "undefined") return;
|
||||
if (typeof newValue == "object" && !newValue) newValue = null;
|
||||
if (typeof newValue == "undefined") {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
typeof newValue !== "string" &&
|
||||
typeof newValue !== "number" &&
|
||||
!newValue
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if (typeof newValue == "object" && !newValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
const htmlRegex = /<[^>]+>/g;
|
||||
|
||||
@@ -47,11 +58,12 @@ export default function grabParsedValue({
|
||||
}
|
||||
|
||||
if (targetFieldSchema?.encrypted) {
|
||||
newValue = encrypt({
|
||||
data: newValue,
|
||||
encryptionKey,
|
||||
encryptionSalt,
|
||||
});
|
||||
newValue =
|
||||
encrypt({
|
||||
data: newValue.toString(),
|
||||
encryptionKey,
|
||||
encryptionSalt,
|
||||
}) || undefined;
|
||||
}
|
||||
|
||||
if (typeof newValue === "object") {
|
||||
@@ -63,7 +75,8 @@ export default function grabParsedValue({
|
||||
targetFieldSchema.pattern,
|
||||
targetFieldSchema.patternFlags || ""
|
||||
);
|
||||
if (!pattern.test(newValue)) {
|
||||
|
||||
if (typeof newValue == "string" && !pattern.test(newValue)) {
|
||||
console.log("DSQL: Pattern not matched =>", newValue);
|
||||
newValue = "";
|
||||
}
|
||||
@@ -73,7 +86,7 @@ export default function grabParsedValue({
|
||||
typeof newValue === "string" &&
|
||||
(newValue.match(/^null$/i) || !newValue.match(/./i))
|
||||
) {
|
||||
newValue = null;
|
||||
newValue = undefined;
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
@@ -16,7 +16,7 @@ type Param<T extends { [key: string]: any } = { [key: string]: any }> = {
|
||||
|
||||
type Return = {
|
||||
string: string;
|
||||
values: string[];
|
||||
values: (string | number)[];
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1673,7 +1673,7 @@ export type PagePropsType = {
|
||||
|
||||
export type ResponseQueryObject = {
|
||||
sql?: string;
|
||||
params?: string[];
|
||||
params?: (string | number)[];
|
||||
};
|
||||
|
||||
export type APIResponseObject<T extends any = any> = {
|
||||
|
||||
Reference in New Issue
Block a user