From e63af2e8e9c91a15dae8ad20204d5dfafd732c32 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Wed, 21 Jan 2026 11:03:24 +0000 Subject: [PATCH 1/2] fix(graphql-codegen): re-export models and custom operations from index.ts The generated index.ts was importing models but not re-exporting them, breaking backwards compatibility for code that imports models directly: import { DatabaseModel, TableModel } from '@constructive-db/constructive-sdk'; This adds: - export * from './models' to re-export all model classes - export { createQueryOperations } from './query' (when queries exist) - export { createMutationOperations } from './mutation' (when mutations exist) This maintains backwards compatibility while still supporting the new createClient() API. --- .../src/cli/codegen/orm/client-generator.ts | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/graphql/codegen/src/cli/codegen/orm/client-generator.ts b/graphql/codegen/src/cli/codegen/orm/client-generator.ts index 08e3bbf29..c3b61e1b8 100644 --- a/graphql/codegen/src/cli/codegen/orm/client-generator.ts +++ b/graphql/codegen/src/cli/codegen/orm/client-generator.ts @@ -424,6 +424,40 @@ export function generateCreateClientFile( // export * from './select-types'; statements.push(t.exportAllDeclaration(t.stringLiteral('./select-types'))); + // Re-export all models for backwards compatibility + // export * from './models'; + statements.push(t.exportAllDeclaration(t.stringLiteral('./models'))); + + // Re-export custom operations for backwards compatibility + if (hasCustomQueries) { + statements.push( + t.exportNamedDeclaration( + null, + [ + t.exportSpecifier( + t.identifier('createQueryOperations'), + t.identifier('createQueryOperations') + ), + ], + t.stringLiteral('./query') + ) + ); + } + if (hasCustomMutations) { + statements.push( + t.exportNamedDeclaration( + null, + [ + t.exportSpecifier( + t.identifier('createMutationOperations'), + t.identifier('createMutationOperations') + ), + ], + t.stringLiteral('./mutation') + ) + ); + } + // Build the return object properties const returnProperties: t.ObjectProperty[] = []; From fc2077072909d7feb76d1d7c870d1153dfe8a6aa Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Wed, 21 Jan 2026 11:17:06 +0000 Subject: [PATCH 2/2] test: update client-generator snapshots for model re-exports --- .../codegen/__snapshots__/client-generator.test.ts.snap | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/graphql/codegen/src/__tests__/codegen/__snapshots__/client-generator.test.ts.snap b/graphql/codegen/src/__tests__/codegen/__snapshots__/client-generator.test.ts.snap index e9a299087..99468545f 100644 --- a/graphql/codegen/src/__tests__/codegen/__snapshots__/client-generator.test.ts.snap +++ b/graphql/codegen/src/__tests__/codegen/__snapshots__/client-generator.test.ts.snap @@ -14,6 +14,7 @@ export type { OrmClientConfig, QueryResult, GraphQLError } from "./client"; export { GraphQLRequestError } from "./client"; export { QueryBuilder } from "./query-builder"; export * from "./select-types"; +export * from "./models"; /** * Create an ORM client instance * @@ -61,6 +62,9 @@ export type { OrmClientConfig, QueryResult, GraphQLError } from "./client"; export { GraphQLRequestError } from "./client"; export { QueryBuilder } from "./query-builder"; export * from "./select-types"; +export * from "./models"; +export { createQueryOperations } from "./query"; +export { createMutationOperations } from "./mutation"; /** * Create an ORM client instance *