@paralect/hive 0.1.38 → 0.1.39

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paralect/hive",
3
- "version": "0.1.38",
3
+ "version": "0.1.39",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -27,6 +27,16 @@ const zodSchemaToSchemaMappings = () => {
27
27
  return newSchemaMappings;
28
28
  };
29
29
 
30
+ const isZodArray = (schema) => {
31
+ if (schema instanceof ZodArray) return true;
32
+
33
+ if (schema._def?.innerType) {
34
+ return isZodArray(schema._def.innerType);
35
+ }
36
+
37
+ return false;
38
+ };
39
+
30
40
  export default async () => {
31
41
  const prevSchema = await schemaMappingService.findOne({});
32
42
  const prevSchemaMappings = prevSchema?.mappings;
@@ -63,7 +73,7 @@ export default async () => {
63
73
  );
64
74
  await Promise.all(
65
75
  uniqueDependentEntities.map(async (entity) => {
66
- if (schema[fieldName] instanceof ZodArray) {
76
+ if (isZodArray(schema.shape[fieldName])) {
67
77
  await db.services[schemaName].atomic.update(
68
78
  { [`${fieldName}._id`]: entity._id },
69
79
  {