@zabaca/lattice 1.0.6 → 1.0.7
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/main.js +6 -10
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -210,7 +210,7 @@ var RelationTypeSchema = z.enum(["REFERENCES"]);
|
|
|
210
210
|
var EntitySchema = z.object({
|
|
211
211
|
name: z.string().min(1),
|
|
212
212
|
type: EntityTypeSchema,
|
|
213
|
-
description: z.string().
|
|
213
|
+
description: z.string().min(1)
|
|
214
214
|
});
|
|
215
215
|
var RelationshipSchema = z.object({
|
|
216
216
|
source: z.string().min(1),
|
|
@@ -375,7 +375,11 @@ class DocumentParserService {
|
|
|
375
375
|
validEntities.push(result.data);
|
|
376
376
|
} else {
|
|
377
377
|
const entityPreview = typeof e === "string" ? `"${e}"` : JSON.stringify(e);
|
|
378
|
-
|
|
378
|
+
const zodErrors = result.error.issues.map((issue) => {
|
|
379
|
+
const path2 = issue.path.length > 0 ? issue.path.join(".") : "root";
|
|
380
|
+
return `${path2}: ${issue.message}`;
|
|
381
|
+
}).join("; ");
|
|
382
|
+
errors.push(`Entity[${i}]: ${entityPreview} - ${zodErrors}`);
|
|
379
383
|
}
|
|
380
384
|
}
|
|
381
385
|
if (errors.length > 0) {
|
|
@@ -1617,14 +1621,6 @@ function validateDocuments(docs) {
|
|
|
1617
1621
|
error: "Missing required field: status"
|
|
1618
1622
|
});
|
|
1619
1623
|
}
|
|
1620
|
-
for (const entity of doc.entities) {
|
|
1621
|
-
if (!entity.description || entity.description.trim() === "") {
|
|
1622
|
-
errors.push({
|
|
1623
|
-
path: doc.path,
|
|
1624
|
-
error: `Entity "${entity.name}" (${entity.type}) missing required field: description`
|
|
1625
|
-
});
|
|
1626
|
-
}
|
|
1627
|
-
}
|
|
1628
1624
|
}
|
|
1629
1625
|
const entityIndex = new Map;
|
|
1630
1626
|
for (const doc of docs) {
|