Updates
This commit is contained in:
parent
2336b71703
commit
1086b35b9d
@ -12,7 +12,7 @@ const encrypt_1 = __importDefault(require("../../dsql/encrypt"));
|
|||||||
* @description
|
* @description
|
||||||
*/
|
*/
|
||||||
function grabParsedValue({ value, tableSchema, encryptionKey, encryptionSalt, dataKey, }) {
|
function grabParsedValue({ value, tableSchema, encryptionKey, encryptionSalt, dataKey, }) {
|
||||||
var _a, _b;
|
var _a, _b, _c;
|
||||||
let newValue = value;
|
let newValue = value;
|
||||||
const targetFieldSchema = tableSchema
|
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)
|
? (_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)) &&
|
if (((_b = targetFieldSchema === null || targetFieldSchema === void 0 ? void 0 : targetFieldSchema.dataType) === null || _b === void 0 ? void 0 : _b.match(/int$/i)) &&
|
||||||
typeof value == "string" &&
|
typeof value == "string" &&
|
||||||
!(value === null || value === void 0 ? void 0 : value.match(/./))) {
|
!(value === null || value === void 0 ? void 0 : value.match(/./))) {
|
||||||
value = "";
|
newValue = "";
|
||||||
}
|
}
|
||||||
if (targetFieldSchema === null || targetFieldSchema === void 0 ? void 0 : targetFieldSchema.encrypted) {
|
if (targetFieldSchema === null || targetFieldSchema === void 0 ? void 0 : targetFieldSchema.encrypted) {
|
||||||
newValue = (0, encrypt_1.default)({
|
newValue = (0, encrypt_1.default)({
|
||||||
@ -51,5 +51,9 @@ function grabParsedValue({ value, tableSchema, encryptionKey, encryptionSalt, da
|
|||||||
(newValue.match(/^null$/i) || !newValue.match(/./i))) {
|
(newValue.match(/^null$/i) || !newValue.match(/./i))) {
|
||||||
newValue = null;
|
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;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ export default function grabParsedValue({
|
|||||||
typeof value == "string" &&
|
typeof value == "string" &&
|
||||||
!value?.match(/./)
|
!value?.match(/./)
|
||||||
) {
|
) {
|
||||||
value = "";
|
newValue = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetFieldSchema?.encrypted) {
|
if (targetFieldSchema?.encrypted) {
|
||||||
@ -76,5 +76,12 @@ export default function grabParsedValue({
|
|||||||
newValue = null;
|
newValue = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof newValue === "boolean" ||
|
||||||
|
targetFieldSchema?.dataType?.match(/boolean/i)
|
||||||
|
) {
|
||||||
|
newValue = newValue ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/datasquirel",
|
"name": "@moduletrace/datasquirel",
|
||||||
"version": "5.2.3",
|
"version": "5.2.4",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
Loading…
Reference in New Issue
Block a user