imean-cassandra-orm 2.7.0 → 2.7.2
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/mod.cjs +5 -4
- package/dist/mod.js +5 -4
- package/package.json +1 -1
package/dist/mod.cjs
CHANGED
|
@@ -1030,14 +1030,15 @@ function convertValueFromCassandra(value, config, zodSchema, filedName) {
|
|
|
1030
1030
|
case "blob":
|
|
1031
1031
|
return value instanceof Uint8Array ? value : new Uint8Array(value);
|
|
1032
1032
|
case "text":
|
|
1033
|
-
|
|
1033
|
+
let zodField = zodSchema?.shape[filedName];
|
|
1034
|
+
zodField = zodField?._def?.innerType ?? zodField;
|
|
1035
|
+
const zodTypeName = zodField?._def?.typeName;
|
|
1036
|
+
if (config.type !== "text" || zodTypeName !== "ZodString") {
|
|
1034
1037
|
try {
|
|
1035
1038
|
return JSON.parse(value);
|
|
1036
|
-
} catch {
|
|
1039
|
+
} catch (error) {
|
|
1037
1040
|
return value;
|
|
1038
1041
|
}
|
|
1039
|
-
} else if (typeof value === "string" && zodSchema?.shape[filedName]?._def?.typeName === "ZodAny") {
|
|
1040
|
-
return JSON.parse(value);
|
|
1041
1042
|
}
|
|
1042
1043
|
return value;
|
|
1043
1044
|
default:
|
package/dist/mod.js
CHANGED
|
@@ -1028,14 +1028,15 @@ function convertValueFromCassandra(value, config, zodSchema, filedName) {
|
|
|
1028
1028
|
case "blob":
|
|
1029
1029
|
return value instanceof Uint8Array ? value : new Uint8Array(value);
|
|
1030
1030
|
case "text":
|
|
1031
|
-
|
|
1031
|
+
let zodField = zodSchema?.shape[filedName];
|
|
1032
|
+
zodField = zodField?._def?.innerType ?? zodField;
|
|
1033
|
+
const zodTypeName = zodField?._def?.typeName;
|
|
1034
|
+
if (config.type !== "text" || zodTypeName !== "ZodString") {
|
|
1032
1035
|
try {
|
|
1033
1036
|
return JSON.parse(value);
|
|
1034
|
-
} catch {
|
|
1037
|
+
} catch (error) {
|
|
1035
1038
|
return value;
|
|
1036
1039
|
}
|
|
1037
|
-
} else if (typeof value === "string" && zodSchema?.shape[filedName]?._def?.typeName === "ZodAny") {
|
|
1038
|
-
return JSON.parse(value);
|
|
1039
1040
|
}
|
|
1040
1041
|
return value;
|
|
1041
1042
|
default:
|