@constructive-io/graphql-codegen 2.23.2 → 2.24.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 (90) hide show
  1. package/README.md +147 -2
  2. package/cli/codegen/babel-ast.d.ts +46 -0
  3. package/cli/codegen/babel-ast.js +145 -0
  4. package/cli/codegen/barrel.d.ts +7 -2
  5. package/cli/codegen/barrel.js +159 -97
  6. package/cli/codegen/client.js +61 -0
  7. package/cli/codegen/custom-mutations.d.ts +2 -12
  8. package/cli/codegen/custom-mutations.js +116 -124
  9. package/cli/codegen/custom-queries.d.ts +2 -10
  10. package/cli/codegen/custom-queries.js +246 -335
  11. package/cli/codegen/index.d.ts +3 -0
  12. package/cli/codegen/index.js +72 -3
  13. package/cli/codegen/invalidation.d.ts +20 -0
  14. package/cli/codegen/invalidation.js +327 -0
  15. package/cli/codegen/mutation-keys.d.ts +24 -0
  16. package/cli/codegen/mutation-keys.js +247 -0
  17. package/cli/codegen/mutations.d.ts +3 -19
  18. package/cli/codegen/mutations.js +372 -383
  19. package/cli/codegen/orm/barrel.d.ts +1 -1
  20. package/cli/codegen/orm/barrel.js +42 -10
  21. package/cli/codegen/orm/client-generator.d.ts +1 -19
  22. package/cli/codegen/orm/client-generator.js +108 -77
  23. package/cli/codegen/orm/custom-ops-generator.d.ts +1 -12
  24. package/cli/codegen/orm/custom-ops-generator.js +192 -235
  25. package/cli/codegen/orm/input-types-generator.d.ts +13 -1
  26. package/cli/codegen/orm/input-types-generator.js +403 -147
  27. package/cli/codegen/orm/model-generator.d.ts +1 -19
  28. package/cli/codegen/orm/model-generator.js +229 -234
  29. package/cli/codegen/queries.d.ts +3 -11
  30. package/cli/codegen/queries.js +582 -389
  31. package/cli/codegen/query-keys.d.ts +15 -0
  32. package/cli/codegen/query-keys.js +477 -0
  33. package/cli/codegen/scalars.js +1 -0
  34. package/cli/codegen/schema-types-generator.d.ts +15 -10
  35. package/cli/codegen/schema-types-generator.js +87 -175
  36. package/cli/codegen/type-resolver.d.ts +1 -30
  37. package/cli/codegen/type-resolver.js +0 -53
  38. package/cli/codegen/types.d.ts +1 -1
  39. package/cli/codegen/types.js +76 -21
  40. package/cli/commands/generate.js +1 -0
  41. package/cli/index.js +1 -0
  42. package/esm/cli/codegen/babel-ast.d.ts +46 -0
  43. package/esm/cli/codegen/babel-ast.js +97 -0
  44. package/esm/cli/codegen/barrel.d.ts +7 -2
  45. package/esm/cli/codegen/barrel.js +126 -97
  46. package/esm/cli/codegen/client.js +61 -0
  47. package/esm/cli/codegen/custom-mutations.d.ts +2 -12
  48. package/esm/cli/codegen/custom-mutations.js +83 -124
  49. package/esm/cli/codegen/custom-queries.d.ts +2 -10
  50. package/esm/cli/codegen/custom-queries.js +214 -336
  51. package/esm/cli/codegen/index.d.ts +3 -0
  52. package/esm/cli/codegen/index.js +68 -2
  53. package/esm/cli/codegen/invalidation.d.ts +20 -0
  54. package/esm/cli/codegen/invalidation.js +291 -0
  55. package/esm/cli/codegen/mutation-keys.d.ts +24 -0
  56. package/esm/cli/codegen/mutation-keys.js +211 -0
  57. package/esm/cli/codegen/mutations.d.ts +3 -19
  58. package/esm/cli/codegen/mutations.js +340 -384
  59. package/esm/cli/codegen/orm/barrel.d.ts +1 -1
  60. package/esm/cli/codegen/orm/barrel.js +10 -11
  61. package/esm/cli/codegen/orm/client-generator.d.ts +1 -19
  62. package/esm/cli/codegen/orm/client-generator.js +76 -78
  63. package/esm/cli/codegen/orm/custom-ops-generator.d.ts +1 -12
  64. package/esm/cli/codegen/orm/custom-ops-generator.js +160 -236
  65. package/esm/cli/codegen/orm/input-types-generator.d.ts +13 -1
  66. package/esm/cli/codegen/orm/input-types-generator.js +371 -148
  67. package/esm/cli/codegen/orm/model-generator.d.ts +1 -19
  68. package/esm/cli/codegen/orm/model-generator.js +197 -235
  69. package/esm/cli/codegen/queries.d.ts +3 -11
  70. package/esm/cli/codegen/queries.js +550 -390
  71. package/esm/cli/codegen/query-keys.d.ts +15 -0
  72. package/esm/cli/codegen/query-keys.js +441 -0
  73. package/esm/cli/codegen/scalars.js +1 -0
  74. package/esm/cli/codegen/schema-types-generator.d.ts +15 -10
  75. package/esm/cli/codegen/schema-types-generator.js +54 -175
  76. package/esm/cli/codegen/type-resolver.d.ts +1 -30
  77. package/esm/cli/codegen/type-resolver.js +0 -49
  78. package/esm/cli/codegen/types.d.ts +1 -1
  79. package/esm/cli/codegen/types.js +44 -22
  80. package/esm/cli/commands/generate.js +1 -0
  81. package/esm/cli/index.js +1 -0
  82. package/esm/types/config.d.ts +75 -0
  83. package/esm/types/config.js +19 -1
  84. package/package.json +6 -4
  85. package/types/config.d.ts +75 -0
  86. package/types/config.js +20 -2
  87. package/cli/codegen/ts-ast.d.ts +0 -124
  88. package/cli/codegen/ts-ast.js +0 -280
  89. package/esm/cli/codegen/ts-ast.d.ts +0 -124
  90. package/esm/cli/codegen/ts-ast.js +0 -260
