@constructive-io/graphql-codegen 3.2.0 → 3.3.0

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.
Files changed (216) hide show
  1. package/README.md +25 -30
  2. package/cli/index.js +36 -41
  3. package/cli/shared.d.ts +15 -17
  4. package/cli/shared.js +113 -21
  5. package/client/error.js +31 -9
  6. package/client/execute.js +2 -2
  7. package/client/index.d.ts +3 -3
  8. package/client/index.js +6 -6
  9. package/core/ast.d.ts +1 -1
  10. package/core/ast.js +1 -1
  11. package/core/codegen/babel-ast.d.ts +1 -1
  12. package/core/codegen/babel-ast.js +2 -2
  13. package/core/codegen/barrel.d.ts +0 -6
  14. package/core/codegen/barrel.js +22 -19
  15. package/core/codegen/client.d.ts +2 -12
  16. package/core/codegen/client.js +7 -21
  17. package/core/codegen/custom-mutations.d.ts +0 -14
  18. package/core/codegen/custom-mutations.js +139 -88
  19. package/core/codegen/custom-queries.d.ts +0 -14
  20. package/core/codegen/custom-queries.js +483 -193
  21. package/core/codegen/hooks-ast.d.ts +75 -0
  22. package/core/codegen/hooks-ast.js +522 -0
  23. package/core/codegen/index.d.ts +16 -18
  24. package/core/codegen/index.js +42 -88
  25. package/core/codegen/invalidation.d.ts +1 -7
  26. package/core/codegen/invalidation.js +50 -16
  27. package/core/codegen/mutation-keys.d.ts +1 -10
  28. package/core/codegen/mutation-keys.js +22 -8
  29. package/core/codegen/mutations.d.ts +0 -13
  30. package/core/codegen/mutations.js +301 -366
  31. package/core/codegen/orm/barrel.d.ts +0 -5
  32. package/core/codegen/orm/barrel.js +5 -0
  33. package/core/codegen/orm/client-generator.d.ts +0 -5
  34. package/core/codegen/orm/client-generator.js +7 -2
  35. package/core/codegen/orm/client.js +3 -1
  36. package/core/codegen/orm/custom-ops-generator.d.ts +0 -6
  37. package/core/codegen/orm/custom-ops-generator.js +104 -51
  38. package/core/codegen/orm/index.d.ts +4 -4
  39. package/core/codegen/orm/index.js +28 -15
  40. package/core/codegen/orm/input-types-generator.d.ts +1 -13
  41. package/core/codegen/orm/input-types-generator.js +85 -23
  42. package/core/codegen/orm/model-generator.d.ts +0 -5
  43. package/core/codegen/orm/model-generator.js +309 -131
  44. package/core/codegen/orm/select-types.d.ts +19 -14
  45. package/core/codegen/queries.d.ts +0 -8
  46. package/core/codegen/queries.js +360 -559
  47. package/core/codegen/query-keys.d.ts +1 -1
  48. package/core/codegen/query-keys.js +37 -23
  49. package/core/codegen/scalars.js +3 -1
  50. package/core/codegen/schema-types-generator.d.ts +1 -1
  51. package/core/codegen/schema-types-generator.js +17 -2
  52. package/core/codegen/select-helpers.d.ts +19 -0
  53. package/core/codegen/select-helpers.js +40 -0
  54. package/core/codegen/selection.d.ts +4 -0
  55. package/core/codegen/selection.js +65 -0
  56. package/core/codegen/shared/index.d.ts +2 -15
  57. package/core/codegen/shared/index.js +17 -4
  58. package/core/codegen/templates/hooks-client.ts +49 -0
  59. package/core/codegen/templates/hooks-selection.ts +58 -0
  60. package/core/codegen/templates/orm-client.ts +8 -6
  61. package/core/codegen/templates/query-builder.ts +250 -46
  62. package/core/codegen/templates/select-types.ts +31 -14
  63. package/core/codegen/type-resolver.d.ts +1 -5
  64. package/core/codegen/type-resolver.js +0 -22
  65. package/core/codegen/types.d.ts +0 -3
  66. package/core/codegen/types.js +71 -14
  67. package/core/codegen/utils.d.ts +1 -4
  68. package/core/codegen/utils.js +4 -1
  69. package/core/config/index.d.ts +1 -1
  70. package/core/config/resolver.js +1 -3
  71. package/core/generate.js +38 -50
  72. package/core/index.d.ts +3 -3
  73. package/core/index.js +3 -4
  74. package/core/introspect/index.d.ts +6 -6
  75. package/core/introspect/index.js +5 -8
  76. package/core/introspect/infer-tables.d.ts +0 -14
  77. package/core/introspect/infer-tables.js +15 -1
  78. package/core/introspect/source/database.js +1 -1
  79. package/core/introspect/source/endpoint.d.ts +0 -6
  80. package/core/introspect/source/endpoint.js +7 -1
  81. package/core/introspect/source/index.d.ts +4 -4
  82. package/core/introspect/source/index.js +5 -9
  83. package/core/introspect/source/pgpm-module.js +3 -3
  84. package/core/introspect/transform-schema.d.ts +2 -2
  85. package/core/introspect/transform-schema.js +2 -2
  86. package/core/output/index.d.ts +1 -1
  87. package/core/output/index.js +2 -2
  88. package/core/output/writer.d.ts +3 -0
  89. package/core/output/writer.js +20 -1
  90. package/core/pipeline/index.d.ts +2 -2
  91. package/core/query-builder.d.ts +2 -2
  92. package/core/query-builder.js +1 -1
  93. package/core/watch/index.d.ts +4 -4
  94. package/core/watch/index.js +9 -9
  95. package/core/watch/orchestrator.js +5 -3
  96. package/esm/cli/index.js +37 -42
  97. package/esm/cli/shared.d.ts +15 -17
  98. package/esm/cli/shared.js +103 -20
  99. package/esm/client/error.js +31 -9
  100. package/esm/client/execute.js +2 -2
  101. package/esm/client/index.d.ts +3 -3
  102. package/esm/client/index.js +3 -3
  103. package/esm/core/ast.d.ts +1 -1
  104. package/esm/core/ast.js +1 -1
  105. package/esm/core/codegen/babel-ast.d.ts +1 -1
  106. package/esm/core/codegen/babel-ast.js +2 -2
  107. package/esm/core/codegen/barrel.d.ts +0 -6
  108. package/esm/core/codegen/barrel.js +23 -20
  109. package/esm/core/codegen/client.d.ts +2 -12
  110. package/esm/core/codegen/client.js +7 -21
  111. package/esm/core/codegen/custom-mutations.d.ts +0 -14
  112. package/esm/core/codegen/custom-mutations.js +141 -90
  113. package/esm/core/codegen/custom-queries.d.ts +0 -14
  114. package/esm/core/codegen/custom-queries.js +486 -196
  115. package/esm/core/codegen/hooks-ast.d.ts +75 -0
  116. package/esm/core/codegen/hooks-ast.js +424 -0
  117. package/esm/core/codegen/index.d.ts +16 -18
  118. package/esm/core/codegen/index.js +26 -71
  119. package/esm/core/codegen/invalidation.d.ts +1 -7
  120. package/esm/core/codegen/invalidation.js +51 -17
  121. package/esm/core/codegen/mutation-keys.d.ts +1 -10
  122. package/esm/core/codegen/mutation-keys.js +23 -9
  123. package/esm/core/codegen/mutations.d.ts +0 -13
  124. package/esm/core/codegen/mutations.js +302 -367
  125. package/esm/core/codegen/orm/barrel.d.ts +0 -5
  126. package/esm/core/codegen/orm/barrel.js +6 -1
  127. package/esm/core/codegen/orm/client-generator.d.ts +0 -5
  128. package/esm/core/codegen/orm/client-generator.js +7 -2
  129. package/esm/core/codegen/orm/client.js +3 -1
  130. package/esm/core/codegen/orm/custom-ops-generator.d.ts +0 -6
  131. package/esm/core/codegen/orm/custom-ops-generator.js +103 -50
  132. package/esm/core/codegen/orm/index.d.ts +4 -4
  133. package/esm/core/codegen/orm/index.js +25 -12
  134. package/esm/core/codegen/orm/input-types-generator.d.ts +1 -13
  135. package/esm/core/codegen/orm/input-types-generator.js +85 -23
  136. package/esm/core/codegen/orm/model-generator.d.ts +0 -5
  137. package/esm/core/codegen/orm/model-generator.js +310 -132
  138. package/esm/core/codegen/orm/select-types.d.ts +19 -14
  139. package/esm/core/codegen/queries.d.ts +0 -8
  140. package/esm/core/codegen/queries.js +362 -561
  141. package/esm/core/codegen/query-keys.d.ts +1 -1
  142. package/esm/core/codegen/query-keys.js +38 -24
  143. package/esm/core/codegen/scalars.js +3 -1
  144. package/esm/core/codegen/schema-types-generator.d.ts +1 -1
  145. package/esm/core/codegen/schema-types-generator.js +17 -2
  146. package/esm/core/codegen/select-helpers.d.ts +19 -0
  147. package/esm/core/codegen/select-helpers.js +35 -0
  148. package/esm/core/codegen/selection.d.ts +4 -0
  149. package/esm/core/codegen/selection.js +29 -0
  150. package/esm/core/codegen/shared/index.d.ts +2 -15
  151. package/esm/core/codegen/shared/index.js +16 -3
  152. package/esm/core/codegen/type-resolver.d.ts +1 -5
  153. package/esm/core/codegen/type-resolver.js +1 -22
  154. package/esm/core/codegen/types.d.ts +0 -3
  155. package/esm/core/codegen/types.js +72 -15
  156. package/esm/core/codegen/utils.d.ts +1 -4
  157. package/esm/core/codegen/utils.js +4 -1
  158. package/esm/core/config/index.d.ts +1 -1
  159. package/esm/core/config/resolver.js +2 -4
  160. package/esm/core/generate.js +38 -50
  161. package/esm/core/index.d.ts +3 -3
  162. package/esm/core/index.js +2 -3
  163. package/esm/core/introspect/index.d.ts +6 -6
  164. package/esm/core/introspect/index.js +3 -6
  165. package/esm/core/introspect/infer-tables.d.ts +0 -14
  166. package/esm/core/introspect/infer-tables.js +16 -2
  167. package/esm/core/introspect/source/database.js +2 -2
  168. package/esm/core/introspect/source/endpoint.d.ts +0 -6
  169. package/esm/core/introspect/source/endpoint.js +7 -1
  170. package/esm/core/introspect/source/index.d.ts +4 -4
  171. package/esm/core/introspect/source/index.js +6 -10
  172. package/esm/core/introspect/source/pgpm-module.js +3 -3
  173. package/esm/core/introspect/transform-schema.d.ts +2 -2
  174. package/esm/core/introspect/transform-schema.js +2 -2
  175. package/esm/core/output/index.d.ts +1 -1
  176. package/esm/core/output/index.js +1 -1
  177. package/esm/core/output/writer.d.ts +3 -0
  178. package/esm/core/output/writer.js +20 -1
  179. package/esm/core/pipeline/index.d.ts +2 -2
  180. package/esm/core/pipeline/index.js +2 -2
  181. package/esm/core/query-builder.d.ts +2 -2
  182. package/esm/core/query-builder.js +2 -2
  183. package/esm/core/watch/index.d.ts +4 -4
  184. package/esm/core/watch/index.js +3 -3
  185. package/esm/core/watch/orchestrator.js +5 -3
  186. package/esm/generators/index.d.ts +3 -3
  187. package/esm/generators/index.js +3 -3
  188. package/esm/generators/mutations.d.ts +1 -1
  189. package/esm/generators/select.d.ts +1 -1
  190. package/esm/index.d.ts +3 -3
  191. package/esm/index.js +1 -4
  192. package/esm/types/config.d.ts +0 -10
  193. package/esm/types/config.js +0 -2
  194. package/esm/types/index.d.ts +6 -6
  195. package/esm/types/index.js +1 -1
  196. package/generators/index.d.ts +3 -3
  197. package/generators/index.js +8 -8
  198. package/generators/mutations.d.ts +1 -1
  199. package/generators/select.d.ts +1 -1
  200. package/index.d.ts +3 -3
  201. package/index.js +11 -5
  202. package/package.json +11 -11
  203. package/types/config.d.ts +0 -10
  204. package/types/config.js +0 -2
  205. package/types/index.d.ts +6 -6
  206. package/types/index.js +2 -2
  207. package/core/codegen/gql-ast.d.ts +0 -41
  208. package/core/codegen/gql-ast.js +0 -353
  209. package/core/codegen/schema-gql-ast.d.ts +0 -51
  210. package/core/codegen/schema-gql-ast.js +0 -385
  211. package/core/codegen/templates/client.browser.ts +0 -271
  212. package/core/codegen/templates/client.node.ts +0 -337
  213. package/esm/core/codegen/gql-ast.d.ts +0 -41
  214. package/esm/core/codegen/gql-ast.js +0 -312
  215. package/esm/core/codegen/schema-gql-ast.d.ts +0 -51
  216. package/esm/core/codegen/schema-gql-ast.js +0 -343
@@ -1,8 +1,8 @@
1
1
  import { TypedDocumentString } from '../client/typed-document';
2
2
  import { QueryBuilder } from '../core/query-builder';
3
3
  import type { IntrospectionSchema, MetaObject } from '../core/types';
4
- import type { CleanTable } from '../types/schema';
5
4
  import type { QueryOptions } from '../types/query';
5
+ import type { CleanTable } from '../types/schema';
6
6
  /**
7
7
  * Convert PascalCase table name to camelCase plural for GraphQL queries
8
8
  * Uses the inflection library for proper pluralization
package/esm/index.d.ts CHANGED
@@ -10,10 +10,10 @@ export * from './core';
10
10
  export * from './generators';
11
11
  export * from './client';
12
12
  export { defineConfig } from './types/config';
13
- export { generate } from './core/generate';
14
13
  export type { GenerateOptions, GenerateResult } from './core/generate';
14
+ export { generate } from './core/generate';
15
15
  export { findConfigFile, loadConfigFile } from './core/config';
16
- export { codegenQuestions, splitCommas, printResult } from './cli/shared';
17
16
  export type { CodegenAnswers } from './cli/shared';
18
- export { buildSchemaFromDatabase, buildSchemaSDLFromDatabase, } from './core/database';
17
+ export { buildDbConfig, buildGenerateOptions, camelizeArgv, codegenQuestions, filterDefined, flattenDbFields, hasResolvedCodegenSource, hyphenateKeys, normalizeCodegenListOptions, printResult, seedArgvFromConfig, splitCommas, } from './cli/shared';
19
18
  export type { BuildSchemaFromDatabaseOptions, BuildSchemaFromDatabaseResult, } from './core/database';
19
+ export { buildSchemaFromDatabase, buildSchemaSDLFromDatabase, } from './core/database';
package/esm/index.js CHANGED
@@ -15,11 +15,8 @@ export * from './generators';
15
15
  export * from './client';
16
16
  // Config definition helper
17
17
  export { defineConfig } from './types/config';
18
- // Main generate function (orchestrates the entire pipeline)
19
18
  export { generate } from './core/generate';
20
19
  // Config utilities
21
20
  export { findConfigFile, loadConfigFile } from './core/config';
22
- // CLI shared utilities (for packages/cli to import)
23
- export { codegenQuestions, splitCommas, printResult } from './cli/shared';
24
- // Database schema utilities (re-exported from core for convenience)
21
+ export { buildDbConfig, buildGenerateOptions, camelizeArgv, codegenQuestions, filterDefined, flattenDbFields, hasResolvedCodegenSource, hyphenateKeys, normalizeCodegenListOptions, printResult, seedArgvFromConfig, splitCommas, } from './cli/shared';
25
22
  export { buildSchemaFromDatabase, buildSchemaSDLFromDatabase, } from './core/database';
@@ -205,8 +205,6 @@ export interface GraphQLSDKConfigTarget {
205
205
  * Code generation options
206
206
  */
