imean-cassandra-orm 2.7.1 → 2.7.3

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 CHANGED
@@ -1030,8 +1030,10 @@ 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
- const zodTypeName = zodSchema?.shape[filedName]?._def?.typeName;
1034
- if (config.type !== "text" || zodTypeName === "ZodAny" || zodTypeName === "ZodObject") {
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") {
1035
1037
  try {
1036
1038
  return JSON.parse(value);
1037
1039
  } catch (error) {
@@ -1600,6 +1602,7 @@ var Types = {
1600
1602
  enum: zod.z.enum,
1601
1603
  object: zod.z.object,
1602
1604
  json: () => createCassandraType(zod.z.any(), "text"),
1605
+ record: (keyType, valueType) => createCassandraType(zod.z.record(keyType, valueType), `text`),
1603
1606
  float: () => createCassandraType(
1604
1607
  zod.z.number().transform((val) => parseFloat(val.toString())),
1605
1608
  "float"
package/dist/mod.d.cts CHANGED
@@ -133,6 +133,7 @@ declare const Types: {
133
133
  };
134
134
  object: <T extends z.ZodRawShape>(shape: T, params?: z.RawCreateParams) => z.ZodObject<T, "strip", z.ZodTypeAny, z.objectOutputType<T, z.ZodTypeAny, "strip">, z.objectInputType<T, z.ZodTypeAny, "strip">>;
135
135
  json: () => z.ZodAny & CassandraTypeMarker;
136
+ record: <Keys extends z.ZodTypeAny, Value extends z.ZodTypeAny>(keyType: Keys, valueType: Value) => z.ZodRecord<Keys, Value> & CassandraTypeMarker;
136
137
  float: () => z.ZodEffects<z.ZodNumber, number, number> & CassandraTypeMarker;
137
138
  int: () => z.ZodNumber & CassandraTypeMarker;
138
139
  bigint: () => z.ZodBigInt & CassandraTypeMarker;
package/dist/mod.d.ts CHANGED
@@ -133,6 +133,7 @@ declare const Types: {
133
133
  };
134
134
  object: <T extends z.ZodRawShape>(shape: T, params?: z.RawCreateParams) => z.ZodObject<T, "strip", z.ZodTypeAny, z.objectOutputType<T, z.ZodTypeAny, "strip">, z.objectInputType<T, z.ZodTypeAny, "strip">>;
135
135
  json: () => z.ZodAny & CassandraTypeMarker;
136
+ record: <Keys extends z.ZodTypeAny, Value extends z.ZodTypeAny>(keyType: Keys, valueType: Value) => z.ZodRecord<Keys, Value> & CassandraTypeMarker;
136
137
  float: () => z.ZodEffects<z.ZodNumber, number, number> & CassandraTypeMarker;
137
138
  int: () => z.ZodNumber & CassandraTypeMarker;
138
139
  bigint: () => z.ZodBigInt & CassandraTypeMarker;
package/dist/mod.js CHANGED
@@ -1028,8 +1028,10 @@ 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
- const zodTypeName = zodSchema?.shape[filedName]?._def?.typeName;
1032
- if (config.type !== "text" || zodTypeName === "ZodAny" || zodTypeName === "ZodObject") {
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") {
1033
1035
  try {
1034
1036
  return JSON.parse(value);
1035
1037
  } catch (error) {
@@ -1598,6 +1600,7 @@ var Types = {
1598
1600
  enum: z.enum,
1599
1601
  object: z.object,
1600
1602
  json: () => createCassandraType(z.any(), "text"),
1603
+ record: (keyType, valueType) => createCassandraType(z.record(keyType, valueType), `text`),
1601
1604
  float: () => createCassandraType(
1602
1605
  z.number().transform((val) => parseFloat(val.toString())),
1603
1606
  "float"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imean-cassandra-orm",
3
- "version": "2.7.1",
3
+ "version": "2.7.3",
4
4
  "description": "cassandra orm",
5
5
  "keywords": [
6
6
  "cassandra",