@@ -1,6 +1,61 @@
1
1
  /**
2
2
  * SDK Configuration types
3
3
  */
4
+ /**
5
+ * Entity relationship definition for cascade invalidation
6
+ */
7
+ export interface EntityRelationship {
8
+ /** Parent entity name (e.g., 'database' for a table) */
9
+ parent: string;
10
+ /** Foreign key field name that references the parent (e.g., 'databaseId') */
11
+ foreignKey: string;
12
+ /** Optional transitive ancestors for deep invalidation (e.g., ['database', 'organization']) */
13
+ ancestors?: string[];
14
+ }
15
+ /**
16
+ * Query key generation configuration
17
+ */
18
+ export interface QueryKeyConfig {
19
+ /**
20
+ * Key structure style
21
+ * - 'flat': Simple ['entity', 'scope', data] structure
22
+ * - 'hierarchical': Nested factory pattern with scope support (lukemorales-style)
23
+ * @default 'hierarchical'
24
+ */
25
+ style?: 'flat' | 'hierarchical';
26
+ /**
27
+ * Define entity relationships for cascade invalidation and scoped keys
28
+ * Key: child entity name (lowercase), Value: relationship definition
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * relationships: {
33
+ * database: { parent: 'organization', foreignKey: 'organizationId' },
34
+ * table: { parent: 'database', foreignKey: 'databaseId', ancestors: ['organization'] },
35
+ * field: { parent: 'table', foreignKey: 'tableId', ancestors: ['database', 'organization'] },
36
+ * }
37
+ * ```
38
+ */
39
+ relationships?: Record<string, EntityRelationship>;
40
+ /**
41
+ * Generate scope-aware query keys for entities with relationships
42
+ * When true, keys include optional scope parameters for hierarchical invalidation
43
+ * @default true
44
+ */
45
+ generateScopedKeys?: boolean;
46
+ /**
47
+ * Generate cascade invalidation helpers
48
+ * Creates helpers that invalidate parent entities and all their children
49
+ * @default true
50
+ */
51
+ generateCascadeHelpers?: boolean;
52
+ /**
53
+ * Generate mutation keys for tracking in-flight mutations
54
+ * Useful for optimistic updates and mutation deduplication
55
+ * @default true
56
+ */
57
+ generateMutationKeys?: boolean;
58
+ }
4
59
  /**
5
60
  * Main configuration for graphql-codegen
6
61
  */
@@ -113,6 +168,11 @@ export interface GraphQLSDKConfig {
113
168
  */
114
169
  enabled?: boolean;
115
170
  };
