@conduit-client/generator-ts 3.16.0-dev1 → 3.17.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.
@@ -1,5 +1,6 @@
1
1
  import { type NamedService, type ServiceDescriptor } from '@conduit-client/utils';
2
2
  import { Code } from './code';
3
+ import type { ImportableTypeReference, ImportableValueReference } from './code';
3
4
  /**
4
5
  * Service that builds TypeScript source files.
5
6
  */
@@ -66,6 +67,19 @@ export declare class File {
66
67
  * @returns this
67
68
  */
68
69
  pushTo(block: Symbol, ...chunks: any[]): this;
70
+ private reExports;
71
+ /** Registers a value re-export: `export { symbol [as alias] } from "…";` */
72
+ reExport(ref: ImportableValueReference & {
73
+ filename: string;
74
+ exportedSymbol: string;
75
+ }, alias?: string): void;
76
+ /** Registers a type re-export: `export type { symbol [as alias] } from "…";` */
77
+ reExportType(ref: ImportableTypeReference & {
78
+ filename: string;
79
+ exportedSymbol: string;
80
+ }, alias?: string): void;
81
+ /** Registers a wildcard type re-export: `export type * from "…";` */
82
+ reExportTypeAll(targetFilename: string): void;
69
83
  /**
70
84
  * Returns the code for this File, with ImportableReferences resolved.
71
85
  *
@@ -7,6 +7,7 @@ import { WireAdapterBindingGenerator } from './wire-binding-generator';
7
7
  import { GraphQLImperativeAdapterBindingGenerator } from './graphql-imperative-binding-generator';
8
8
  import { GraphQLWireAdapterBindingGenerator } from './graphql-wire-binding-generator';
9
9
  import { GraphQLMutationAdapterBindingGenerator } from './graphql-mutation-binding-generator';
10
+ import type { File, ImportableValueReference } from '../files';
10
11
  import type { ICommandModel, ServiceDependency } from '../model/base-command-model';
11
12
  import type { NamedTypeRegistryGeneratorService, TypeRegistryGenerator } from '../normalization/type-registry-generator';
12
13
  import type { NamedGraphQLTypeRegistryGeneratorService } from '../normalization/graphql-type-registry-generator';
@@ -43,7 +44,6 @@ export declare class BindingsGenerator {
43
44
  protected exportsTypeMembersSymbol: symbol;
44
45
  protected exportsAssignmentsSymbol: symbol;
45
46
  protected initGeneratedBindingsExtraParamsSymbol: symbol;
46
- protected reExportsSymbol: symbol;
47
47
  /**
48
48
  * Template for generating the binding structure in the output file.
49
49
  * Includes placeholders for adapter declarations, service requirements, and adapter invocations.
@@ -64,38 +64,42 @@ export declare class BindingsGenerator {
64
64
  * This method coordinates with individual binding generators to compile the necessary elements into a single file.
65
65
  */
66
66
  build(): void;
67
- /**
68
- * Computes a relative import specifier from the bindings-core file to the
69
- * given generated file path (e.g. `commands/getTestCommand.ts` -> `../commands/getTestCommand`).
70
- */
71
- protected relativeImportPath(coreFilename: string, targetFilePath: string): string;
72
67
  /**
73
68
  * Emits re-export statements from bindings-core so that custom bindings modules
74
69
  * can import generated internals from a single stable entry point.
75
70
  */
76
- protected buildReExports(coreFile: {
77
- filename: string;
78
- pushTo: (...args: any[]) => any;
71
+ protected buildReExports(coreFile: File, refs: {
72
+ typeRegistryRef?: ImportableValueReference & {
73
+ filename: string;
74
+ exportedSymbol: string;
75
+ };
76
+ graphqlTypeRegistryRef?: ImportableValueReference & {
77
+ filename: string;
78
+ exportedSymbol: string;
79
+ };
79
80
  }): void;
80
81
  /**
81
- * Re-exports per-command symbols: `buildCommandClass` (aliased to `build<Pascal>CommandClass`),
82
+ * Re-exports per-command symbols: `buildCommandClass` (aliased to `build<Capitalized>CommandClass`),
82
83
  * `CONFIG_SCHEMA` (aliased to `<UPPER>_CONFIG_SCHEMA`), and the `Config` type
83
- * (aliased to `<Pascal>Config`).
84
+ * (aliased to `<Capitalized>Config`).
84
85
  *
85
86
  * The CONFIG_SCHEMA alias uses a simple uppercase of the commandName (e.g. `getItemsByIds`
86
87
  * becomes `GETITEMSBYIDS_CONFIG_SCHEMA`) to avoid ambiguity from word-boundary heuristics.
87
88
  */
88
- protected buildCommandReExports(coreFile: {
89
- filename: string;
90
- pushTo: (...args: any[]) => any;
91
- }): void;
89
+ protected buildCommandReExports(coreFile: File): void;
92
90
  /**
93
91
  * Re-exports the `TypeRegistry` (REST) and/or `GraphQLTypeRegistry` (GraphQL) classes
94
92
  * so custom bindings can construct or extend them.
95
93
  */
96
- protected buildTypeRegistryReExports(coreFile: {
97
- filename: string;
98
- pushTo: (...args: any[]) => any;
94
+ protected buildTypeRegistryReExports(coreFile: File, refs: {
95
+ typeRegistryRef?: ImportableValueReference & {
96
+ filename: string;
97
+ exportedSymbol: string;
98
+ };
99
+ graphqlTypeRegistryRef?: ImportableValueReference & {
100
+ filename: string;
101
+ exportedSymbol: string;
102
+ };
99
103
  }): void;
100
104
  /**
101
105
  * Re-exports individual generated type repository classes (e.g. `RecordRepresentationRepository`)
@@ -104,18 +108,16 @@ export declare class BindingsGenerator {
104
108
  * If both REST and GraphQL registries produce a repository with the same exported symbol,
105
109
  * the GraphQL version is aliased with a `GraphQL_` prefix to avoid collisions.
106
110
  */
107
- protected buildTypeRepositoryReExports(coreFile: {
108
- filename: string;
109
- pushTo: (...args: any[]) => any;
110
- }): void;
111
+ protected buildTypeRepositoryReExports(coreFile: File): void;
111
112
  /**
112
113
  * Re-exports all generated entity types so custom bindings can reference
113
114
  * domain models (e.g. `api_Item`) without importing from internal paths.
115
+ *
116
+ * The barrel `types/index.ts` is built incrementally by TypeDefinitionService
117
+ * as types are generated; we just re-export it from bindings-core.
118
+ * GraphQL-only specs produce no REST types so the barrel is never created.
114
119
  */
115
- protected buildEntityTypeReExports(coreFile: {
116
- filename: string;
117
- pushTo: (...args: any[]) => any;
118
- }): void;
120
+ protected buildEntityTypeReExports(coreFile: File): void;
119
121
  buildTypeInvalidation(typesWithNormalization: TypeRegistryGenerator['invalidatableTypes']): {
120
122
  definitions: Code[];
121
123
  declarations: Code[];
@@ -9,6 +9,7 @@ export type TypeDefinitionForOptions = {
9
9
  };
10
10
  export type ITypeDefinitionService = {
11
11
  build(type: Type | undefined): Code;
12
+ readonly hasTypes: boolean;
12
13
  };
13
14
  export type NamedTypeDefinitionService = NamedService<'typeDefinition', ITypeDefinitionService>;
14
15
  export declare class TypeDefinitionService implements ITypeDefinitionService {
@@ -16,6 +17,7 @@ export declare class TypeDefinitionService implements ITypeDefinitionService {
16
17
  private fileFor;
17
18
  constructor(services: NamedAPIService & NamedFileService, fileFor?: (typename: string) => string);
18
19
  cache: Map<string, ImportableReference>;
20
+ get hasTypes(): boolean;
19
21
  build(type: Type | undefined, useReferences?: boolean): Code;
20
22
  buildTypeCode(t: Type, options: TypeDefinitionForOptions): Code;
21
23
  buildReferenceCode(refType: RefType, options: TypeDefinitionForOptions): Code;
@@ -32,4 +34,6 @@ export declare function typeDefinitions(services: NamedAPIService & NamedFileSer
32
34
  fileFor?: (typename: string) => string;
33
35
  }): TypeDefinitionService;
34
36
  export declare const FILE_PER_TYPE: (typename: string) => string;
37
+ export declare const TYPES_SINGLE_FILE_PATH = "types/types.ts";
35
38
  export declare const SINGLE_FILE: (_: string) => string;
39
+ export declare const TYPES_INDEX_PATH = "types/index.ts";
package/dist/v1/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  import * as path from "path";
7
7
  import { resolve } from "path";
8
8
  import * as prettier from "prettier";
9
- import { toTypeScriptSafeIdentifier, JSONStringify, ok, err, toPascalCase, stringIsVersion, stableJSONStringify } from "@conduit-client/utils";
9
+ import { toTypeScriptSafeIdentifier, JSONStringify, ok, err, capitalizeFirst, stringIsVersion, stableJSONStringify } from "@conduit-client/utils";
10
10
  import * as fs from "fs";
11
11
  import { readFileSync } from "fs";
12
12
  import { isAnyType, isRefType, isAllOfType, isOneOfType, isNotType, isObjectType as isObjectType$2, isDiscriminatedObjectType, isArrayType, isScalar, isEnumType as isEnumType$1, isNilType, isCanonicalStringType, isCanonicalNumberType, isBooleanType, typesEqual, isIdentifiableType as isIdentifiableType$1, canonicalizeType } from "@conduit-client/model/v1";
@@ -116,6 +116,10 @@ class Files {
116
116
  function fileService() {
117
117
  return new Files();
118
118
  }
119
+ function resolveRelativeImportPath(fromFile, toFile) {
120
+ const rel = path.relative(path.dirname(fromFile), toFile).replace(/\.(js|ts)$/, "");
121
+ return rel.startsWith(".") ? rel : "./" + rel;
122
+ }
119
123
  class Imports {
120
124
  /**
121
125
  * Constructor
@@ -156,10 +160,7 @@ class Imports {
156
160
  }
157
161
  let from;
158
162
  if ("filename" in ref) {
159
- from = path.relative(path.dirname(this.filename), ref.filename).replace(/\.(js|ts)$/, "");
160
- if (!from.startsWith(".")) {
161
- from = "./" + from;
162
- }
163
+ from = resolveRelativeImportPath(this.filename, ref.filename);
163
164
  } else {
164
165
  from = ref.module;
165
166
  }
@@ -224,11 +225,59 @@ class Imports {
224
225
  ].join("");
225
226
  }
226
227
  }
228
+ class ReExports {
229
+ constructor(filename) {
230
+ this.filename = filename;
231
+ this.entries = {};
232
+ this.typeAllPaths = /* @__PURE__ */ new Set();
233
+ }
234
+ resolveFrom(targetFilename) {
235
+ return resolveRelativeImportPath(this.filename, targetFilename);
236
+ }
237
+ /**
238
+ * Registers a value or type re-export: `export { symbol [as alias] } from "…";`
239
+ * @param targetFilename the filename of the target file to re-export
240
+ * @param exportedSymbol the symbol to export
241
+ * @param alias an optional alias for the symbol
242
+ * @param isType true if the re-export is for a type; false if it is for a value
243
+ */
244
+ add(targetFilename, exportedSymbol, alias, isType2) {
245
+ const from = this.resolveFrom(targetFilename);
246
+ if (!this.entries[from]) {
247
+ this.entries[from] = [];
248
+ }
249
+ this.entries[from].push({ exportedSymbol, alias, isType: isType2 });
250
+ }
251
+ /**
252
+ * Registers a wildcard type re-export: `export type * from "…";`
253
+ * @param targetFilename the filename of the target file to re-export
254
+ */
255
+ addTypeAll(targetFilename) {
256
+ this.typeAllPaths.add(this.resolveFrom(targetFilename));
257
+ }
258
+ toString() {
259
+ const statements = [];
260
+ for (const from of Object.keys(this.entries)) {
261
+ const entries = this.entries[from];
262
+ for (const isType2 of [false, true]) {
263
+ const clauses = entries.filter((e) => e.isType === isType2).map((e) => e.alias ? `${e.exportedSymbol} as ${e.alias}` : e.exportedSymbol).join(",");
264
+ if (clauses) {
265
+ statements.push(`export ${isType2 ? "type " : ""}{${clauses}} from '${from}';`);
266
+ }
267
+ }
268
+ }
269
+ for (const from of this.typeAllPaths) {
270
+ statements.push(`export type * from '${from}';`);
271
+ }
272
+ return statements.length > 0 ? statements.join("") : "";
273
+ }
274
+ }
227
275
  const _File = class _File {
228
276
  constructor(filename) {
229
277
  this.filename = filename;
230
278
  this.blocks = /* @__PURE__ */ new Map();
231
279
  this.template = [_File.DEFAULT_BLOCK];
280
+ this.reExports = new ReExports(this.filename);
232
281
  }
233
282
  /**
234
283
  * Appends new chunks of code to the default code block. Chunks are handled
@@ -256,6 +305,18 @@ const _File = class _File {
256
305
  code2.push(...chunks);
257
306
  return this;
258
307
  }
308
+ /** Registers a value re-export: `export { symbol [as alias] } from "…";` */
309
+ reExport(ref, alias) {
310
+ this.reExports.add(ref.filename, ref.exportedSymbol, alias, false);
311
+ }
312
+ /** Registers a type re-export: `export type { symbol [as alias] } from "…";` */
313
+ reExportType(ref, alias) {
314
+ this.reExports.add(ref.filename, ref.exportedSymbol, alias, true);
315
+ }
316
+ /** Registers a wildcard type re-export: `export type * from "…";` */
317
+ reExportTypeAll(targetFilename) {
318
+ this.reExports.addTypeAll(targetFilename);
319
+ }
259
320
  /**
260
321
  * Returns the code for this File, with ImportableReferences resolved.
261
322
  *
@@ -272,7 +333,7 @@ const _File = class _File {
272
333
  const executableCode = finalCode.toString({
273
334
  importStringifier: (ir) => imports.localSymbolFor(ir)
274
335
  });
275
- const code2 = imports.toString() + executableCode;
336
+ const code2 = imports.toString() + executableCode + this.reExports.toString();
276
337
  if (options.prettified) {
277
338
  try {
278
339
  return prettier.format(code2, { parser: "typescript" });
@@ -395,6 +456,9 @@ class TypeDefinitionService {
395
456
  this.fileFor = fileFor;
396
457
  this.cache = /* @__PURE__ */ new Map();
397
458
  }
459
+ get hasTypes() {
460
+ return this.cache.size > 0;
461
+ }
398
462
  build(type, useReferences = true) {
399
463
  return type ? this.buildTypeCode(type, {
400
464
  referenceFor: (t) => {
@@ -581,6 +645,7 @@ class TypeDefinitionService {
581
645
  this.cache.set(typename, result);
582
646
  const declaration = code`export type ${exportedSymbol}=${this.build(type, false)};`;
583
647
  this.services.file.build(filename).push(declaration);
648
+ this.services.file.build(TYPES_INDEX_PATH).reExportTypeAll(filename);
584
649
  return result;
585
650
  }
586
651
  }
@@ -588,7 +653,9 @@ function typeDefinitions(services, options = {}) {
588
653
  return new TypeDefinitionService(services, options.fileFor || SINGLE_FILE);
589
654
  }
590
655
  const FILE_PER_TYPE = (typename) => `types/${typename}.ts`;
591
- const SINGLE_FILE = (_) => "types/types.ts";
656
+ const TYPES_SINGLE_FILE_PATH = "types/types.ts";
657
+ const SINGLE_FILE = (_) => TYPES_SINGLE_FILE_PATH;
658
+ const TYPES_INDEX_PATH = "types/index.ts";
592
659
  const SCHEMA_FILE_PATH = "json-schema/index.ts";
593
660
  const COMBINED_SCHEMA = {
594
661
  filename: SCHEMA_FILE_PATH,
@@ -3539,7 +3606,6 @@ class BindingsGenerator {
3539
3606
  this.initGeneratedBindingsExtraParamsSymbol = Symbol.for(
3540
3607
  "initGeneratedBindingsExtraParams"
3541
3608
  );
3542
- this.reExportsSymbol = Symbol.for("reExports");
3543
3609
  }
3544
3610
  /**
3545
3611
  * Template for generating the binding structure in the output file.
@@ -3573,8 +3639,7 @@ class BindingsGenerator {
3573
3639
  this.typeInvalidationDefinitionSymbol,
3574
3640
  this.adapterInvocationSymbol,
3575
3641
  this.exportsAssignmentsSymbol,
3576
- code`}`,
3577
- this.reExportsSymbol
3642
+ code`}`
3578
3643
  ];
3579
3644
  }
3580
3645
  get wrapperTemplate() {
@@ -3716,9 +3781,11 @@ class BindingsGenerator {
3716
3781
  const wrapperFilename = "artifacts/bindings.ts";
3717
3782
  const wrapperFile = this.services.file.build(wrapperFilename);
3718
3783
  wrapperFile.template = this.wrapperTemplate;
3784
+ let typeRegistryRef;
3785
+ let graphqlTypeRegistryRef;
3719
3786
  if (this.hasRESTNormalization) {
3720
3787
  const { typeRegistryGenerator } = this.services;
3721
- const typeRegistryRef = typeRegistryGenerator.build();
3788
+ typeRegistryRef = typeRegistryGenerator.build();
3722
3789
  coreFile.pushTo(
3723
3790
  this.initGeneratedBindingsExtraParamsSymbol,
3724
3791
  code`, typeRegistry?: ${typeRegistryRef}`
@@ -3735,7 +3802,7 @@ class BindingsGenerator {
3735
3802
  }
3736
3803
  if (this.hasGraphQL) {
3737
3804
  const { graphqlTypeRegistryGenerator } = this.services;
3738
- const graphqlTypeRegistryRef = graphqlTypeRegistryGenerator.build();
3805
+ graphqlTypeRegistryRef = graphqlTypeRegistryGenerator.build();
3739
3806
  coreFile.pushTo(
3740
3807
  this.initGeneratedBindingsExtraParamsSymbol,
3741
3808
  code`, graphqlTypeRegistry?: ${graphqlTypeRegistryRef}`
@@ -3823,67 +3890,60 @@ class BindingsGenerator {
3823
3890
  "\n"
3824
3891
  )
3825
3892
  );
3826
- this.buildReExports(coreFile);
3827
- }
3828
- /**
3829
- * Computes a relative import specifier from the bindings-core file to the
3830
- * given generated file path (e.g. `commands/getTestCommand.ts` -> `../commands/getTestCommand`).
3831
- */
3832
- relativeImportPath(coreFilename, targetFilePath) {
3833
- const rel = path.relative(path.dirname(coreFilename), targetFilePath).replace(/\.ts$/, "");
3834
- return rel.startsWith(".") ? rel : "./" + rel;
3893
+ this.buildReExports(coreFile, { typeRegistryRef, graphqlTypeRegistryRef });
3835
3894
  }
3836
3895
  /**
3837
3896
  * Emits re-export statements from bindings-core so that custom bindings modules
3838
3897
  * can import generated internals from a single stable entry point.
3839
3898
  */
3840
- buildReExports(coreFile) {
3899
+ buildReExports(coreFile, refs) {
3841
3900
  this.buildCommandReExports(coreFile);
3842
- this.buildTypeRegistryReExports(coreFile);
3901
+ this.buildTypeRegistryReExports(coreFile, refs);
3843
3902
  this.buildTypeRepositoryReExports(coreFile);
3844
3903
  this.buildEntityTypeReExports(coreFile);
3845
3904
  }
3846
3905
  /**
3847
- * Re-exports per-command symbols: `buildCommandClass` (aliased to `build<Pascal>CommandClass`),
3906
+ * Re-exports per-command symbols: `buildCommandClass` (aliased to `build<Capitalized>CommandClass`),
3848
3907
  * `CONFIG_SCHEMA` (aliased to `<UPPER>_CONFIG_SCHEMA`), and the `Config` type
3849
- * (aliased to `<Pascal>Config`).
3908
+ * (aliased to `<Capitalized>Config`).
3850
3909
  *
3851
3910
  * The CONFIG_SCHEMA alias uses a simple uppercase of the commandName (e.g. `getItemsByIds`
3852
3911
  * becomes `GETITEMSBYIDS_CONFIG_SCHEMA`) to avoid ambiguity from word-boundary heuristics.
3853
3912
  */
3854
3913
  buildCommandReExports(coreFile) {
3855
3914
  for (const model of this.commandModels) {
3856
- const pascal = toPascalCase(model.commandName);
3915
+ const capitalized = capitalizeFirst(model.commandName);
3857
3916
  const upper = model.commandName.toUpperCase();
3858
- const relPath = this.relativeImportPath(coreFile.filename, model.filePath);
3859
- coreFile.pushTo(
3860
- this.reExportsSymbol,
3861
- code`export { buildCommandClass as build${pascal}CommandClass, CONFIG_SCHEMA as ${upper}_CONFIG_SCHEMA } from "${relPath}";`,
3862
- code`export type { Config as ${pascal}Config } from "${relPath}";`
3863
- );
3917
+ const buildRef = {
3918
+ filename: model.filePath,
3919
+ exportedSymbol: "buildCommandClass",
3920
+ isType: false
3921
+ };
3922
+ const schemaRef = {
3923
+ filename: model.filePath,
3924
+ exportedSymbol: "CONFIG_SCHEMA",
3925
+ isType: false
3926
+ };
3927
+ const configRef = {
3928
+ filename: model.filePath,
3929
+ exportedSymbol: "Config",
3930
+ isType: true
3931
+ };
3932
+ coreFile.reExport(buildRef, `build${capitalized}CommandClass`);
3933
+ coreFile.reExport(schemaRef, `${upper}_CONFIG_SCHEMA`);
3934
+ coreFile.reExportType(configRef, `${capitalized}Config`);
3864
3935
  }
3865
3936
  }
3866
3937
  /**
3867
3938
  * Re-exports the `TypeRegistry` (REST) and/or `GraphQLTypeRegistry` (GraphQL) classes
3868
3939
  * so custom bindings can construct or extend them.
3869
3940
  */
3870
- buildTypeRegistryReExports(coreFile) {
3871
- if (this.hasRESTNormalization) {
3872
- const relPath = this.relativeImportPath(
3873
- coreFile.filename,
3874
- "normalization/type-registry.ts"
3875
- );
3876
- coreFile.pushTo(this.reExportsSymbol, code`export { TypeRegistry } from "${relPath}";`);
3941
+ buildTypeRegistryReExports(coreFile, refs) {
3942
+ if (refs.typeRegistryRef) {
3943
+ coreFile.reExport(refs.typeRegistryRef);
3877
3944
  }
3878
- if (this.hasGraphQL) {
3879
- const relPath = this.relativeImportPath(
3880
- coreFile.filename,
3881
- "normalization/graphql-type-registry.ts"
3882
- );
3883
- coreFile.pushTo(
3884
- this.reExportsSymbol,
3885
- code`export { GraphQLTypeRegistry } from "${relPath}";`
3886
- );
3945
+ if (refs.graphqlTypeRegistryRef) {
3946
+ coreFile.reExport(refs.graphqlTypeRegistryRef);
3887
3947
  }
3888
3948
  }
3889
3949
  /**
@@ -3900,38 +3960,29 @@ class BindingsGenerator {
3900
3960
  const graphqlNames = new Set(graphqlRepos.map((r) => r.typeClassRef.exportedSymbol));
3901
3961
  const conflicts = new Set([...restNames].filter((n) => graphqlNames.has(n)));
3902
3962
  for (const { typeClassRef } of restRepos) {
3903
- if (!("filename" in typeClassRef)) continue;
3904
- const relPath = this.relativeImportPath(coreFile.filename, typeClassRef.filename);
3905
- coreFile.pushTo(
3906
- this.reExportsSymbol,
3907
- code`export { ${typeClassRef.exportedSymbol} } from "${relPath}";`
3908
- );
3963
+ if (!("filename" in typeClassRef) || !typeClassRef.exportedSymbol) continue;
3964
+ coreFile.reExport(typeClassRef);
3909
3965
  }
3910
3966
  for (const { typeClassRef } of graphqlRepos) {
3911
- if (!("filename" in typeClassRef)) continue;
3912
- const relPath = this.relativeImportPath(coreFile.filename, typeClassRef.filename);
3913
- const symbol = typeClassRef.exportedSymbol;
3914
- if (conflicts.has(symbol)) {
3915
- coreFile.pushTo(
3916
- this.reExportsSymbol,
3917
- code`export { ${symbol} as GraphQL_${symbol} } from "${relPath}";`
3918
- );
3919
- } else {
3920
- coreFile.pushTo(
3921
- this.reExportsSymbol,
3922
- code`export { ${symbol} } from "${relPath}";`
3923
- );
3924
- }
3967
+ if (!("filename" in typeClassRef) || !typeClassRef.exportedSymbol) continue;
3968
+ const alias = conflicts.has(typeClassRef.exportedSymbol) ? `GraphQL_${typeClassRef.exportedSymbol}` : void 0;
3969
+ coreFile.reExport(
3970
+ typeClassRef,
3971
+ alias
3972
+ );
3925
3973
  }
3926
3974
  }
3927
3975
  /**
3928
3976
  * Re-exports all generated entity types so custom bindings can reference
3929
3977
  * domain models (e.g. `api_Item`) without importing from internal paths.
3978
+ *
3979
+ * The barrel `types/index.ts` is built incrementally by TypeDefinitionService
3980
+ * as types are generated; we just re-export it from bindings-core.
3981
+ * GraphQL-only specs produce no REST types so the barrel is never created.
3930
3982
  */
3931
3983
  buildEntityTypeReExports(coreFile) {
3932
- if (this.hasRESTNormalization) {
3933
- const relPath = this.relativeImportPath(coreFile.filename, "types/types.ts");
3934
- coreFile.pushTo(this.reExportsSymbol, code`export type * from "${relPath}";`);
3984
+ if (this.services.typeDefinition.hasTypes) {
3985
+ coreFile.reExportTypeAll(TYPES_INDEX_PATH);
3935
3986
  }
3936
3987
  }
3937
3988
  buildTypeInvalidation(typesWithNormalization) {
@@ -13785,6 +13836,8 @@ export {
13785
13836
  NormalizedTypeGenerator,
13786
13837
  SINGLE_FILE,
13787
13838
  SINGLE_FILE_NORMALIZED,
13839
+ TYPES_INDEX_PATH,
13840
+ TYPES_SINGLE_FILE_PATH,
13788
13841
  TYPE_REGISTRY_FILE,
13789
13842
  TypeDefinitionService,
13790
13843
  TypeRegistryGenerator,