@constructive-io/graphql-query 3.12.8 → 3.12.9

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.
@@ -369,14 +369,11 @@ function inferHasManyOrManyToMany(field, connectionTypeName, connectionToEntity)
369
369
  // Check for manyToMany pattern in field name
370
370
  const isManyToMany = field.name.includes('By') && field.name.includes('And');
371
371
  if (isManyToMany) {
372
- // For ManyToMany, extract the actual entity name from the field name prefix
373
- // Field name pattern: {relatedEntities}By{JunctionTable}{Keys}
374
- // e.g., "usersByMembershipActorIdAndEntityId" → "users" → "User"
375
- // e.g., "productsByOrderItemOrderIdAndProductId" "products" "Product"
376
- const prefixMatch = field.name.match(/^([a-z]+)By/i);
377
- const actualEntityName = prefixMatch
378
- ? singularize(ucFirst(prefixMatch[1]))
379
- : relatedEntityName;
372
+ // Use the entity name already resolved from the connection type mapping.
373
+ // This is more reliable than re-singularizing from the field name prefix,
374
+ // which can produce incorrect inflections (e.g. "codebases" → "Codebasis"
375
+ // instead of the correct "Codebase").
376
+ const actualEntityName = relatedEntityName;
380
377
  // Try to extract junction table from field name
381
378
  // Pattern: {relatedEntities}By{JunctionTable}{Keys}
382
379
  // e.g., "productsByProductCategoryProductIdAndCategoryId" → "ProductCategory"
@@ -372,14 +372,11 @@ function inferHasManyOrManyToMany(field, connectionTypeName, connectionToEntity)
372
372
  // Check for manyToMany pattern in field name
373
373
  const isManyToMany = field.name.includes('By') && field.name.includes('And');
374
374
  if (isManyToMany) {
375
- // For ManyToMany, extract the actual entity name from the field name prefix
376
- // Field name pattern: {relatedEntities}By{JunctionTable}{Keys}
377
- // e.g., "usersByMembershipActorIdAndEntityId" → "users" → "User"
378
- // e.g., "productsByOrderItemOrderIdAndProductId" "products" "Product"
379
- const prefixMatch = field.name.match(/^([a-z]+)By/i);
380
- const actualEntityName = prefixMatch
381
- ? (0, inflekt_1.singularize)((0, inflekt_1.ucFirst)(prefixMatch[1]))
382
- : relatedEntityName;
375
+ // Use the entity name already resolved from the connection type mapping.
376
+ // This is more reliable than re-singularizing from the field name prefix,
377
+ // which can produce incorrect inflections (e.g. "codebases" → "Codebasis"
378
+ // instead of the correct "Codebase").
379
+ const actualEntityName = relatedEntityName;
383
380
  // Try to extract junction table from field name
384
381
  // Pattern: {relatedEntities}By{JunctionTable}{Keys}
385
382
  // e.g., "productsByProductCategoryProductIdAndCategoryId" → "ProductCategory"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/graphql-query",
3
- "version": "3.12.8",
3
+ "version": "3.12.9",
4
4
  "description": "Constructive GraphQL Query",
5
5
  "author": "Constructive <developers@constructive.io>",
6
6
  "main": "index.js",
@@ -51,5 +51,5 @@
51
51
  "devDependencies": {
52
52
  "makage": "^0.3.0"
53
53
  },
54
- "gitHead": "d28ce4f65863707e369e579f68c222b1d56c6ea3"
54
+ "gitHead": "ac3d503b309d7981fe715116502062afb13500e0"
55
55
  }