171
+ /**
172
+ * Query key generation configuration
173
+ * Controls how query keys are structured for cache management
174
+ */
175
+ queryKeys?: QueryKeyConfig;
116
176
  /**
117
177
  * Watch mode configuration (dev-only feature)
118
178
  * When enabled via CLI --watch flag, the CLI will poll the endpoint for schema changes
@@ -157,6 +217,16 @@ export interface ResolvedWatchConfig {
157
217
  touchFile: string | null;
158
218
  clearScreen: boolean;
159
219
  }
220
+ /**
221
+ * Resolved query key configuration with defaults applied
222
+ */
223
+ export interface ResolvedQueryKeyConfig {
224
+ style: 'flat' | 'hierarchical';
225
+ relationships: Record<string, EntityRelationship>;
226
+ generateScopedKeys: boolean;
227
+ generateCascadeHelpers: boolean;
228
+ generateMutationKeys: boolean;
229
+ }
160
230
  /**
161
231
  * Resolved configuration with defaults applied
162
232
  */
@@ -203,12 +273,17 @@ export interface ResolvedConfig {
203
273
  reactQuery: {
204
274
  enabled: boolean;
205
275
  };
276
+ queryKeys: ResolvedQueryKeyConfig;
206
277
  watch: ResolvedWatchConfig;
207
278
  }
208
279
  /**
209
280
  * Default watch configuration values
210
281
  */
211
282
  export declare const DEFAULT_WATCH_CONFIG: ResolvedWatchConfig;
283
+ /**
284
+ * Default query key configuration values
285
+ */
286
+ export declare const DEFAULT_QUERY_KEY_CONFIG: ResolvedQueryKeyConfig;
212
287
  /**
213
288
  * Default configuration values
214
289
  */
@@ -10,6 +10,16 @@ export const DEFAULT_WATCH_CONFIG = {
10
10
  touchFile: null,
11
11
  clearScreen: true,
12
12
  };
13
+ /**
14
+ * Default query key configuration values
15
+ */
16
+ export const DEFAULT_QUERY_KEY_CONFIG = {
17
+ style: 'hierarchical',
18
+ relationships: {},
19
+ generateScopedKeys: true,
20
+ generateCascadeHelpers: true,
21
+ generateMutationKeys: true,
22
+ };
13
23
  /**
14
24
  * Default configuration values
15
25
  */
@@ -43,8 +53,9 @@ export const DEFAULT_CONFIG = {
43
53
  },
44
54
  orm: null, // ORM generation disabled by default
45
55
  reactQuery: {
46
- enabled: false, // React Query hooks disabled by default
56
+ enabled: true, // React Query hooks enabled by default for generate command
47
57
  },
58
+ queryKeys: DEFAULT_QUERY_KEY_CONFIG,
48
59
  watch: DEFAULT_WATCH_CONFIG,
49
60
  };
50
61
  /**
@@ -103,6 +114,13 @@ export function resolveConfig(config) {
103
114
  reactQuery: {
104
115
  enabled: config.reactQuery?.enabled ?? DEFAULT_CONFIG.reactQuery.enabled,
105
116
  },
117
+ queryKeys: {
118
+ style: config.queryKeys?.style ?? DEFAULT_QUERY_KEY_CONFIG.style,
119
+ relationships: config.queryKeys?.relationships ?? DEFAULT_QUERY_KEY_CONFIG.relationships,
120
+ generateScopedKeys: config.queryKeys?.generateScopedKeys ?? DEFAULT_QUERY_KEY_CONFIG.generateScopedKeys,
121
+ generateCascadeHelpers: config.queryKeys?.generateCascadeHelpers ?? DEFAULT_QUERY_KEY_CONFIG.generateCascadeHelpers,
122
+ generateMutationKeys: config.queryKeys?.generateMutationKeys ?? DEFAULT_QUERY_KEY_CONFIG.generateMutationKeys,
123
+ },
106
124
  watch: {
107
125
  pollInterval: config.watch?.pollInterval ?? DEFAULT_WATCH_CONFIG.pollInterval,
108
126
  debounce: config.watch?.debounce ?? DEFAULT_WATCH_CONFIG.debounce,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/graphql-codegen",
3
- "version": "2.23.2",
3
+ "version": "2.24.0",
4
4
  "description": "CLI-based GraphQL SDK generator for PostGraphile endpoints with React Query hooks",
5
5
  "keywords": [
6
6
  "graphql",
@@ -49,14 +49,15 @@
49
49
  "example:orm": "tsx examples/orm-sdk.ts"
50
50
  },
51
51
  "dependencies": {
52
+ "@babel/generator": "^7.28.5",
53
+ "@babel/types": "^7.28.5",
52
54
  "ajv": "^8.17.1",
53
55
  "commander": "^12.1.0",
54
56
  "gql-ast": "^2.4.6",
55
57
  "graphql": "15.10.1",
56
58
  "inflekt": "^0.2.0",
57
59
  "jiti": "^2.6.1",
58
- "prettier": "^3.7.4",
59
- "ts-morph": "^27.0.2"
60
+ "prettier": "^3.7.4"
60
61
  },
61
62
  "peerDependencies": {
62
63
  "@tanstack/react-query": "^5.0.0",
@@ -72,6 +73,7 @@
72
73
  },
73
74
  "devDependencies": {
74
75
  "@tanstack/react-query": "^5.90.16",
76
+ "@types/babel__generator": "^7.27.0",
75
77
  "@types/jest": "^29.5.14",
76
78
  "@types/node": "^20.19.27",
77
79
  "@types/react": "^19.2.7",
@@ -81,5 +83,5 @@
81
83
  "tsx": "^4.21.0",
82
84
  "typescript": "^5.9.3"
83
85
  },
84
- "gitHead": "a56b001d06690989ca4c66c3bfd7d260c3649eea"
86
+ "gitHead": "36d48ae1cde080add7953f46a6738a31909cf050"
85
87
  }
package/types/config.d.ts CHANGED
@@ -1,6 +1,61 @@
1
1
  /**
2
2
  * SDK Configuration types
3
3
  */