207
207
  codegen?: {
208
- /** Max depth for nested object field selection (default: 2) */
209
- maxFieldDepth?: number;
210
208
  /** Skip 'query' field on mutation payloads (default: true) */
211
209
  skipQueryField?: boolean;
212
210
  };
@@ -223,14 +221,6 @@ export interface GraphQLSDKConfigTarget {
223
221
  * @default false
224
222
  */
225
223
  reactQuery?: boolean;
226
- /**
227
- * Generate browser-compatible code using native fetch
228
- * When true (default), uses native W3C fetch API (works in browsers and Node.js)
229
- * When false, uses undici fetch with dispatcher support for localhost DNS resolution
230
- * (Node.js only - enables proper *.localhost subdomain resolution on macOS)
231
- * @default true
232
- */
233
- browserCompatible?: boolean;
234
224
  /**
235
225
  * Query key generation configuration
236
226
  * Controls how query keys are structured for cache management
@@ -59,12 +59,10 @@ export const DEFAULT_CONFIG = {
59
59
  schema: 'public',
60
60
  },
61
61
  codegen: {
62
- maxFieldDepth: 2,
63
62
  skipQueryField: true,
64
63
  },
65
64
  orm: false,
66
65
  reactQuery: false,
67
- browserCompatible: true,
68
66
  queryKeys: DEFAULT_QUERY_KEY_CONFIG,
69
67
  watch: DEFAULT_WATCH_CONFIG,
70
68
  };
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Type exports for @constructive-io/graphql-codegen
3
3
  */
4
- export type { CleanTable, CleanField, CleanFieldType, CleanRelations, CleanBelongsToRelation, CleanHasOneRelation, CleanHasManyRelation, CleanManyToManyRelation, TableInflection, TableQueryNames, TableConstraints, ConstraintInfo, ForeignKeyConstraint, } from './schema';
5
- export type { PageInfo, ConnectionResult, QueryOptions, OrderByItem, FilterOperator, FieldFilter, RelationalFilter, Filter, } from './query';
6
- export type { MutationOptions, CreateInput, UpdateInput, DeleteInput, MutationResult, } from './mutation';
7
- export type { SimpleFieldSelection, FieldSelectionPreset, FieldSelection, SelectionOptions, } from './selection';
8
- export type { GraphQLSDKConfig, GraphQLSDKConfigTarget, } from './config';
9
- export { defineConfig, getConfigOptions, mergeConfig, DEFAULT_CONFIG, } from './config';
4
+ export type { CleanBelongsToRelation, CleanField, CleanFieldType, CleanHasManyRelation, CleanHasOneRelation, CleanManyToManyRelation, CleanRelations, CleanTable, ConstraintInfo, ForeignKeyConstraint, TableConstraints, TableInflection, TableQueryNames, } from './schema';
5
+ export type { ConnectionResult, FieldFilter, Filter, FilterOperator, OrderByItem, PageInfo, QueryOptions, RelationalFilter, } from './query';
6
+ export type { CreateInput, DeleteInput, MutationOptions, MutationResult, UpdateInput, } from './mutation';
7
+ export type { FieldSelection, FieldSelectionPreset, SelectionOptions, SimpleFieldSelection, } from './selection';
8
+ export type { GraphQLSDKConfig, GraphQLSDKConfigTarget } from './config';
9
+ export { DEFAULT_CONFIG, defineConfig, getConfigOptions, mergeConfig, } from './config';
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Type exports for @constructive-io/graphql-codegen
3
3
  */
4
- export { defineConfig, getConfigOptions, mergeConfig, DEFAULT_CONFIG, } from './config';
4
+ export { DEFAULT_CONFIG, defineConfig, getConfigOptions, mergeConfig, } from './config';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Query and mutation generator exports
3
3
  */
4
- export { convertToSelectionOptions, isRelationalField, getAvailableRelations, validateFieldSelection, } from './field-selector';
5
- export { buildSelect, buildFindOne, buildCount, toCamelCasePlural, toOrderByTypeName, cleanTableToMetaObject, generateIntrospectionSchema, createASTQueryBuilder, } from './select';
6
- export { buildPostGraphileCreate, buildPostGraphileUpdate, buildPostGraphileDelete, } from './mutations';
4
+ export { convertToSelectionOptions, getAvailableRelations, isRelationalField, validateFieldSelection, } from './field-selector';
5
+ export { buildCount, buildFindOne, buildSelect, cleanTableToMetaObject, createASTQueryBuilder, generateIntrospectionSchema, toCamelCasePlural, toOrderByTypeName, } from './select';
6
+ export { buildPostGraphileCreate, buildPostGraphileDelete, buildPostGraphileUpdate, } from './mutations';
@@ -3,25 +3,25 @@
3
3
  * Query and mutation generator exports
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.buildPostGraphileDelete = exports.buildPostGraphileUpdate = exports.buildPostGraphileCreate = exports.createASTQueryBuilder = exports.generateIntrospectionSchema = exports.cleanTableToMetaObject = exports.toOrderByTypeName = exports.toCamelCasePlural = exports.buildCount = exports.buildFindOne = exports.buildSelect = exports.validateFieldSelection = exports.getAvailableRelations = exports.isRelationalField = exports.convertToSelectionOptions = void 0;
6
+ exports.buildPostGraphileUpdate = exports.buildPostGraphileDelete = exports.buildPostGraphileCreate = exports.toOrderByTypeName = exports.toCamelCasePlural = exports.generateIntrospectionSchema = exports.createASTQueryBuilder = exports.cleanTableToMetaObject = exports.buildSelect = exports.buildFindOne = exports.buildCount = exports.validateFieldSelection = exports.isRelationalField = exports.getAvailableRelations = exports.convertToSelectionOptions = void 0;
7
7
  // Field selector utilities
8
8
  var field_selector_1 = require("./field-selector");
9
9
  Object.defineProperty(exports, "convertToSelectionOptions", { enumerable: true, get: function () { return field_selector_1.convertToSelectionOptions; } });
10
- Object.defineProperty(exports, "isRelationalField", { enumerable: true, get: function () { return field_selector_1.isRelationalField; } });
11
10
  Object.defineProperty(exports, "getAvailableRelations", { enumerable: true, get: function () { return field_selector_1.getAvailableRelations; } });
11
+ Object.defineProperty(exports, "isRelationalField", { enumerable: true, get: function () { return field_selector_1.isRelationalField; } });
12
12
  Object.defineProperty(exports, "validateFieldSelection", { enumerable: true, get: function () { return field_selector_1.validateFieldSelection; } });
13
13
  // Query generators
14
14
  var select_1 = require("./select");
15
- Object.defineProperty(exports, "buildSelect", { enumerable: true, get: function () { return select_1.buildSelect; } });
16
- Object.defineProperty(exports, "buildFindOne", { enumerable: true, get: function () { return select_1.buildFindOne; } });
17
15
  Object.defineProperty(exports, "buildCount", { enumerable: true, get: function () { return select_1.buildCount; } });
18
- Object.defineProperty(exports, "toCamelCasePlural", { enumerable: true, get: function () { return select_1.toCamelCasePlural; } });
19
- Object.defineProperty(exports, "toOrderByTypeName", { enumerable: true, get: function () { return select_1.toOrderByTypeName; } });
16
+ Object.defineProperty(exports, "buildFindOne", { enumerable: true, get: function () { return select_1.buildFindOne; } });
17
+ Object.defineProperty(exports, "buildSelect", { enumerable: true, get: function () { return select_1.buildSelect; } });
20
18
  Object.defineProperty(exports, "cleanTableToMetaObject", { enumerable: true, get: function () { return select_1.cleanTableToMetaObject; } });
21
- Object.defineProperty(exports, "generateIntrospectionSchema", { enumerable: true, get: function () { return select_1.generateIntrospectionSchema; } });
22
19
  Object.defineProperty(exports, "createASTQueryBuilder", { enumerable: true, get: function () { return select_1.createASTQueryBuilder; } });
20
+ Object.defineProperty(exports, "generateIntrospectionSchema", { enumerable: true, get: function () { return select_1.generateIntrospectionSchema; } });
21
+ Object.defineProperty(exports, "toCamelCasePlural", { enumerable: true, get: function () { return select_1.toCamelCasePlural; } });
22
+ Object.defineProperty(exports, "toOrderByTypeName", { enumerable: true, get: function () { return select_1.toOrderByTypeName; } });
23
23
  // Mutation generators
24
24
  var mutations_1 = require("./mutations");
25
25
  Object.defineProperty(exports, "buildPostGraphileCreate", { enumerable: true, get: function () { return mutations_1.buildPostGraphileCreate; } });
26
- Object.defineProperty(exports, "buildPostGraphileUpdate", { enumerable: true, get: function () { return mutations_1.buildPostGraphileUpdate; } });
27
26
  Object.defineProperty(exports, "buildPostGraphileDelete", { enumerable: true, get: function () { return mutations_1.buildPostGraphileDelete; } });
27
+ Object.defineProperty(exports, "buildPostGraphileUpdate", { enumerable: true, get: function () { return mutations_1.buildPostGraphileUpdate; } });
@@ -1,6 +1,6 @@
1
1
  import { TypedDocumentString } from '../client/typed-document';
2
- import type { CleanTable } from '../types/schema';
3
2
  import type { MutationOptions } from '../types/mutation';
3
+ import type { CleanTable } from '../types/schema';
4
4
  /**
5
5
  * Build PostGraphile-style CREATE mutation
6
6
  * PostGraphile expects: mutation { createTableName(input: { tableName: TableNameInput! }) { tableName { ... } } }
@@ -1,8 +1,8 @@
1
1
  import { TypedDocumentString } from '../client/typed-document';
2
2
  import { QueryBuilder } from '../core/query-builder';
3
3
  import type { IntrospectionSchema, MetaObject } from '../core/types';
4
- import type { CleanTable } from '../types/schema';
5
4
  import type { QueryOptions } from '../types/query';
5
+ import type { CleanTable } from '../types/schema';
6
6
  /**
7
7
  * Convert PascalCase table name to camelCase plural for GraphQL queries
8
8
  * Uses the inflection library for proper pluralization
package/index.d.ts CHANGED
@@ -10,10 +10,10 @@ export * from './core';
10
10
  export * from './generators';
11
11
  export * from './client';
12
12
  export { defineConfig } from './types/config';
13
- export { generate } from './core/generate';
14
13
  export type { GenerateOptions, GenerateResult } from './core/generate';
14
+ export { generate } from './core/generate';
15
15
  export { findConfigFile, loadConfigFile } from './core/config';
16
- export { codegenQuestions, splitCommas, printResult } from './cli/shared';
17
16
  export type { CodegenAnswers } from './cli/shared';
18
- export { buildSchemaFromDatabase, buildSchemaSDLFromDatabase, } from './core/database';
17
+ export { buildDbConfig, buildGenerateOptions, camelizeArgv, codegenQuestions, filterDefined, flattenDbFields, hasResolvedCodegenSource, hyphenateKeys, normalizeCodegenListOptions, printResult, seedArgvFromConfig, splitCommas, } from './cli/shared';
19
18
  export type { BuildSchemaFromDatabaseOptions, BuildSchemaFromDatabaseResult, } from './core/database';
19
+ export { buildSchemaFromDatabase, buildSchemaSDLFromDatabase, } from './core/database';
package/index.js CHANGED
@@ -21,7 +21,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
21
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
22
  };
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.buildSchemaSDLFromDatabase = exports.buildSchemaFromDatabase = exports.printResult = exports.splitCommas = exports.codegenQuestions = exports.loadConfigFile = exports.findConfigFile = exports.generate = exports.defineConfig = void 0;
24
+ exports.buildSchemaSDLFromDatabase = exports.buildSchemaFromDatabase = exports.splitCommas = exports.seedArgvFromConfig = exports.printResult = exports.normalizeCodegenListOptions = exports.hyphenateKeys = exports.hasResolvedCodegenSource = exports.flattenDbFields = exports.filterDefined = exports.codegenQuestions = exports.camelizeArgv = exports.buildGenerateOptions = exports.buildDbConfig = exports.loadConfigFile = exports.findConfigFile = exports.generate = exports.defineConfig = void 0;
25
25
  // Core types
26
26
  __exportStar(require("./types"), exports);
27
27
  // Core query building
@@ -33,19 +33,25 @@ __exportStar(require("./client"), exports);
33
33
  // Config definition helper
34
34
  var config_1 = require("./types/config");
35
35
  Object.defineProperty(exports, "defineConfig", { enumerable: true, get: function () { return config_1.defineConfig; } });
36
- // Main generate function (orchestrates the entire pipeline)
37
36
  var generate_1 = require("./core/generate");
38
37
  Object.defineProperty(exports, "generate", { enumerable: true, get: function () { return generate_1.generate; } });
39
38
  // Config utilities
40
39
  var config_2 = require("./core/config");
41
40
  Object.defineProperty(exports, "findConfigFile", { enumerable: true, get: function () { return config_2.findConfigFile; } });
42
41
  Object.defineProperty(exports, "loadConfigFile", { enumerable: true, get: function () { return config_2.loadConfigFile; } });
43
- // CLI shared utilities (for packages/cli to import)
44
42
  var shared_1 = require("./cli/shared");
43
+ Object.defineProperty(exports, "buildDbConfig", { enumerable: true, get: function () { return shared_1.buildDbConfig; } });
44
+ Object.defineProperty(exports, "buildGenerateOptions", { enumerable: true, get: function () { return shared_1.buildGenerateOptions; } });
45
+ Object.defineProperty(exports, "camelizeArgv", { enumerable: true, get: function () { return shared_1.camelizeArgv; } });
45
46
  Object.defineProperty(exports, "codegenQuestions", { enumerable: true, get: function () { return shared_1.codegenQuestions; } });
46
- Object.defineProperty(exports, "splitCommas", { enumerable: true, get: function () { return shared_1.splitCommas; } });
47
+ Object.defineProperty(exports, "filterDefined", { enumerable: true, get: function () { return shared_1.filterDefined; } });
48
+ Object.defineProperty(exports, "flattenDbFields", { enumerable: true, get: function () { return shared_1.flattenDbFields; } });
49
+ Object.defineProperty(exports, "hasResolvedCodegenSource", { enumerable: true, get: function () { return shared_1.hasResolvedCodegenSource; } });
50
+ Object.defineProperty(exports, "hyphenateKeys", { enumerable: true, get: function () { return shared_1.hyphenateKeys; } });
51
+ Object.defineProperty(exports, "normalizeCodegenListOptions", { enumerable: true, get: function () { return shared_1.normalizeCodegenListOptions; } });
47
52
  Object.defineProperty(exports, "printResult", { enumerable: true, get: function () { return shared_1.printResult; } });
48
- // Database schema utilities (re-exported from core for convenience)
53
+ Object.defineProperty(exports, "seedArgvFromConfig", { enumerable: true, get: function () { return shared_1.seedArgvFromConfig; } });
54
+ Object.defineProperty(exports, "splitCommas", { enumerable: true, get: function () { return shared_1.splitCommas; } });
49
55
  var database_1 = require("./core/database");
50
56
  Object.defineProperty(exports, "buildSchemaFromDatabase", { enumerable: true, get: function () { return database_1.buildSchemaFromDatabase; } });
51
57
  Object.defineProperty(exports, "buildSchemaSDLFromDatabase", { enumerable: true, get: function () { return database_1.buildSchemaSDLFromDatabase; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/graphql-codegen",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "GraphQL SDK generator for Constructive databases with React Query hooks",
5
5
  "keywords": [
6
6
  "graphql",
@@ -56,23 +56,23 @@
56
56
  "@0no-co/graphql.web": "^1.1.2",
57
57
  "@babel/generator": "^7.28.6",
58
58
  "@babel/types": "^7.28.6",
59
- "@constructive-io/graphql-server": "^3.0.5",
60
- "@constructive-io/graphql-types": "^2.14.0",
59
+ "@constructive-io/graphql-server": "^3.1.0",
60
+ "@constructive-io/graphql-types": "^2.15.0",
61
61
  "@inquirerer/utils": "^3.2.0",
62
- "@pgpmjs/core": "^5.1.1",
62
+ "@pgpmjs/core": "^5.2.0",
63
63
  "ajv": "^8.17.1",
64
64
  "deepmerge": "^4.3.1",
65
65
  "find-and-require-package-json": "^0.9.0",
66
- "gql-ast": "^2.6.0",
66
+ "gql-ast": "^2.7.0",
67
67
  "graphql": "15.10.1",
68
- "inflekt": "^0.3.0",
68
+ "inflekt": "^0.3.1",
69
69
  "inquirerer": "^4.4.0",
70
70
  "jiti": "^2.6.1",
71
71
  "oxfmt": "^0.26.0",
72
- "pg-cache": "^2.0.0",
73
- "pg-env": "^1.3.0",
74
- "pgsql-client": "^2.0.4",
75
- "pgsql-seed": "^1.0.3",
72
+ "pg-cache": "^2.1.0",
73
+ "pg-env": "^1.4.0",
74
+ "pgsql-client": "^2.1.0",
75
+ "pgsql-seed": "^1.1.0",
76
76
  "undici": "^7.19.0"
77
77
  },
78
78
  "peerDependencies": {
@@ -99,5 +99,5 @@
99
99
  "tsx": "^4.21.0",
100
100
  "typescript": "^5.9.3"
101
101
  },
102
- "gitHead": "6c33cfe4fcc43de961a33603989ffb8adbaecc09"
102
+ "gitHead": "048188f6b43ffaa6146e7694b2b0d35d34cb2945"
103
103
  }
package/types/config.d.ts CHANGED
@@ -205,8 +205,6 @@ export interface GraphQLSDKConfigTarget {
205
205
  * Code generation options
206
206
  */
207
207
  codegen?: {
208
- /** Max depth for nested object field selection (default: 2) */
209
- maxFieldDepth?: number;
210
208
  /** Skip 'query' field on mutation payloads (default: true) */
211
209
  skipQueryField?: boolean;
212
210
  };
@@ -223,14 +221,6 @@ export interface GraphQLSDKConfigTarget {
223
221
  * @default false
224
222
  */
225
223
  reactQuery?: boolean;
226
- /**
227
- * Generate browser-compatible code using native fetch
228
- * When true (default), uses native W3C fetch API (works in browsers and Node.js)
229
- * When false, uses undici fetch with dispatcher support for localhost DNS resolution
230
- * (Node.js only - enables proper *.localhost subdomain resolution on macOS)
231
- * @default true
232
- */
233
- browserCompatible?: boolean;
234
224
  /**
235
225
  * Query key generation configuration
236
226
  * Controls how query keys are structured for cache management
package/types/config.js CHANGED
@@ -68,12 +68,10 @@ exports.DEFAULT_CONFIG = {
68
68
  schema: 'public',
69
69
  },
70
70
  codegen: {
71
- maxFieldDepth: 2,
72
71
  skipQueryField: true,
73
72
  },
74
73
  orm: false,
75
74
  reactQuery: false,
76
- browserCompatible: true,
77
75
  queryKeys: exports.DEFAULT_QUERY_KEY_CONFIG,
78
76
  watch: exports.DEFAULT_WATCH_CONFIG,
79
77
  };
package/types/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Type exports for @constructive-io/graphql-codegen
3
3
  */
4
- export type { CleanTable, CleanField, CleanFieldType, CleanRelations, CleanBelongsToRelation, CleanHasOneRelation, CleanHasManyRelation, CleanManyToManyRelation, TableInflection, TableQueryNames, TableConstraints, ConstraintInfo, ForeignKeyConstraint, } from './schema';
5
- export type { PageInfo, ConnectionResult, QueryOptions, OrderByItem, FilterOperator, FieldFilter, RelationalFilter, Filter, } from './query';
6
- export type { MutationOptions, CreateInput, UpdateInput, DeleteInput, MutationResult, } from './mutation';
7
- export type { SimpleFieldSelection, FieldSelectionPreset, FieldSelection, SelectionOptions, } from './selection';
8
- export type { GraphQLSDKConfig, GraphQLSDKConfigTarget, } from './config';
9
- export { defineConfig, getConfigOptions, mergeConfig, DEFAULT_CONFIG, } from './config';
4
+ export type { CleanBelongsToRelation, CleanField, CleanFieldType, CleanHasManyRelation, CleanHasOneRelation, CleanManyToManyRelation, CleanRelations, CleanTable, ConstraintInfo, ForeignKeyConstraint, TableConstraints, TableInflection, TableQueryNames, } from './schema';
5
+ export type { ConnectionResult, FieldFilter, Filter, FilterOperator, OrderByItem, PageInfo, QueryOptions, RelationalFilter, } from './query';
6
+ export type { CreateInput, DeleteInput, MutationOptions, MutationResult, UpdateInput, } from './mutation';
7
+ export type { FieldSelection, FieldSelectionPreset, SelectionOptions, SimpleFieldSelection, } from './selection';
8
+ export type { GraphQLSDKConfig, GraphQLSDKConfigTarget } from './config';
9
+ export { DEFAULT_CONFIG, defineConfig, getConfigOptions, mergeConfig, } from './config';
package/types/index.js CHANGED
@@ -3,9 +3,9 @@
3
3
  * Type exports for @constructive-io/graphql-codegen
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DEFAULT_CONFIG = exports.mergeConfig = exports.getConfigOptions = exports.defineConfig = void 0;
6
+ exports.mergeConfig = exports.getConfigOptions = exports.defineConfig = exports.DEFAULT_CONFIG = void 0;
7
7
  var config_1 = require("./config");
8
+ Object.defineProperty(exports, "DEFAULT_CONFIG", { enumerable: true, get: function () { return config_1.DEFAULT_CONFIG; } });
8
9
  Object.defineProperty(exports, "defineConfig", { enumerable: true, get: function () { return config_1.defineConfig; } });
9
10
  Object.defineProperty(exports, "getConfigOptions", { enumerable: true, get: function () { return config_1.getConfigOptions; } });
10
11
  Object.defineProperty(exports, "mergeConfig", { enumerable: true, get: function () { return config_1.mergeConfig; } });
11
- Object.defineProperty(exports, "DEFAULT_CONFIG", { enumerable: true, get: function () { return config_1.DEFAULT_CONFIG; } });
@@ -1,41 +0,0 @@
1
- import type { DocumentNode } from 'graphql';
2
- import type { CleanTable } from '../../types/schema';
3
- export interface ListQueryConfig {
4
- table: CleanTable;
5
- }
6
- /**
7
- * Build a list query AST for a table
8
- */
9
- export declare function buildListQueryAST(config: ListQueryConfig): DocumentNode;
10
- export interface SingleQueryConfig {
11
- table: CleanTable;
12
- }
13
- /**
14
- * Build a single item query AST for a table
15
- */
16
- export declare function buildSingleQueryAST(config: SingleQueryConfig): DocumentNode;
17
- export interface CreateMutationConfig {
18
- table: CleanTable;
19
- }
20
- /**
21
- * Build a create mutation AST for a table
22
- */
23
- export declare function buildCreateMutationAST(config: CreateMutationConfig): DocumentNode;
24
- export interface UpdateMutationConfig {
25
- table: CleanTable;
26
- }
27
- /**
28
- * Build an update mutation AST for a table
29
- */
30
- export declare function buildUpdateMutationAST(config: UpdateMutationConfig): DocumentNode;
31
- export interface DeleteMutationConfig {
32
- table: CleanTable;
33
- }
34
- /**
35
- * Build a delete mutation AST for a table
36
- */
37
- export declare function buildDeleteMutationAST(config: DeleteMutationConfig): DocumentNode;
38
- /**
39
- * Print AST to GraphQL string
40
- */
41
- export declare function printGraphQL(ast: DocumentNode): string;