@constructive-io/graphql-codegen 4.42.5 → 4.43.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.
@@ -156,9 +156,10 @@ function generateCreateClientFile(tables, hasCustomQueries, hasCustomMutations)
156
156
  ], t.stringLiteral('./client'));
157
157
  typeExportDecl.exportKind = 'type';
158
158
  statements.push(typeExportDecl);
159
- // export { GraphQLRequestError } from './client';
159
+ // export { GraphQLRequestError, FetchAdapter } from './client';
160
160
  statements.push(t.exportNamedDeclaration(null, [
161
161
  t.exportSpecifier(t.identifier('GraphQLRequestError'), t.identifier('GraphQLRequestError')),
162
+ t.exportSpecifier(t.identifier('FetchAdapter'), t.identifier('FetchAdapter')),
162
163
  ], t.stringLiteral('./client')));
163
164
  // export { QueryBuilder } from './query-builder';
164
165
  statements.push(t.exportNamedDeclaration(null, [
@@ -53,7 +53,7 @@ function generateOrm(options) {
53
53
  ...(customOperations?.queries ?? []),
54
54
  ...(customOperations?.mutations ?? []),
55
55
  ];
56
- const usedInputTypes = (0, input_types_generator_1.collectInputTypeNames)(allOps);
56
+ const usedInputTypes = (0, input_types_generator_1.collectInputTypeNames)(allOps, tables);
57
57
  const usedPayloadTypes = (0, input_types_generator_1.collectPayloadTypeNames)(allOps);
58
58
  // Also include payload types for table CRUD mutations (they reference Edge types)
59
59
  if (typeRegistry) {
@@ -4,11 +4,15 @@ export interface GeneratedInputTypesFile {
4
4
  content: string;
5
5
  }
6
6
  /**
7
- * Collect all input type names used by operations
7
+ * Collect all input type names used by operations and table field arguments.
8
+ *
9
+ * Scans both custom operation args and computed-field args (e.g.
10
+ * `requestBulkUploadUrls(files: [FooBulkUploadFileInput!]!)` on bucket
11
+ * tables) so that referenced Input types are registered for generation.
8
12
  */
9
13
  export declare function collectInputTypeNames(operations: Array<{
10
14
  args: Argument[];
11
- }>): Set<string>;
15
+ }>, tables?: Table[]): Set<string>;
12
16
  /**
13
17
  * Collect all payload type names from operation return types
14
18
  */
@@ -1038,16 +1038,17 @@ function generateAllCrudInputTypes(tables, typeRegistry) {
1038
1038
  // Custom Input Types Generator (AST-based)
1039
1039
  // ============================================================================
1040
1040
  /**
1041
- * Collect all input type names used by operations
1041
+ * Collect all input type names used by operations and table field arguments.
1042
+ *
1043
+ * Scans both custom operation args and computed-field args (e.g.
1044
+ * `requestBulkUploadUrls(files: [FooBulkUploadFileInput!]!)` on bucket
1045
+ * tables) so that referenced Input types are registered for generation.
1042
1046
  */
1043
- function collectInputTypeNames(operations) {
1047
+ function collectInputTypeNames(operations, tables) {
1044
1048
  const inputTypes = new Set();
1045
1049
  function collectFromTypeRef(typeRef) {
1046
1050
  const baseName = (0, type_resolver_1.getTypeBaseName)(typeRef);
1047
- if (baseName && baseName.endsWith('Input')) {
1048
- inputTypes.add(baseName);
1049
- }
1050
- if (baseName && baseName.endsWith('Filter')) {
1051
+ if (baseName && (baseName.endsWith('Input') || baseName.endsWith('Filter'))) {
1051
1052
  inputTypes.add(baseName);
1052
1053
  }
1053
1054
  }
@@ -1056,6 +1057,17 @@ function collectInputTypeNames(operations) {
1056
1057
  collectFromTypeRef(arg.type);
1057
1058
  }
1058
1059
  }
1060
+ if (tables) {
1061
+ for (const table of tables) {
1062
+ for (const field of table.fields) {
1063
+ if (!field.args)
1064
+ continue;
1065
+ for (const arg of field.args) {
1066
+ collectFromTypeRef(arg.type);
1067
+ }
1068
+ }
1069
+ }
1070
+ }
1059
1071
  return inputTypes;
1060
1072
  }
1061
1073
  /**
@@ -1388,12 +1400,17 @@ function generateInputTypesFile(typeRegistry, usedInputTypes, tables, usedPayloa
1388
1400
  statements.push(...generateConnectionFieldsMap(tablesList, tableByName));
1389
1401
  // 7. Custom input types from TypeRegistry
1390
1402
  // Also include any extra types referenced by plugin-injected filter fields
1403
+ // and by table field arguments (e.g. bucket computed-field args)
1391
1404
  const mergedUsedInputTypes = new Set(usedInputTypes);
1392
1405
  if (hasTables) {
1393
1406
  const filterExtraTypes = collectFilterExtraInputTypes(tablesList, typeRegistry);
1394
1407
  for (const typeName of filterExtraTypes) {
1395
1408
  mergedUsedInputTypes.add(typeName);
1396
1409
  }
1410
+ const fieldArgTypes = collectInputTypeNames([], tablesList);
1411
+ for (const typeName of fieldArgTypes) {
1412
+ mergedUsedInputTypes.add(typeName);
1413
+ }
1397
1414
  }
1398
1415
  const tableCrudTypes = tables ? buildTableCrudTypeNames(tables) : undefined;
1399
1416
  // Pass customScalarTypes + enumTypes as already-generated to avoid duplicate declarations
@@ -116,9 +116,10 @@ export function generateCreateClientFile(tables, hasCustomQueries, hasCustomMuta
116
116
  ], t.stringLiteral('./client'));
117
117
  typeExportDecl.exportKind = 'type';
118
118
  statements.push(typeExportDecl);
119
- // export { GraphQLRequestError } from './client';
119
+ // export { GraphQLRequestError, FetchAdapter } from './client';
120
120
  statements.push(t.exportNamedDeclaration(null, [
121
121
  t.exportSpecifier(t.identifier('GraphQLRequestError'), t.identifier('GraphQLRequestError')),
122
+ t.exportSpecifier(t.identifier('FetchAdapter'), t.identifier('FetchAdapter')),
122
123
  ], t.stringLiteral('./client')));
123
124
  // export { QueryBuilder } from './query-builder';
124
125
  statements.push(t.exportNamedDeclaration(null, [
@@ -49,7 +49,7 @@ export function generateOrm(options) {
49
49
  ...(customOperations?.queries ?? []),
50
50
  ...(customOperations?.mutations ?? []),
51
51
  ];
52
- const usedInputTypes = collectInputTypeNames(allOps);
52
+ const usedInputTypes = collectInputTypeNames(allOps, tables);
53
53
  const usedPayloadTypes = collectPayloadTypeNames(allOps);
54
54
  // Also include payload types for table CRUD mutations (they reference Edge types)
55
55
  if (typeRegistry) {
@@ -4,11 +4,15 @@ export interface GeneratedInputTypesFile {
4
4
  content: string;
5
5
  }
6
6
  /**
7
- * Collect all input type names used by operations
7
+ * Collect all input type names used by operations and table field arguments.
8
+ *
9
+ * Scans both custom operation args and computed-field args (e.g.
10
+ * `requestBulkUploadUrls(files: [FooBulkUploadFileInput!]!)` on bucket
11
+ * tables) so that referenced Input types are registered for generation.
8
12
  */
9
13
  export declare function collectInputTypeNames(operations: Array<{
10
14
  args: Argument[];
11
- }>): Set<string>;
15
+ }>, tables?: Table[]): Set<string>;
12
16
  /**
13
17
  * Collect all payload type names from operation return types
14
18
  */
@@ -1000,16 +1000,17 @@ function generateAllCrudInputTypes(tables, typeRegistry) {
1000
1000
  // Custom Input Types Generator (AST-based)
1001
1001
  // ============================================================================
1002
1002
  /**
1003
- * Collect all input type names used by operations
1003
+ * Collect all input type names used by operations and table field arguments.
1004
+ *
1005
+ * Scans both custom operation args and computed-field args (e.g.
1006
+ * `requestBulkUploadUrls(files: [FooBulkUploadFileInput!]!)` on bucket
1007
+ * tables) so that referenced Input types are registered for generation.
1004
1008
  */
1005
- export function collectInputTypeNames(operations) {
1009
+ export function collectInputTypeNames(operations, tables) {
1006
1010
  const inputTypes = new Set();
1007
1011
  function collectFromTypeRef(typeRef) {
1008
1012
  const baseName = getTypeBaseName(typeRef);
1009
- if (baseName && baseName.endsWith('Input')) {
1010
- inputTypes.add(baseName);
1011
- }
1012
- if (baseName && baseName.endsWith('Filter')) {
1013
+ if (baseName && (baseName.endsWith('Input') || baseName.endsWith('Filter'))) {
1013
1014
  inputTypes.add(baseName);
1014
1015
  }
1015
1016
  }
@@ -1018,6 +1019,17 @@ export function collectInputTypeNames(operations) {
1018
1019
  collectFromTypeRef(arg.type);
1019
1020
  }
1020
1021
  }
1022
+ if (tables) {
1023
+ for (const table of tables) {
1024
+ for (const field of table.fields) {
1025
+ if (!field.args)
1026
+ continue;
1027
+ for (const arg of field.args) {
1028
+ collectFromTypeRef(arg.type);
1029
+ }
1030
+ }
1031
+ }
1032
+ }
1021
1033
  return inputTypes;
1022
1034
  }
1023
1035
  /**
@@ -1350,12 +1362,17 @@ export function generateInputTypesFile(typeRegistry, usedInputTypes, tables, use
1350
1362
  statements.push(...generateConnectionFieldsMap(tablesList, tableByName));
1351
1363
  // 7. Custom input types from TypeRegistry
1352
1364
  // Also include any extra types referenced by plugin-injected filter fields
1365
+ // and by table field arguments (e.g. bucket computed-field args)
1353
1366
  const mergedUsedInputTypes = new Set(usedInputTypes);
1354
1367
  if (hasTables) {
1355
1368
  const filterExtraTypes = collectFilterExtraInputTypes(tablesList, typeRegistry);
1356
1369
  for (const typeName of filterExtraTypes) {
1357
1370
  mergedUsedInputTypes.add(typeName);
1358
1371
  }
1372
+ const fieldArgTypes = collectInputTypeNames([], tablesList);
1373
+ for (const typeName of fieldArgTypes) {
1374
+ mergedUsedInputTypes.add(typeName);
1375
+ }
1359
1376
  }
1360
1377
  const tableCrudTypes = tables ? buildTableCrudTypeNames(tables) : undefined;
1361
1378
  // Pass customScalarTypes + enumTypes as already-generated to avoid duplicate declarations
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/graphql-codegen",
3
- "version": "4.42.5",
3
+ "version": "4.43.0",
4
4
  "description": "GraphQL SDK generator for Constructive databases with React Query hooks",
5
5
  "keywords": [
6
6
  "graphql",
@@ -56,25 +56,25 @@
56
56
  "@0no-co/graphql.web": "^1.1.2",
57
57
  "@babel/generator": "^7.29.1",
58
58
  "@babel/types": "^7.29.0",
59
- "@constructive-io/graphql-query": "^3.25.5",
60
- "@constructive-io/graphql-types": "^3.10.0",
61
- "@inquirerer/utils": "^3.3.5",
62
- "@pgpmjs/core": "^6.19.0",
63
- "ajv": "^8.18.0",
59
+ "@constructive-io/graphql-query": "^3.25.6",
60
+ "@constructive-io/graphql-types": "^3.10.1",
61
+ "@inquirerer/utils": "^3.3.7",
62
+ "@pgpmjs/core": "^6.19.1",
63
+ "ajv": "^8.20.0",
64
64
  "deepmerge": "^4.3.1",
65
65
  "find-and-require-package-json": "^0.9.1",
66
66
  "gql-ast": "^3.10.0",
67
- "graphile-schema": "^1.20.5",
67
+ "graphile-schema": "^1.20.6",
68
68
  "graphql": "16.13.0",
69
69
  "inflekt": "^0.7.1",
70
- "inquirerer": "^4.7.0",
71
- "jiti": "^2.6.1",
72
- "oxfmt": "^0.42.0",
73
- "pg-cache": "^3.10.0",
70
+ "inquirerer": "^4.8.1",
71
+ "jiti": "^2.7.0",
72
+ "oxfmt": "^0.51.0",
73
+ "pg-cache": "^3.10.1",
74
74
  "pg-env": "^1.14.0",
75
- "pgsql-client": "^3.14.2",
76
- "pgsql-seed": "^2.14.2",
77
- "undici": "^7.24.6"
75
+ "pgsql-client": "^3.14.3",
76
+ "pgsql-seed": "^2.14.3",
77
+ "undici": "^8.3.0"
78
78
  },
79
79
  "peerDependencies": {
80
80
  "@tanstack/react-query": "^5.0.0",
@@ -93,12 +93,12 @@
93
93
  "@types/babel__generator": "^7.27.0",
94
94
  "@types/jest": "^30.0.0",
95
95
  "@types/node": "^22.19.11",
96
- "@types/react": "^19.2.14",
97
- "jest": "^30.3.0",
96
+ "@types/react": "^19.2.15",
97
+ "jest": "^30.4.2",
98
98
  "react": "^19.2.4",
99
- "ts-jest": "^29.2.5",
99
+ "ts-jest": "^29.4.11",
100
100
  "tsx": "^4.21.0",
101
101
  "typescript": "^5.9.3"
102
102
  },
103
- "gitHead": "7b7c25cb21fd0e97c2ab3c94b994b0ca89bd3247"
103
+ "gitHead": "030e1144acbd4e288ee74eff2ac0021ca0382ef7"
104
104
  }