4
+ /**
5
+ * Entity relationship definition for cascade invalidation
6
+ */
7
+ export interface EntityRelationship {
8
+ /** Parent entity name (e.g., 'database' for a table) */
9
+ parent: string;
10
+ /** Foreign key field name that references the parent (e.g., 'databaseId') */
11
+ foreignKey: string;
12
+ /** Optional transitive ancestors for deep invalidation (e.g., ['database', 'organization']) */
13
+ ancestors?: string[];
14
+ }
15
+ /**
16
+ * Query key generation configuration
17
+ */
18
+ export interface QueryKeyConfig {
19
+ /**
20
+ * Key structure style
21
+ * - 'flat': Simple ['entity', 'scope', data] structure
22
+ * - 'hierarchical': Nested factory pattern with scope support (lukemorales-style)
23
+ * @default 'hierarchical'
24
+ */
25
+ style?: 'flat' | 'hierarchical';
26
+ /**
27
+ * Define entity relationships for cascade invalidation and scoped keys
28
+ * Key: child entity name (lowercase), Value: relationship definition
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * relationships: {
33
+ * database: { parent: 'organization', foreignKey: 'organizationId' },
34
+ * table: { parent: 'database', foreignKey: 'databaseId', ancestors: ['organization'] },
35
+ * field: { parent: 'table', foreignKey: 'tableId', ancestors: ['database', 'organization'] },
36
+ * }
37
+ * ```
38
+ */
39
+ relationships?: Record<string, EntityRelationship>;
40
+ /**
41
+ * Generate scope-aware query keys for entities with relationships
42
+ * When true, keys include optional scope parameters for hierarchical invalidation
43
+ * @default true
44
+ */
45
+ generateScopedKeys?: boolean;
46
+ /**
47
+ * Generate cascade invalidation helpers
48
+ * Creates helpers that invalidate parent entities and all their children
49
+ * @default true
50
+ */
51
+ generateCascadeHelpers?: boolean;
52
+ /**
53
+ * Generate mutation keys for tracking in-flight mutations
54
+ * Useful for optimistic updates and mutation deduplication
55
+ * @default true
56
+ */
57
+ generateMutationKeys?: boolean;
58
+ }
4
59
  /**
5
60
  * Main configuration for graphql-codegen
6
61
  */
@@ -113,6 +168,11 @@ export interface GraphQLSDKConfig {
113
168
  */
114
169
  enabled?: boolean;
115
170
  };
