@zodic/shared 0.0.219 → 0.0.221

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.
@@ -1130,8 +1130,20 @@ export class ConceptService {
1130
1130
 
1131
1131
  console.log(`🎨 Extracted Names: EN - "${newNameEN}", PT - "${newNamePT}"`);
1132
1132
 
1133
- // ✅ Check for duplicate avoidance
1134
- if (recentDuplicates.has(newNameEN)) {
1133
+ // ✅ Check if the new name is already in use in D1 before updating
1134
+ const existingEntry = await db
1135
+ .select({ id: conceptsData.id })
1136
+ .from(conceptsData)
1137
+ .where(
1138
+ and(
1139
+ eq(conceptsData.language, 'en-us'),
1140
+ eq(conceptsData.name, newNameEN),
1141
+ eq(conceptsData.conceptSlug, conceptSlug)
1142
+ )
1143
+ )
1144
+ .execute();
1145
+
1146
+ if (existingEntry.length > 0 || recentDuplicates.has(newNameEN)) {
1135
1147
  console.warn(`⚠️ Duplicate detected: "${newNameEN}", retrying...`);
1136
1148
  continue;
1137
1149
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.219",
3
+ "version": "0.0.221",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {