@constructive-io/graphql-query 3.12.8 → 3.12.10

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.
@@ -4,10 +4,10 @@
4
4
  * Re-exports all query/mutation generation functions and naming helpers.
5
5
  */
6
6
  // SELECT, FindOne, Count query generators
7
- export { buildSelect, buildFindOne, buildCount, cleanTableToMetaObject, createASTQueryBuilder, generateIntrospectionSchema, toCamelCasePlural, toOrderByTypeName, } from './select';
7
+ export { buildSelect, buildFindOne, buildCount, cleanTableToMetaObject, createASTQueryBuilder, generateIntrospectionSchema, } from './select';
8
8
  // Mutation generators (CREATE, UPDATE, DELETE)
9
9
  export { buildPostGraphileCreate, buildPostGraphileUpdate, buildPostGraphileDelete, } from './mutations';
10
10
  // Field selection utilities
11
11
  export { convertToSelectionOptions, isRelationalField, getAvailableRelations, validateFieldSelection, } from './field-selector';
12
12
  // Naming helpers (server-aware inflection)
13
- export { normalizeInflectionValue, toCamelCaseSingular, toCreateMutationName, toUpdateMutationName, toDeleteMutationName, toCreateInputTypeName, toUpdateInputTypeName, toDeleteInputTypeName, toFilterTypeName, toPatchFieldName, toOrderByEnumValue, } from './naming-helpers';
13
+ export { normalizeInflectionValue, toCamelCasePlural, toCamelCaseSingular, toCreateMutationName, toUpdateMutationName, toDeleteMutationName, toCreateInputTypeName, toUpdateInputTypeName, toDeleteInputTypeName, toFilterTypeName, toOrderByTypeName, toPatchFieldName, toOrderByEnumValue, } from './naming-helpers';
@@ -10,8 +10,6 @@ import { QueryBuilder } from '../query-builder';
10
10
  import { convertToSelectionOptions, isRelationalField } from './field-selector';
11
11
  import { fuzzyFindByName } from 'inflekt';
12
12
  import { normalizeInflectionValue, toCamelCasePlural, toCamelCaseSingular, toCreateInputTypeName, toCreateMutationName, toDeleteInputTypeName, toDeleteMutationName, toFilterTypeName, toOrderByTypeName, toPatchFieldName, toUpdateInputTypeName, toUpdateMutationName, } from './naming-helpers';
13
- // Re-export naming helpers for backwards compatibility
14
- export { toCamelCasePlural, toOrderByTypeName } from './naming-helpers';
15
13
  /**
16
14
  * Convert Table to MetaObject format for QueryBuilder
17
15
  */
package/esm/index.js CHANGED
@@ -21,7 +21,6 @@ export * from './custom-ast';
21
21
  export * from './types';
22
22
  // Meta object utilities (convert, validate)
23
23
  export * as MetaObject from './meta-object';
24
- // Also export meta-object functions directly for codegen backward compatibility
25
24
  export { convertFromMetaSchema } from './meta-object/convert';
26
25
  export { validateMetaObject } from './meta-object/validate';
27
26
  // Generators (buildSelect, buildFindOne, buildCount, mutations, field-selector, naming-helpers)
@@ -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"
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Re-exports all query/mutation generation functions and naming helpers.
5
5
  */
6
- export { buildSelect, buildFindOne, buildCount, cleanTableToMetaObject, createASTQueryBuilder, generateIntrospectionSchema, toCamelCasePlural, toOrderByTypeName, } from './select';
6
+ export { buildSelect, buildFindOne, buildCount, cleanTableToMetaObject, createASTQueryBuilder, generateIntrospectionSchema, } from './select';
7
7
  export { buildPostGraphileCreate, buildPostGraphileUpdate, buildPostGraphileDelete, } from './mutations';
8
8
  export { convertToSelectionOptions, isRelationalField, getAvailableRelations, validateFieldSelection, } from './field-selector';
9
- export { normalizeInflectionValue, toCamelCaseSingular, toCreateMutationName, toUpdateMutationName, toDeleteMutationName, toCreateInputTypeName, toUpdateInputTypeName, toDeleteInputTypeName, toFilterTypeName, toPatchFieldName, toOrderByEnumValue, } from './naming-helpers';
9
+ export { normalizeInflectionValue, toCamelCasePlural, toCamelCaseSingular, toCreateMutationName, toUpdateMutationName, toDeleteMutationName, toCreateInputTypeName, toUpdateInputTypeName, toDeleteInputTypeName, toFilterTypeName, toOrderByTypeName, toPatchFieldName, toOrderByEnumValue, } from './naming-helpers';
@@ -5,7 +5,7 @@
5
5
  * Re-exports all query/mutation generation functions and naming helpers.
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.toOrderByEnumValue = exports.toPatchFieldName = exports.toFilterTypeName = exports.toDeleteInputTypeName = exports.toUpdateInputTypeName = exports.toCreateInputTypeName = exports.toDeleteMutationName = exports.toUpdateMutationName = exports.toCreateMutationName = exports.toCamelCaseSingular = exports.normalizeInflectionValue = exports.validateFieldSelection = exports.getAvailableRelations = exports.isRelationalField = exports.convertToSelectionOptions = exports.buildPostGraphileDelete = exports.buildPostGraphileUpdate = exports.buildPostGraphileCreate = exports.toOrderByTypeName = exports.toCamelCasePlural = exports.generateIntrospectionSchema = exports.createASTQueryBuilder = exports.cleanTableToMetaObject = exports.buildCount = exports.buildFindOne = exports.buildSelect = void 0;
8
+ exports.toOrderByEnumValue = exports.toPatchFieldName = exports.toOrderByTypeName = exports.toFilterTypeName = exports.toDeleteInputTypeName = exports.toUpdateInputTypeName = exports.toCreateInputTypeName = exports.toDeleteMutationName = exports.toUpdateMutationName = exports.toCreateMutationName = exports.toCamelCaseSingular = exports.toCamelCasePlural = exports.normalizeInflectionValue = exports.validateFieldSelection = exports.getAvailableRelations = exports.isRelationalField = exports.convertToSelectionOptions = exports.buildPostGraphileDelete = exports.buildPostGraphileUpdate = exports.buildPostGraphileCreate = exports.generateIntrospectionSchema = exports.createASTQueryBuilder = exports.cleanTableToMetaObject = exports.buildCount = exports.buildFindOne = exports.buildSelect = void 0;
9
9
  // SELECT, FindOne, Count query generators
10
10
  var select_1 = require("./select");
11
11
  Object.defineProperty(exports, "buildSelect", { enumerable: true, get: function () { return select_1.buildSelect; } });
@@ -14,8 +14,6 @@ Object.defineProperty(exports, "buildCount", { enumerable: true, get: function (
14
14
  Object.defineProperty(exports, "cleanTableToMetaObject", { enumerable: true, get: function () { return select_1.cleanTableToMetaObject; } });
15
15
  Object.defineProperty(exports, "createASTQueryBuilder", { enumerable: true, get: function () { return select_1.createASTQueryBuilder; } });
16
16
  Object.defineProperty(exports, "generateIntrospectionSchema", { enumerable: true, get: function () { return select_1.generateIntrospectionSchema; } });
17
- Object.defineProperty(exports, "toCamelCasePlural", { enumerable: true, get: function () { return select_1.toCamelCasePlural; } });
18
- Object.defineProperty(exports, "toOrderByTypeName", { enumerable: true, get: function () { return select_1.toOrderByTypeName; } });
19
17
  // Mutation generators (CREATE, UPDATE, DELETE)
20
18
  var mutations_1 = require("./mutations");
21
19
  Object.defineProperty(exports, "buildPostGraphileCreate", { enumerable: true, get: function () { return mutations_1.buildPostGraphileCreate; } });
@@ -30,6 +28,7 @@ Object.defineProperty(exports, "validateFieldSelection", { enumerable: true, get
30
28
  // Naming helpers (server-aware inflection)
31
29
  var naming_helpers_1 = require("./naming-helpers");
32
30
  Object.defineProperty(exports, "normalizeInflectionValue", { enumerable: true, get: function () { return naming_helpers_1.normalizeInflectionValue; } });
31
+ Object.defineProperty(exports, "toCamelCasePlural", { enumerable: true, get: function () { return naming_helpers_1.toCamelCasePlural; } });
33
32
  Object.defineProperty(exports, "toCamelCaseSingular", { enumerable: true, get: function () { return naming_helpers_1.toCamelCaseSingular; } });
34
33
  Object.defineProperty(exports, "toCreateMutationName", { enumerable: true, get: function () { return naming_helpers_1.toCreateMutationName; } });
35
34
  Object.defineProperty(exports, "toUpdateMutationName", { enumerable: true, get: function () { return naming_helpers_1.toUpdateMutationName; } });
@@ -38,5 +37,6 @@ Object.defineProperty(exports, "toCreateInputTypeName", { enumerable: true, get:
38
37
  Object.defineProperty(exports, "toUpdateInputTypeName", { enumerable: true, get: function () { return naming_helpers_1.toUpdateInputTypeName; } });
39
38
  Object.defineProperty(exports, "toDeleteInputTypeName", { enumerable: true, get: function () { return naming_helpers_1.toDeleteInputTypeName; } });
40
39
  Object.defineProperty(exports, "toFilterTypeName", { enumerable: true, get: function () { return naming_helpers_1.toFilterTypeName; } });
40
+ Object.defineProperty(exports, "toOrderByTypeName", { enumerable: true, get: function () { return naming_helpers_1.toOrderByTypeName; } });
41
41
  Object.defineProperty(exports, "toPatchFieldName", { enumerable: true, get: function () { return naming_helpers_1.toPatchFieldName; } });
42
42
  Object.defineProperty(exports, "toOrderByEnumValue", { enumerable: true, get: function () { return naming_helpers_1.toOrderByEnumValue; } });
@@ -3,7 +3,6 @@ import { QueryBuilder } from '../query-builder';
3
3
  import type { MetaObject, QueryIntrospectionSchema } from '../types';
4
4
  import type { QueryOptions } from '../types/query';
5
5
  import type { Table } from '../types/schema';
6
- export { toCamelCasePlural, toOrderByTypeName } from './naming-helpers';
7
6
  /**
8
7
  * Convert Table to MetaObject format for QueryBuilder
9
8
  */
@@ -33,7 +33,6 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.toOrderByTypeName = exports.toCamelCasePlural = void 0;
37
36
  exports.cleanTableToMetaObject = cleanTableToMetaObject;
38
37
  exports.generateIntrospectionSchema = generateIntrospectionSchema;
39
38
  exports.createASTQueryBuilder = createASTQueryBuilder;
@@ -52,10 +51,6 @@ const query_builder_1 = require("../query-builder");
52
51
  const field_selector_1 = require("./field-selector");
53
52
  const inflekt_1 = require("inflekt");
54
53
  const naming_helpers_1 = require("./naming-helpers");
55
- // Re-export naming helpers for backwards compatibility
56
- var naming_helpers_2 = require("./naming-helpers");
57
- Object.defineProperty(exports, "toCamelCasePlural", { enumerable: true, get: function () { return naming_helpers_2.toCamelCasePlural; } });
58
- Object.defineProperty(exports, "toOrderByTypeName", { enumerable: true, get: function () { return naming_helpers_2.toOrderByTypeName; } });
59
54
  /**
60
55
  * Convert Table to MetaObject format for QueryBuilder
61
56
  */
package/index.js CHANGED
@@ -63,7 +63,6 @@ __exportStar(require("./custom-ast"), exports);
63
63
  __exportStar(require("./types"), exports);
64
64
  // Meta object utilities (convert, validate)
65
65
  exports.MetaObject = __importStar(require("./meta-object"));
66
- // Also export meta-object functions directly for codegen backward compatibility
67
66
  var convert_1 = require("./meta-object/convert");
68
67
  Object.defineProperty(exports, "convertFromMetaSchema", { enumerable: true, get: function () { return convert_1.convertFromMetaSchema; } });
69
68
  var validate_1 = require("./meta-object/validate");
@@ -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.10",
4
4
  "description": "Constructive GraphQL Query",
5
5
  "author": "Constructive <developers@constructive.io>",
6
6
  "main": "index.js",
@@ -34,7 +34,7 @@
34
34
  "grafast": "1.0.0",
35
35
  "graphile-build-pg": "5.0.0",
36
36
  "graphile-config": "1.0.0",
37
- "graphile-settings": "^4.18.3",
37
+ "graphile-settings": "^4.18.4",
38
38
  "graphql": "16.13.0",
39
39
  "inflection": "^3.0.0",
40
40
  "inflekt": "^0.7.1",
@@ -51,5 +51,5 @@
51
51
  "devDependencies": {
52
52
  "makage": "^0.3.0"
53
53
  },
54
- "gitHead": "d28ce4f65863707e369e579f68c222b1d56c6ea3"
54
+ "gitHead": "d0d8f5ca5828ad3efba5f607bc699a8d520e4603"
55
55
  }