171
+ /**
172
+ * Query key generation configuration
173
+ * Controls how query keys are structured for cache management
174
+ */
175
+ queryKeys?: QueryKeyConfig;
116
176
  /**
117
177
  * Watch mode configuration (dev-only feature)
118
178
  * When enabled via CLI --watch flag, the CLI will poll the endpoint for schema changes
@@ -157,6 +217,16 @@ export interface ResolvedWatchConfig {
157
217
  touchFile: string | null;
158
218
  clearScreen: boolean;
159
219
  }
220
+ /**
221
+ * Resolved query key configuration with defaults applied
222
+ */
223
+ export interface ResolvedQueryKeyConfig {
224
+ style: 'flat' | 'hierarchical';
225
+ relationships: Record<string, EntityRelationship>;
226
+ generateScopedKeys: boolean;
227
+ generateCascadeHelpers: boolean;
228
+ generateMutationKeys: boolean;
229
+ }
160
230
  /**
161
231
  * Resolved configuration with defaults applied
162
232
  */
@@ -203,12 +273,17 @@ export interface ResolvedConfig {
203
273
  reactQuery: {
204
274
  enabled: boolean;
205
275
  };
276
+ queryKeys: ResolvedQueryKeyConfig;
206
277
  watch: ResolvedWatchConfig;
207
278
  }
208
279
  /**
209
280
  * Default watch configuration values
210
281
  */
211
282
  export declare const DEFAULT_WATCH_CONFIG: ResolvedWatchConfig;
283
+ /**
284
+ * Default query key configuration values
285
+ */
286
+ export declare const DEFAULT_QUERY_KEY_CONFIG: ResolvedQueryKeyConfig;
212
287
  /**
213
288
  * Default configuration values
214
289
  */
package/types/config.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * SDK Configuration types
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DEFAULT_ORM_CONFIG = exports.DEFAULT_CONFIG = exports.DEFAULT_WATCH_CONFIG = void 0;
6
+ exports.DEFAULT_ORM_CONFIG = exports.DEFAULT_CONFIG = exports.DEFAULT_QUERY_KEY_CONFIG = exports.DEFAULT_WATCH_CONFIG = void 0;
7
7
  exports.defineConfig = defineConfig;
8
8
  exports.resolveConfig = resolveConfig;
9
9
  /**
@@ -15,6 +15,16 @@ exports.DEFAULT_WATCH_CONFIG = {
15
15
  touchFile: null,
16
16
  clearScreen: true,
17
17
  };
18
+ /**
19
+ * Default query key configuration values
20
+ */
21
+ exports.DEFAULT_QUERY_KEY_CONFIG = {
22
+ style: 'hierarchical',
23
+ relationships: {},
24
+ generateScopedKeys: true,
25
+ generateCascadeHelpers: true,
26
+ generateMutationKeys: true,
27
+ };
18
28
  /**
19
29
  * Default configuration values
20
30
  */
@@ -48,8 +58,9 @@ exports.DEFAULT_CONFIG = {
48
58
  },
49
59
  orm: null, // ORM generation disabled by default
50
60
  reactQuery: {
51
- enabled: false, // React Query hooks disabled by default
61
+ enabled: true, // React Query hooks enabled by default for generate command
52
62
  },
63
+ queryKeys: exports.DEFAULT_QUERY_KEY_CONFIG,
53
64
  watch: exports.DEFAULT_WATCH_CONFIG,
54
65
  };
