Updates
This commit is contained in:
@@ -12,7 +12,7 @@ const encrypt_1 = __importDefault(require("../../dsql/encrypt"));
|
||||
* @description
|
||||
*/
|
||||
function grabParsedValue({ value, tableSchema, encryptionKey, encryptionSalt, dataKey, }) {
|
||||
var _a, _b;
|
||||
var _a, _b, _c;
|
||||
let newValue = value;
|
||||
const targetFieldSchema = tableSchema
|
||||
? (_a = tableSchema === null || tableSchema === void 0 ? void 0 : tableSchema.fields) === null || _a === void 0 ? void 0 : _a.find((field) => field.fieldName === dataKey)
|
||||
@@ -28,7 +28,7 @@ function grabParsedValue({ value, tableSchema, encryptionKey, encryptionSalt, da
|
||||
if (((_b = targetFieldSchema === null || targetFieldSchema === void 0 ? void 0 : targetFieldSchema.dataType) === null || _b === void 0 ? void 0 : _b.match(/int$/i)) &&
|
||||
typeof value == "string" &&
|
||||
!(value === null || value === void 0 ? void 0 : value.match(/./))) {
|
||||
value = "";
|
||||
newValue = "";
|
||||
}
|
||||
if (targetFieldSchema === null || targetFieldSchema === void 0 ? void 0 : targetFieldSchema.encrypted) {
|
||||
newValue = (0, encrypt_1.default)({
|
||||
@@ -51,5 +51,9 @@ function grabParsedValue({ value, tableSchema, encryptionKey, encryptionSalt, da
|
||||
(newValue.match(/^null$/i) || !newValue.match(/./i))) {
|
||||
newValue = null;
|
||||
}
|
||||
if (typeof newValue === "boolean" ||
|
||||
((_c = targetFieldSchema === null || targetFieldSchema === void 0 ? void 0 : targetFieldSchema.dataType) === null || _c === void 0 ? void 0 : _c.match(/boolean/i))) {
|
||||
newValue = newValue ? 1 : 0;
|
||||
}
|
||||
return newValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user