@constructive-io/graphql-codegen 3.3.2 → 4.0.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 (67) hide show
  1. package/README.md +0 -4
  2. package/core/ast.js +6 -5
  3. package/core/codegen/custom-mutations.js +22 -22
  4. package/core/codegen/custom-queries.js +24 -17
  5. package/core/codegen/hooks-ast.d.ts +1 -1
  6. package/core/codegen/hooks-ast.js +22 -5
  7. package/core/codegen/index.d.ts +1 -1
  8. package/core/codegen/mutations.js +16 -12
  9. package/core/codegen/orm/custom-ops-generator.js +37 -3
  10. package/core/codegen/orm/input-types-generator.js +161 -89
  11. package/core/codegen/orm/model-generator.js +72 -73
  12. package/core/codegen/orm/select-types.d.ts +27 -17
  13. package/core/codegen/queries.js +37 -25
  14. package/core/codegen/schema-types-generator.js +21 -0
  15. package/core/codegen/templates/hooks-selection.ts +12 -0
  16. package/core/codegen/templates/query-builder.ts +103 -59
  17. package/core/codegen/templates/select-types.ts +59 -33
  18. package/core/codegen/types.js +26 -0
  19. package/core/codegen/utils.d.ts +1 -1
  20. package/core/codegen/utils.js +1 -1
  21. package/core/custom-ast.js +9 -8
  22. package/core/database/index.js +2 -3
  23. package/core/index.d.ts +2 -0
  24. package/core/index.js +2 -0
  25. package/core/introspect/infer-tables.js +144 -58
  26. package/core/introspect/transform-schema.d.ts +1 -1
  27. package/core/introspect/transform-schema.js +3 -1
  28. package/esm/core/ast.js +6 -5
  29. package/esm/core/codegen/custom-mutations.js +23 -23
  30. package/esm/core/codegen/custom-queries.js +25 -18
  31. package/esm/core/codegen/hooks-ast.d.ts +1 -1
  32. package/esm/core/codegen/hooks-ast.js +22 -5
  33. package/esm/core/codegen/index.d.ts +1 -1
  34. package/esm/core/codegen/mutations.js +16 -12
  35. package/esm/core/codegen/orm/custom-ops-generator.js +38 -4
  36. package/esm/core/codegen/orm/input-types-generator.js +163 -91
  37. package/esm/core/codegen/orm/model-generator.js +73 -74
  38. package/esm/core/codegen/orm/select-types.d.ts +27 -17
  39. package/esm/core/codegen/queries.js +37 -25
  40. package/esm/core/codegen/schema-types-generator.js +21 -0
  41. package/esm/core/codegen/types.js +26 -0
  42. package/esm/core/codegen/utils.d.ts +1 -1
  43. package/esm/core/codegen/utils.js +1 -1
  44. package/esm/core/custom-ast.js +9 -8
  45. package/esm/core/database/index.js +2 -3
  46. package/esm/core/index.d.ts +2 -0
  47. package/esm/core/index.js +2 -0
  48. package/esm/core/introspect/infer-tables.js +144 -58
  49. package/esm/core/introspect/transform-schema.d.ts +1 -1
  50. package/esm/core/introspect/transform-schema.js +3 -1
  51. package/esm/generators/field-selector.js +1 -0
  52. package/esm/generators/index.d.ts +3 -0
  53. package/esm/generators/index.js +3 -0
  54. package/esm/generators/mutations.js +4 -4
  55. package/esm/generators/select.js +4 -4
  56. package/esm/index.d.ts +1 -1
  57. package/esm/index.js +1 -1
  58. package/esm/types/schema.d.ts +5 -3
  59. package/generators/field-selector.js +1 -0
  60. package/generators/index.d.ts +3 -0
  61. package/generators/index.js +3 -0
  62. package/generators/mutations.js +3 -3
  63. package/generators/select.js +3 -3
  64. package/index.d.ts +1 -1
  65. package/index.js +1 -1
  66. package/package.json +10 -10
  67. package/types/schema.d.ts +5 -3
package/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * @constructive-io/graphql-codegen
3
3
  *
4
4
  * GraphQL SDK generator for Constructive databases.
5
- * Introspects via _meta query and generates typed queries, mutations,
5
+ * Introspects via standard GraphQL introspection and generates typed queries, mutations,
6
6
  * and React Query v5 hooks.
7
7
  */
8
8
  export * from './types';
package/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * @constructive-io/graphql-codegen
4
4
  *
5
5
  * GraphQL SDK generator for Constructive databases.
6
- * Introspects via _meta query and generates typed queries, mutations,
6
+ * Introspects via standard GraphQL introspection and generates typed queries, mutations,
7
7
  * and React Query v5 hooks.
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/graphql-codegen",
3
- "version": "3.3.2",
3
+ "version": "4.0.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.1.1",
60
- "@constructive-io/graphql-types": "^2.15.0",
59
+ "@constructive-io/graphql-server": "^4.0.0",
60
+ "@constructive-io/graphql-types": "^3.0.0",
61
61
  "@inquirerer/utils": "^3.2.3",
62
- "@pgpmjs/core": "^5.2.1",
62
+ "@pgpmjs/core": "^6.0.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.7.0",
67
- "graphql": "15.10.1",
66
+ "gql-ast": "^3.0.0",
67
+ "graphql": "^16.9.0",
68
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.1.0",
72
+ "pg-cache": "^3.0.0",
73
73
  "pg-env": "^1.4.0",
74
- "pgsql-client": "^2.1.1",
75
- "pgsql-seed": "^1.1.1",
74
+ "pgsql-client": "^3.0.0",
75
+ "pgsql-seed": "^2.0.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": "4f1db1a43296c20413d5636bd937ab3adec79d39"
102
+ "gitHead": "b2daeefe49cdefb3d01ea63cf778fb9b847ab5fe"
103
103
  }
package/types/schema.d.ts CHANGED
@@ -11,7 +11,7 @@ export interface CleanTable {
11
11
  relations: CleanRelations;
12
12
  /** PostGraphile inflection rules for this table */
13
13
  inflection?: TableInflection;
14
- /** Query operation names from _meta */
14
+ /** Query operation names from introspection */
15
15
  query?: TableQueryNames;
16
16
  /** Constraint information */
17
17
  constraints?: TableConstraints;
@@ -66,19 +66,21 @@ export interface TableInflection {
66
66
  updatePayloadType: string | null;
67
67
  }
68
68
  /**
69
- * Query operation names from _meta.query
69
+ * Query operation names from introspection
70
70
  */
71
71
  export interface TableQueryNames {
72
72
  /** All rows query name */
73
73
  all: string;
74
74
  /** Single row query name */
75
- one: string;
75
+ one: string | null;
76
76
  /** Create mutation name */
77
77
  create: string;
78
78
  /** Update mutation name */
79
79
  update: string | null;
80
80
  /** Delete mutation name */
81
81
  delete: string | null;
82
+ /** Patch field name in update mutation input (e.g., "userPatch" for UpdateUserInput) */
83
+ patchFieldName?: string;
82
84
  }
83
85
  /**
84
86
  * Table constraints