55
66
  /**
@@ -108,6 +119,13 @@ function resolveConfig(config) {
108
119
  reactQuery: {
109
120
  enabled: config.reactQuery?.enabled ?? exports.DEFAULT_CONFIG.reactQuery.enabled,
110
121
  },
122
+ queryKeys: {
123
+ style: config.queryKeys?.style ?? exports.DEFAULT_QUERY_KEY_CONFIG.style,
124
+ relationships: config.queryKeys?.relationships ?? exports.DEFAULT_QUERY_KEY_CONFIG.relationships,
125
+ generateScopedKeys: config.queryKeys?.generateScopedKeys ?? exports.DEFAULT_QUERY_KEY_CONFIG.generateScopedKeys,
126
+ generateCascadeHelpers: config.queryKeys?.generateCascadeHelpers ?? exports.DEFAULT_QUERY_KEY_CONFIG.generateCascadeHelpers,
127
+ generateMutationKeys: config.queryKeys?.generateMutationKeys ?? exports.DEFAULT_QUERY_KEY_CONFIG.generateMutationKeys,
128
+ },
111
129
  watch: {
112
130
  pollInterval: config.watch?.pollInterval ?? exports.DEFAULT_WATCH_CONFIG.pollInterval,
113
131
  debounce: config.watch?.debounce ?? exports.DEFAULT_WATCH_CONFIG.debounce,
@@ -1,124 +0,0 @@
1
- /**
2
- * TypeScript AST builders using ts-morph
3
- *
4
- * Provides utilities for generating TypeScript code via AST manipulation
5
- * instead of string concatenation.
6
- */
7
- import { Project, SourceFile, type InterfaceDeclarationStructure, type FunctionDeclarationStructure, type VariableStatementStructure, type ImportDeclarationStructure, type TypeAliasDeclarationStructure } from 'ts-morph';
8
- /**
9
- * Create a new ts-morph project for code generation
10
- */
11
- export declare function createProject(): Project;
12
- /**
13
- * Create a source file in the project
14
- */
15
- export declare function createSourceFile(project: Project, fileName: string): SourceFile;
16
- /**
17
- * Get formatted output from source file
18
- */
19
- export declare function getFormattedOutput(sourceFile: SourceFile): string;
20
- /**
21
- * Get output with minimal formatting (preserves intentional blank lines)
22
- * Post-processes to fix indentation and section comment spacing
23
- *
24
- * ts-morph generates type alias bodies with extra indentation:
25
- * - Properties get 6 spaces (we want 2)
26
- * - Closing brace gets 4 spaces (we want 0)
27
- *
28
- * For interfaces it uses 4 spaces which we convert to 2.
29
- */
30
- export declare function getMinimalFormattedOutput(sourceFile: SourceFile): string;
31
- /**
32
- * Create a file header comment
33
- */
34
- export declare function createFileHeader(description: string): string;
35
- /**
36
- * Create JSDoc comment for a declaration
37
- */
38
- export declare function createJsDoc(lines: string[]): string;
39
- export interface ImportSpec {
40
- moduleSpecifier: string;
41
- namedImports?: string[];
42
- typeOnlyNamedImports?: string[];
43
- defaultImport?: string;
44
- }
45
- /**
46
- * Create import declaration structure
47
- */
48
- export declare function createImport(spec: ImportSpec): ImportDeclarationStructure;
49
- export interface InterfaceProperty {
50
- name: string;
51
- type: string;
52
- optional?: boolean;
53
- docs?: string[];
54
- }
55
- /**
56
- * Create interface declaration structure
57
- */
58
- export declare function createInterface(name: string, properties: InterfaceProperty[], options?: {
59
- docs?: string[];
60
- isExported?: boolean;
61
- extends?: string[];
62
- }): InterfaceDeclarationStructure;
63
- /**
64
- * Create filter interface with standard PostGraphile operators
65
- */
66
- export declare function createFilterInterface(name: string, fieldFilters: Array<{
67
- fieldName: string;
68
- filterType: string;
69
- }>, options?: {
70
- isExported?: boolean;
71
- }): InterfaceDeclarationStructure;
72
- /**
73
- * Create type alias declaration structure
74
- */
75
- export declare function createTypeAlias(name: string, type: string, options?: {
76
- docs?: string[];
77
- isExported?: boolean;
78
- }): TypeAliasDeclarationStructure;
79
- /**
80
- * Create union type from string literals
81
- */
82
- export declare function createUnionType(values: string[]): string;
83
- /**
84
- * Create const variable statement structure
85
- */
86
- export declare function createConst(name: string, initializer: string, options?: {
87
- docs?: string[];
88
- isExported?: boolean;
89
- type?: string;
90
- }): VariableStatementStructure;
91
- /**
92
- * Create a template literal string (for GraphQL documents)
93
- */
94
- export declare function createTemplateLiteral(content: string): string;
95
- export interface FunctionParameter {
96
- name: string;
97
- type: string;
98
- optional?: boolean;
99
- initializer?: string;
100
- }
101
- /**
102
- * Create function declaration structure
103
- */
104
- export declare function createFunction(name: string, parameters: FunctionParameter[], returnType: string, body: string, options?: {
105
- docs?: string[];
106
- isExported?: boolean;
107
- isAsync?: boolean;
108
- }): FunctionDeclarationStructure;
109
- /**
110
- * Create re-export statement
111
- */
112
- export declare function createReExport(names: string[], moduleSpecifier: string, isTypeOnly?: boolean): string;
113
- /**
114
- * Create barrel export statement
115
- */
116
- export declare function createBarrelExport(moduleSpecifier: string): string;
117
- /**
118
- * Create a section divider comment for generated code
119
- */
120
- export declare function createSectionComment(title: string): string;
121
- /**
122
- * Add a section comment to source file with proper spacing
123
- */
124
- export declare function addSectionComment(sourceFile: SourceFile, title: string): void;