@stryke/prisma-trpc-generator 0.10.4 → 0.10.6

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.
@@ -7611,7 +7611,7 @@ var generateCreateRouterImport = /* @__PURE__ */ __name(({ sourceFile, config })
7611
7611
  }, "generateCreateRouterImport");
7612
7612
  var generateRouterImport = /* @__PURE__ */ __name((sourceFile, modelNamePlural, modelNameCamelCase) => {
7613
7613
  sourceFile.addImportDeclaration({
7614
- moduleSpecifier: `./${modelNameCamelCase}.router`,
7614
+ moduleSpecifier: `./${lowerCaseFirst(modelNameCamelCase)}.router`,
7615
7615
  namedImports: [
7616
7616
  `${modelNamePlural}Router`
7617
7617
  ]
@@ -7777,7 +7777,7 @@ __name(generateRouterSchemaImports, "generateRouterSchemaImports");
7777
7777
  var getRouterSchemaImportByOpName = /* @__PURE__ */ __name((opName, modelName) => {
7778
7778
  const opType = opName.replace("OrThrow", "").replace("ManyAndReturn", "");
7779
7779
  const inputType = getInputTypeByOpName(opType, modelName);
7780
- return inputType ? `import { ${inputType} } from "../schemas/${opType}${modelName}.schema"; ` : "";
7780
+ return inputType ? `import { ${lowerCaseFirst(inputType)} } from "../schemas/${lowerCaseFirst(opType)}${modelName}.schema"; ` : "";
7781
7781
  }, "getRouterSchemaImportByOpName");
7782
7782
  var getInputTypeByOpName = /* @__PURE__ */ __name((opName, modelName) => {
7783
7783
  let inputType;
@@ -10644,8 +10644,8 @@ var Transformer = class _Transformer {
10644
10644
  hasJson = false;
10645
10645
  static prismaClientOutputPath = "@prisma/client";
10646
10646
  static isCustomPrismaClientOutputPath = false;
10647
- static isGenerateSelect = false;
10648
- static isGenerateInclude = false;
10647
+ static isGenerateSelect = true;
10648
+ static isGenerateInclude = true;
10649
10649
  constructor(params) {
10650
10650
  this.name = params.name ?? "";
10651
10651
  this.fields = params.fields ?? [];
@@ -10677,21 +10677,21 @@ var Transformer = class _Transformer {
10677
10677
  async generateEnumSchemas() {
10678
10678
  for (const enumType2 of this.enumTypes) {
10679
10679
  const { name, values } = enumType2;
10680
- await writeFileSafely(import_node_path4.default.join(_Transformer.outputPath, `schemas/enums/${name}.schema.ts`), `${this.generateImportZodStatement()}
10681
- ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)})`)}`);
10680
+ await writeFileSafely(import_node_path4.default.join(_Transformer.outputPath, `schemas/enums/${lowerCaseFirst(name)}.schema.ts`), `${this.generateImportZodStatement()}
10681
+ ${this.generateExportSchemaStatement(`${lowerCaseFirst(name)}`, `z.enum(${JSON.stringify(values)})`)}`);
10682
10682
  }
10683
10683
  }
10684
10684
  generateImportZodStatement() {
10685
10685
  return "import { z } from 'zod';\n";
10686
10686
  }
10687
10687
  generateExportSchemaStatement(name, schema) {
10688
- return `export const ${name}Schema = ${schema}`;
10688
+ return `export const ${lowerCaseFirst(name)}Schema = ${schema}`;
10689
10689
  }
10690
10690
  async generateObjectSchema() {
10691
10691
  const zodObjectSchemaFields = this.generateObjectSchemaFields();
10692
10692
  const objectSchema = this.prepareObjectSchema(zodObjectSchemaFields);
10693
10693
  const objectSchemaName = this.resolveObjectSchemaName();
10694
- await writeFileSafely(import_node_path4.default.join(_Transformer.outputPath, `schemas/objects/${objectSchemaName}.schema.ts`), objectSchema);
10694
+ await writeFileSafely(import_node_path4.default.join(_Transformer.outputPath, `schemas/objects/${lowerCaseFirst(objectSchemaName)}.schema.ts`), objectSchema);
10695
10695
  }
10696
10696
  generateObjectSchemaFields() {
10697
10697
  const zodObjectSchemaFields = this.fields.map((field) => this.generateObjectSchemaField(field)).flatMap((item) => item).map((item) => {
@@ -10779,7 +10779,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10779
10779
  const arr = inputType.isList ? ".array()" : "";
10780
10780
  const opt = !field.isRequired ? ".optional()" : "";
10781
10781
  const nullable = field.inputTypes.length > 1 && field.inputTypes[1]?.type === "Null" ? ".nullable()" : "";
10782
- return inputsLength === 1 ? ` ${field.name}: z.lazy(() => ${schema})${arr}${opt}${nullable}` : `z.lazy(() => ${schema})${arr}${opt}${nullable}`;
10782
+ return inputsLength === 1 ? ` ${field.name}: z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}${nullable}` : `z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}${nullable}`;
10783
10783
  }
10784
10784
  generateFieldValidators(zodStringWithMainType, field) {
10785
10785
  const { isRequired, isNullable } = field;
@@ -10812,8 +10812,8 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10812
10812
  if (isAggregateInputType(name)) {
10813
10813
  name = `${name}Type`;
10814
10814
  }
10815
- const end = `export const ${exportName}ObjectSchema = Schema`;
10816
- return `const Schema: z.ZodType<Prisma.${name}> = ${schema};
10815
+ const end = `export const ${lowerCaseFirst(exportName)}ObjectSchema = schema`;
10816
+ return `const schema: z.ZodType<Prisma.${name}> = ${schema};
10817
10817
 
10818
10818
  ${end}`;
10819
10819
  }
@@ -10868,9 +10868,9 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10868
10868
  if (isModelQueryType) {
10869
10869
  return `import { ${this.resolveModelQuerySchemaName(modelName, queryName)} } from '../${queryName}${modelName}.schema'`;
10870
10870
  } else if (_Transformer.enumNames.includes(name)) {
10871
- return `import { ${name}Schema } from '../enums/${name}.schema'`;
10871
+ return `import { ${lowerCaseFirst(name)}Schema } from '../enums/${lowerCaseFirst(name)}.schema'`;
10872
10872
  } else {
10873
- return `import { ${name}ObjectSchema } from './${name}.schema'`;
10873
+ return `import { ${lowerCaseFirst(name)}ObjectSchema } from './${lowerCaseFirst(name)}.schema'`;
10874
10874
  }
10875
10875
  }).join(";\r\n");
10876
10876
  }
@@ -10895,9 +10895,9 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10895
10895
  };
10896
10896
  }
10897
10897
  resolveModelQuerySchemaName(modelName, queryName) {
10898
- const modelNameCapitalized = upperCaseFirst(modelName);
10898
+ const modelNameUncapitalized = lowerCaseFirst(modelName);
10899
10899
  const queryNameCapitalized = upperCaseFirst(queryName);
10900
- return `${modelNameCapitalized}${queryNameCapitalized}Schema`;
10900
+ return `${modelNameUncapitalized}${queryNameCapitalized}Schema`;
10901
10901
  }
10902
10902
  wrapWithZodUnion(zodStringFields) {
10903
10903
  let wrapped = "";
@@ -10924,12 +10924,11 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10924
10924
  name = _Transformer.rawOpsMap[name];
10925
10925
  exportName = name.replace("Args", "");
10926
10926
  }
10927
- return exportName;
10927
+ return lowerCaseFirst(exportName);
10928
10928
  }
10929
10929
  async generateModelSchemas() {
10930
10930
  for (const modelOperation of this.modelOperations) {
10931
10931
  const {
10932
- model: modelName,
10933
10932
  findUnique,
10934
10933
  findFirst,
10935
10934
  findMany,
@@ -10949,7 +10948,8 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10949
10948
  aggregate,
10950
10949
  groupBy
10951
10950
  } = modelOperation;
10952
- const model = findModelByName(this.models, modelName);
10951
+ const model = findModelByName(this.models, modelOperation.model);
10952
+ const modelName = lowerCaseFirst(modelOperation.model);
10953
10953
  const { selectImport, includeImport, selectZodSchemaLine, includeZodSchemaLine, selectZodSchemaLineLazy, includeZodSchemaLineLazy } = this.resolveSelectIncludeImportAndZodSchemaLine(model);
10954
10954
  const { orderByImport, orderByZodSchemaLine } = this.resolveOrderByWithRelationImportAndZodSchemaLine(model);
10955
10955
  if (findUnique) {
@@ -11103,19 +11103,19 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
11103
11103
  resolveSelectIncludeImportAndZodSchemaLine(model) {
11104
11104
  const { name: modelName } = model;
11105
11105
  const hasRelationToAnotherModel = checkModelHasModelRelation(model);
11106
- const selectImport = _Transformer.isGenerateSelect ? `import { ${modelName}SelectObjectSchema } from './objects/${modelName}Select.schema'` : "";
11107
- const includeImport = _Transformer.isGenerateInclude && hasRelationToAnotherModel ? `import { ${modelName}IncludeObjectSchema } from './objects/${modelName}Include.schema'` : "";
11106
+ const selectImport = _Transformer.isGenerateSelect ? `import { ${lowerCaseFirst(modelName)}SelectObjectSchema } from './objects/${lowerCaseFirst(modelName)}Select.schema'` : "";
11107
+ const includeImport = _Transformer.isGenerateInclude && hasRelationToAnotherModel ? `import { ${lowerCaseFirst(modelName)}IncludeObjectSchema } from './objects/${lowerCaseFirst(modelName)}Include.schema'` : "";
11108
11108
  let selectZodSchemaLine = "";
11109
11109
  let includeZodSchemaLine = "";
11110
11110
  let selectZodSchemaLineLazy = "";
11111
11111
  let includeZodSchemaLineLazy = "";
11112
11112
  if (_Transformer.isGenerateSelect) {
11113
- const zodSelectObjectSchema = `${modelName}SelectObjectSchema.optional()`;
11113
+ const zodSelectObjectSchema = `${lowerCaseFirst(modelName)}SelectObjectSchema.optional()`;
11114
11114
  selectZodSchemaLine = `select: ${zodSelectObjectSchema},`;
11115
11115
  selectZodSchemaLineLazy = `select: z.lazy(() => ${zodSelectObjectSchema}),`;
11116
11116
  }
11117
11117
  if (_Transformer.isGenerateInclude && hasRelationToAnotherModel) {
11118
- const zodIncludeObjectSchema = `${modelName}IncludeObjectSchema.optional()`;
11118
+ const zodIncludeObjectSchema = `${lowerCaseFirst(modelName)}IncludeObjectSchema.optional()`;
11119
11119
  includeZodSchemaLine = `include: ${zodIncludeObjectSchema},`;
11120
11120
  includeZodSchemaLineLazy = `include: z.lazy(() => ${zodIncludeObjectSchema}),`;
11121
11121
  }
@@ -11135,9 +11135,9 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
11135
11135
  "postgresql",
11136
11136
  "mysql"
11137
11137
  ].includes(_Transformer.provider) && _Transformer.previewFeatures?.includes("fullTextSearch")) {
11138
- modelOrderBy = `${modelName}OrderByWithRelationAndSearchRelevanceInput`;
11138
+ modelOrderBy = `${lowerCaseFirst(modelName)}OrderByWithRelationAndSearchRelevanceInput`;
11139
11139
  } else {
11140
- modelOrderBy = `${modelName}OrderByWithRelationInput`;
11140
+ modelOrderBy = `${lowerCaseFirst(modelName)}OrderByWithRelationInput`;
11141
11141
  }
11142
11142
  const orderByImport = `import { ${modelOrderBy}ObjectSchema } from './objects/${modelOrderBy}.schema'`;
11143
11143
  const orderByZodSchemaLine = `orderBy: z.union([${modelOrderBy}ObjectSchema, ${modelOrderBy}ObjectSchema.array()]).optional(),`;
@@ -11681,7 +11681,7 @@ ${JSON.stringify(config)}`);
11681
11681
  const plural = (0, import_pluralize.default)(lowerCaseFirst(model));
11682
11682
  consoleLog(`Generating tRPC router for model ${model}`);
11683
11683
  generateRouterImport(appRouter, plural, model);
11684
- const modelRouter = project.createSourceFile(import_node_path5.default.resolve(outputDir, "routers", `${model}.router.ts`), void 0, {
11684
+ const modelRouter = project.createSourceFile(import_node_path5.default.resolve(outputDir, "routers", `${lowerCaseFirst(model)}.router.ts`), void 0, {
11685
11685
  overwrite: true
11686
11686
  });
11687
11687
  generateCreateRouterImport({
package/dist/generator.js CHANGED
@@ -7616,7 +7616,7 @@ var generateCreateRouterImport = /* @__PURE__ */ __name(({ sourceFile, config })
7616
7616
  }, "generateCreateRouterImport");
7617
7617
  var generateRouterImport = /* @__PURE__ */ __name((sourceFile, modelNamePlural, modelNameCamelCase) => {
7618
7618
  sourceFile.addImportDeclaration({
7619
- moduleSpecifier: `./${modelNameCamelCase}.router`,
7619
+ moduleSpecifier: `./${lowerCaseFirst(modelNameCamelCase)}.router`,
7620
7620
  namedImports: [
7621
7621
  `${modelNamePlural}Router`
7622
7622
  ]
@@ -7782,7 +7782,7 @@ __name(generateRouterSchemaImports, "generateRouterSchemaImports");
7782
7782
  var getRouterSchemaImportByOpName = /* @__PURE__ */ __name((opName, modelName) => {
7783
7783
  const opType = opName.replace("OrThrow", "").replace("ManyAndReturn", "");
7784
7784
  const inputType = getInputTypeByOpName(opType, modelName);
7785
- return inputType ? `import { ${inputType} } from "../schemas/${opType}${modelName}.schema"; ` : "";
7785
+ return inputType ? `import { ${lowerCaseFirst(inputType)} } from "../schemas/${lowerCaseFirst(opType)}${modelName}.schema"; ` : "";
7786
7786
  }, "getRouterSchemaImportByOpName");
7787
7787
  var getInputTypeByOpName = /* @__PURE__ */ __name((opName, modelName) => {
7788
7788
  let inputType;
@@ -10649,8 +10649,8 @@ var Transformer = class _Transformer {
10649
10649
  hasJson = false;
10650
10650
  static prismaClientOutputPath = "@prisma/client";
10651
10651
  static isCustomPrismaClientOutputPath = false;
10652
- static isGenerateSelect = false;
10653
- static isGenerateInclude = false;
10652
+ static isGenerateSelect = true;
10653
+ static isGenerateInclude = true;
10654
10654
  constructor(params) {
10655
10655
  this.name = params.name ?? "";
10656
10656
  this.fields = params.fields ?? [];
@@ -10682,21 +10682,21 @@ var Transformer = class _Transformer {
10682
10682
  async generateEnumSchemas() {
10683
10683
  for (const enumType2 of this.enumTypes) {
10684
10684
  const { name, values } = enumType2;
10685
- await writeFileSafely(path3.join(_Transformer.outputPath, `schemas/enums/${name}.schema.ts`), `${this.generateImportZodStatement()}
10686
- ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)})`)}`);
10685
+ await writeFileSafely(path3.join(_Transformer.outputPath, `schemas/enums/${lowerCaseFirst(name)}.schema.ts`), `${this.generateImportZodStatement()}
10686
+ ${this.generateExportSchemaStatement(`${lowerCaseFirst(name)}`, `z.enum(${JSON.stringify(values)})`)}`);
10687
10687
  }
10688
10688
  }
10689
10689
  generateImportZodStatement() {
10690
10690
  return "import { z } from 'zod';\n";
10691
10691
  }
10692
10692
  generateExportSchemaStatement(name, schema) {
10693
- return `export const ${name}Schema = ${schema}`;
10693
+ return `export const ${lowerCaseFirst(name)}Schema = ${schema}`;
10694
10694
  }
10695
10695
  async generateObjectSchema() {
10696
10696
  const zodObjectSchemaFields = this.generateObjectSchemaFields();
10697
10697
  const objectSchema = this.prepareObjectSchema(zodObjectSchemaFields);
10698
10698
  const objectSchemaName = this.resolveObjectSchemaName();
10699
- await writeFileSafely(path3.join(_Transformer.outputPath, `schemas/objects/${objectSchemaName}.schema.ts`), objectSchema);
10699
+ await writeFileSafely(path3.join(_Transformer.outputPath, `schemas/objects/${lowerCaseFirst(objectSchemaName)}.schema.ts`), objectSchema);
10700
10700
  }
10701
10701
  generateObjectSchemaFields() {
10702
10702
  const zodObjectSchemaFields = this.fields.map((field) => this.generateObjectSchemaField(field)).flatMap((item) => item).map((item) => {
@@ -10784,7 +10784,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10784
10784
  const arr = inputType.isList ? ".array()" : "";
10785
10785
  const opt = !field.isRequired ? ".optional()" : "";
10786
10786
  const nullable = field.inputTypes.length > 1 && field.inputTypes[1]?.type === "Null" ? ".nullable()" : "";
10787
- return inputsLength === 1 ? ` ${field.name}: z.lazy(() => ${schema})${arr}${opt}${nullable}` : `z.lazy(() => ${schema})${arr}${opt}${nullable}`;
10787
+ return inputsLength === 1 ? ` ${field.name}: z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}${nullable}` : `z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}${nullable}`;
10788
10788
  }
10789
10789
  generateFieldValidators(zodStringWithMainType, field) {
10790
10790
  const { isRequired, isNullable } = field;
@@ -10817,8 +10817,8 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10817
10817
  if (isAggregateInputType(name)) {
10818
10818
  name = `${name}Type`;
10819
10819
  }
10820
- const end = `export const ${exportName}ObjectSchema = Schema`;
10821
- return `const Schema: z.ZodType<Prisma.${name}> = ${schema};
10820
+ const end = `export const ${lowerCaseFirst(exportName)}ObjectSchema = schema`;
10821
+ return `const schema: z.ZodType<Prisma.${name}> = ${schema};
10822
10822
 
10823
10823
  ${end}`;
10824
10824
  }
@@ -10873,9 +10873,9 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10873
10873
  if (isModelQueryType) {
10874
10874
  return `import { ${this.resolveModelQuerySchemaName(modelName, queryName)} } from '../${queryName}${modelName}.schema'`;
10875
10875
  } else if (_Transformer.enumNames.includes(name)) {
10876
- return `import { ${name}Schema } from '../enums/${name}.schema'`;
10876
+ return `import { ${lowerCaseFirst(name)}Schema } from '../enums/${lowerCaseFirst(name)}.schema'`;
10877
10877
  } else {
10878
- return `import { ${name}ObjectSchema } from './${name}.schema'`;
10878
+ return `import { ${lowerCaseFirst(name)}ObjectSchema } from './${lowerCaseFirst(name)}.schema'`;
10879
10879
  }
10880
10880
  }).join(";\r\n");
10881
10881
  }
@@ -10900,9 +10900,9 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10900
10900
  };
10901
10901
  }
10902
10902
  resolveModelQuerySchemaName(modelName, queryName) {
10903
- const modelNameCapitalized = upperCaseFirst(modelName);
10903
+ const modelNameUncapitalized = lowerCaseFirst(modelName);
10904
10904
  const queryNameCapitalized = upperCaseFirst(queryName);
10905
- return `${modelNameCapitalized}${queryNameCapitalized}Schema`;
10905
+ return `${modelNameUncapitalized}${queryNameCapitalized}Schema`;
10906
10906
  }
10907
10907
  wrapWithZodUnion(zodStringFields) {
10908
10908
  let wrapped = "";
@@ -10929,12 +10929,11 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10929
10929
  name = _Transformer.rawOpsMap[name];
10930
10930
  exportName = name.replace("Args", "");
10931
10931
  }
10932
- return exportName;
10932
+ return lowerCaseFirst(exportName);
10933
10933
  }
10934
10934
  async generateModelSchemas() {
10935
10935
  for (const modelOperation of this.modelOperations) {
10936
10936
  const {
10937
- model: modelName,
10938
10937
  findUnique,
10939
10938
  findFirst,
10940
10939
  findMany,
@@ -10954,7 +10953,8 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10954
10953
  aggregate,
10955
10954
  groupBy
10956
10955
  } = modelOperation;
10957
- const model = findModelByName(this.models, modelName);
10956
+ const model = findModelByName(this.models, modelOperation.model);
10957
+ const modelName = lowerCaseFirst(modelOperation.model);
10958
10958
  const { selectImport, includeImport, selectZodSchemaLine, includeZodSchemaLine, selectZodSchemaLineLazy, includeZodSchemaLineLazy } = this.resolveSelectIncludeImportAndZodSchemaLine(model);
10959
10959
  const { orderByImport, orderByZodSchemaLine } = this.resolveOrderByWithRelationImportAndZodSchemaLine(model);
10960
10960
  if (findUnique) {
@@ -11108,19 +11108,19 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
11108
11108
  resolveSelectIncludeImportAndZodSchemaLine(model) {
11109
11109
  const { name: modelName } = model;
11110
11110
  const hasRelationToAnotherModel = checkModelHasModelRelation(model);
11111
- const selectImport = _Transformer.isGenerateSelect ? `import { ${modelName}SelectObjectSchema } from './objects/${modelName}Select.schema'` : "";
11112
- const includeImport = _Transformer.isGenerateInclude && hasRelationToAnotherModel ? `import { ${modelName}IncludeObjectSchema } from './objects/${modelName}Include.schema'` : "";
11111
+ const selectImport = _Transformer.isGenerateSelect ? `import { ${lowerCaseFirst(modelName)}SelectObjectSchema } from './objects/${lowerCaseFirst(modelName)}Select.schema'` : "";
11112
+ const includeImport = _Transformer.isGenerateInclude && hasRelationToAnotherModel ? `import { ${lowerCaseFirst(modelName)}IncludeObjectSchema } from './objects/${lowerCaseFirst(modelName)}Include.schema'` : "";
11113
11113
  let selectZodSchemaLine = "";
11114
11114
  let includeZodSchemaLine = "";
11115
11115
  let selectZodSchemaLineLazy = "";
11116
11116
  let includeZodSchemaLineLazy = "";
11117
11117
  if (_Transformer.isGenerateSelect) {
11118
- const zodSelectObjectSchema = `${modelName}SelectObjectSchema.optional()`;
11118
+ const zodSelectObjectSchema = `${lowerCaseFirst(modelName)}SelectObjectSchema.optional()`;
11119
11119
  selectZodSchemaLine = `select: ${zodSelectObjectSchema},`;
11120
11120
  selectZodSchemaLineLazy = `select: z.lazy(() => ${zodSelectObjectSchema}),`;
11121
11121
  }
11122
11122
  if (_Transformer.isGenerateInclude && hasRelationToAnotherModel) {
11123
- const zodIncludeObjectSchema = `${modelName}IncludeObjectSchema.optional()`;
11123
+ const zodIncludeObjectSchema = `${lowerCaseFirst(modelName)}IncludeObjectSchema.optional()`;
11124
11124
  includeZodSchemaLine = `include: ${zodIncludeObjectSchema},`;
11125
11125
  includeZodSchemaLineLazy = `include: z.lazy(() => ${zodIncludeObjectSchema}),`;
11126
11126
  }
@@ -11140,9 +11140,9 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
11140
11140
  "postgresql",
11141
11141
  "mysql"
11142
11142
  ].includes(_Transformer.provider) && _Transformer.previewFeatures?.includes("fullTextSearch")) {
11143
- modelOrderBy = `${modelName}OrderByWithRelationAndSearchRelevanceInput`;
11143
+ modelOrderBy = `${lowerCaseFirst(modelName)}OrderByWithRelationAndSearchRelevanceInput`;
11144
11144
  } else {
11145
- modelOrderBy = `${modelName}OrderByWithRelationInput`;
11145
+ modelOrderBy = `${lowerCaseFirst(modelName)}OrderByWithRelationInput`;
11146
11146
  }
11147
11147
  const orderByImport = `import { ${modelOrderBy}ObjectSchema } from './objects/${modelOrderBy}.schema'`;
11148
11148
  const orderByZodSchemaLine = `orderBy: z.union([${modelOrderBy}ObjectSchema, ${modelOrderBy}ObjectSchema.array()]).optional(),`;
@@ -11686,7 +11686,7 @@ ${JSON.stringify(config)}`);
11686
11686
  const plural = (0, import_pluralize.default)(lowerCaseFirst(model));
11687
11687
  consoleLog(`Generating tRPC router for model ${model}`);
11688
11688
  generateRouterImport(appRouter, plural, model);
11689
- const modelRouter = project.createSourceFile(path4.resolve(outputDir, "routers", `${model}.router.ts`), void 0, {
11689
+ const modelRouter = project.createSourceFile(path4.resolve(outputDir, "routers", `${lowerCaseFirst(model)}.router.ts`), void 0, {
11690
11690
  overwrite: true
11691
11691
  });
11692
11692
  generateCreateRouterImport({
package/dist/index.cjs CHANGED
@@ -7607,7 +7607,7 @@ var generateCreateRouterImport = /* @__PURE__ */ __name(({ sourceFile, config })
7607
7607
  }, "generateCreateRouterImport");
7608
7608
  var generateRouterImport = /* @__PURE__ */ __name((sourceFile, modelNamePlural, modelNameCamelCase) => {
7609
7609
  sourceFile.addImportDeclaration({
7610
- moduleSpecifier: `./${modelNameCamelCase}.router`,
7610
+ moduleSpecifier: `./${lowerCaseFirst(modelNameCamelCase)}.router`,
7611
7611
  namedImports: [
7612
7612
  `${modelNamePlural}Router`
7613
7613
  ]
@@ -7773,7 +7773,7 @@ __name(generateRouterSchemaImports, "generateRouterSchemaImports");
7773
7773
  var getRouterSchemaImportByOpName = /* @__PURE__ */ __name((opName, modelName) => {
7774
7774
  const opType = opName.replace("OrThrow", "").replace("ManyAndReturn", "");
7775
7775
  const inputType = getInputTypeByOpName(opType, modelName);
7776
- return inputType ? `import { ${inputType} } from "../schemas/${opType}${modelName}.schema"; ` : "";
7776
+ return inputType ? `import { ${lowerCaseFirst(inputType)} } from "../schemas/${lowerCaseFirst(opType)}${modelName}.schema"; ` : "";
7777
7777
  }, "getRouterSchemaImportByOpName");
7778
7778
  var getInputTypeByOpName = /* @__PURE__ */ __name((opName, modelName) => {
7779
7779
  let inputType;
@@ -10640,8 +10640,8 @@ var Transformer = class _Transformer {
10640
10640
  hasJson = false;
10641
10641
  static prismaClientOutputPath = "@prisma/client";
10642
10642
  static isCustomPrismaClientOutputPath = false;
10643
- static isGenerateSelect = false;
10644
- static isGenerateInclude = false;
10643
+ static isGenerateSelect = true;
10644
+ static isGenerateInclude = true;
10645
10645
  constructor(params) {
10646
10646
  this.name = params.name ?? "";
10647
10647
  this.fields = params.fields ?? [];
@@ -10673,21 +10673,21 @@ var Transformer = class _Transformer {
10673
10673
  async generateEnumSchemas() {
10674
10674
  for (const enumType2 of this.enumTypes) {
10675
10675
  const { name, values } = enumType2;
10676
- await writeFileSafely(import_node_path4.default.join(_Transformer.outputPath, `schemas/enums/${name}.schema.ts`), `${this.generateImportZodStatement()}
10677
- ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)})`)}`);
10676
+ await writeFileSafely(import_node_path4.default.join(_Transformer.outputPath, `schemas/enums/${lowerCaseFirst(name)}.schema.ts`), `${this.generateImportZodStatement()}
10677
+ ${this.generateExportSchemaStatement(`${lowerCaseFirst(name)}`, `z.enum(${JSON.stringify(values)})`)}`);
10678
10678
  }
10679
10679
  }
10680
10680
  generateImportZodStatement() {
10681
10681
  return "import { z } from 'zod';\n";
10682
10682
  }
10683
10683
  generateExportSchemaStatement(name, schema) {
10684
- return `export const ${name}Schema = ${schema}`;
10684
+ return `export const ${lowerCaseFirst(name)}Schema = ${schema}`;
10685
10685
  }
10686
10686
  async generateObjectSchema() {
10687
10687
  const zodObjectSchemaFields = this.generateObjectSchemaFields();
10688
10688
  const objectSchema = this.prepareObjectSchema(zodObjectSchemaFields);
10689
10689
  const objectSchemaName = this.resolveObjectSchemaName();
10690
- await writeFileSafely(import_node_path4.default.join(_Transformer.outputPath, `schemas/objects/${objectSchemaName}.schema.ts`), objectSchema);
10690
+ await writeFileSafely(import_node_path4.default.join(_Transformer.outputPath, `schemas/objects/${lowerCaseFirst(objectSchemaName)}.schema.ts`), objectSchema);
10691
10691
  }
10692
10692
  generateObjectSchemaFields() {
10693
10693
  const zodObjectSchemaFields = this.fields.map((field) => this.generateObjectSchemaField(field)).flatMap((item) => item).map((item) => {
@@ -10775,7 +10775,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10775
10775
  const arr = inputType.isList ? ".array()" : "";
10776
10776
  const opt = !field.isRequired ? ".optional()" : "";
10777
10777
  const nullable = field.inputTypes.length > 1 && field.inputTypes[1]?.type === "Null" ? ".nullable()" : "";
10778
- return inputsLength === 1 ? ` ${field.name}: z.lazy(() => ${schema})${arr}${opt}${nullable}` : `z.lazy(() => ${schema})${arr}${opt}${nullable}`;
10778
+ return inputsLength === 1 ? ` ${field.name}: z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}${nullable}` : `z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}${nullable}`;
10779
10779
  }
10780
10780
  generateFieldValidators(zodStringWithMainType, field) {
10781
10781
  const { isRequired, isNullable } = field;
@@ -10808,8 +10808,8 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10808
10808
  if (isAggregateInputType(name)) {
10809
10809
  name = `${name}Type`;
10810
10810
  }
10811
- const end = `export const ${exportName}ObjectSchema = Schema`;
10812
- return `const Schema: z.ZodType<Prisma.${name}> = ${schema};
10811
+ const end = `export const ${lowerCaseFirst(exportName)}ObjectSchema = schema`;
10812
+ return `const schema: z.ZodType<Prisma.${name}> = ${schema};
10813
10813
 
10814
10814
  ${end}`;
10815
10815
  }
@@ -10864,9 +10864,9 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10864
10864
  if (isModelQueryType) {
10865
10865
  return `import { ${this.resolveModelQuerySchemaName(modelName, queryName)} } from '../${queryName}${modelName}.schema'`;
10866
10866
  } else if (_Transformer.enumNames.includes(name)) {
10867
- return `import { ${name}Schema } from '../enums/${name}.schema'`;
10867
+ return `import { ${lowerCaseFirst(name)}Schema } from '../enums/${lowerCaseFirst(name)}.schema'`;
10868
10868
  } else {
10869
- return `import { ${name}ObjectSchema } from './${name}.schema'`;
10869
+ return `import { ${lowerCaseFirst(name)}ObjectSchema } from './${lowerCaseFirst(name)}.schema'`;
10870
10870
  }
10871
10871
  }).join(";\r\n");
10872
10872
  }
@@ -10891,9 +10891,9 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10891
10891
  };
10892
10892
  }
10893
10893
  resolveModelQuerySchemaName(modelName, queryName) {
10894
- const modelNameCapitalized = upperCaseFirst(modelName);
10894
+ const modelNameUncapitalized = lowerCaseFirst(modelName);
10895
10895
  const queryNameCapitalized = upperCaseFirst(queryName);
10896
- return `${modelNameCapitalized}${queryNameCapitalized}Schema`;
10896
+ return `${modelNameUncapitalized}${queryNameCapitalized}Schema`;
10897
10897
  }
10898
10898
  wrapWithZodUnion(zodStringFields) {
10899
10899
  let wrapped = "";
@@ -10920,12 +10920,11 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10920
10920
  name = _Transformer.rawOpsMap[name];
10921
10921
  exportName = name.replace("Args", "");
10922
10922
  }
10923
- return exportName;
10923
+ return lowerCaseFirst(exportName);
10924
10924
  }
10925
10925
  async generateModelSchemas() {
10926
10926
  for (const modelOperation of this.modelOperations) {
10927
10927
  const {
10928
- model: modelName,
10929
10928
  findUnique,
10930
10929
  findFirst,
10931
10930
  findMany,
@@ -10945,7 +10944,8 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10945
10944
  aggregate,
10946
10945
  groupBy
10947
10946
  } = modelOperation;
10948
- const model = findModelByName(this.models, modelName);
10947
+ const model = findModelByName(this.models, modelOperation.model);
10948
+ const modelName = lowerCaseFirst(modelOperation.model);
10949
10949
  const { selectImport, includeImport, selectZodSchemaLine, includeZodSchemaLine, selectZodSchemaLineLazy, includeZodSchemaLineLazy } = this.resolveSelectIncludeImportAndZodSchemaLine(model);
10950
10950
  const { orderByImport, orderByZodSchemaLine } = this.resolveOrderByWithRelationImportAndZodSchemaLine(model);
10951
10951
  if (findUnique) {
@@ -11099,19 +11099,19 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
11099
11099
  resolveSelectIncludeImportAndZodSchemaLine(model) {
11100
11100
  const { name: modelName } = model;
11101
11101
  const hasRelationToAnotherModel = checkModelHasModelRelation(model);
11102
- const selectImport = _Transformer.isGenerateSelect ? `import { ${modelName}SelectObjectSchema } from './objects/${modelName}Select.schema'` : "";
11103
- const includeImport = _Transformer.isGenerateInclude && hasRelationToAnotherModel ? `import { ${modelName}IncludeObjectSchema } from './objects/${modelName}Include.schema'` : "";
11102
+ const selectImport = _Transformer.isGenerateSelect ? `import { ${lowerCaseFirst(modelName)}SelectObjectSchema } from './objects/${lowerCaseFirst(modelName)}Select.schema'` : "";
11103
+ const includeImport = _Transformer.isGenerateInclude && hasRelationToAnotherModel ? `import { ${lowerCaseFirst(modelName)}IncludeObjectSchema } from './objects/${lowerCaseFirst(modelName)}Include.schema'` : "";
11104
11104
  let selectZodSchemaLine = "";
11105
11105
  let includeZodSchemaLine = "";
11106
11106
  let selectZodSchemaLineLazy = "";
11107
11107
  let includeZodSchemaLineLazy = "";
11108
11108
  if (_Transformer.isGenerateSelect) {
11109
- const zodSelectObjectSchema = `${modelName}SelectObjectSchema.optional()`;
11109
+ const zodSelectObjectSchema = `${lowerCaseFirst(modelName)}SelectObjectSchema.optional()`;
11110
11110
  selectZodSchemaLine = `select: ${zodSelectObjectSchema},`;
11111
11111
  selectZodSchemaLineLazy = `select: z.lazy(() => ${zodSelectObjectSchema}),`;
11112
11112
  }
11113
11113
  if (_Transformer.isGenerateInclude && hasRelationToAnotherModel) {
11114
- const zodIncludeObjectSchema = `${modelName}IncludeObjectSchema.optional()`;
11114
+ const zodIncludeObjectSchema = `${lowerCaseFirst(modelName)}IncludeObjectSchema.optional()`;
11115
11115
  includeZodSchemaLine = `include: ${zodIncludeObjectSchema},`;
11116
11116
  includeZodSchemaLineLazy = `include: z.lazy(() => ${zodIncludeObjectSchema}),`;
11117
11117
  }
@@ -11131,9 +11131,9 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
11131
11131
  "postgresql",
11132
11132
  "mysql"
11133
11133
  ].includes(_Transformer.provider) && _Transformer.previewFeatures?.includes("fullTextSearch")) {
11134
- modelOrderBy = `${modelName}OrderByWithRelationAndSearchRelevanceInput`;
11134
+ modelOrderBy = `${lowerCaseFirst(modelName)}OrderByWithRelationAndSearchRelevanceInput`;
11135
11135
  } else {
11136
- modelOrderBy = `${modelName}OrderByWithRelationInput`;
11136
+ modelOrderBy = `${lowerCaseFirst(modelName)}OrderByWithRelationInput`;
11137
11137
  }
11138
11138
  const orderByImport = `import { ${modelOrderBy}ObjectSchema } from './objects/${modelOrderBy}.schema'`;
11139
11139
  const orderByZodSchemaLine = `orderBy: z.union([${modelOrderBy}ObjectSchema, ${modelOrderBy}ObjectSchema.array()]).optional(),`;
@@ -11677,7 +11677,7 @@ ${JSON.stringify(config)}`);
11677
11677
  const plural = (0, import_pluralize.default)(lowerCaseFirst(model));
11678
11678
  consoleLog(`Generating tRPC router for model ${model}`);
11679
11679
  generateRouterImport(appRouter, plural, model);
11680
- const modelRouter = project.createSourceFile(import_node_path5.default.resolve(outputDir, "routers", `${model}.router.ts`), void 0, {
11680
+ const modelRouter = project.createSourceFile(import_node_path5.default.resolve(outputDir, "routers", `${lowerCaseFirst(model)}.router.ts`), void 0, {
11681
11681
  overwrite: true
11682
11682
  });
11683
11683
  generateCreateRouterImport({
package/dist/index.js CHANGED
@@ -7612,7 +7612,7 @@ var generateCreateRouterImport = /* @__PURE__ */ __name(({ sourceFile, config })
7612
7612
  }, "generateCreateRouterImport");
7613
7613
  var generateRouterImport = /* @__PURE__ */ __name((sourceFile, modelNamePlural, modelNameCamelCase) => {
7614
7614
  sourceFile.addImportDeclaration({
7615
- moduleSpecifier: `./${modelNameCamelCase}.router`,
7615
+ moduleSpecifier: `./${lowerCaseFirst(modelNameCamelCase)}.router`,
7616
7616
  namedImports: [
7617
7617
  `${modelNamePlural}Router`
7618
7618
  ]
@@ -7778,7 +7778,7 @@ __name(generateRouterSchemaImports, "generateRouterSchemaImports");
7778
7778
  var getRouterSchemaImportByOpName = /* @__PURE__ */ __name((opName, modelName) => {
7779
7779
  const opType = opName.replace("OrThrow", "").replace("ManyAndReturn", "");
7780
7780
  const inputType = getInputTypeByOpName(opType, modelName);
7781
- return inputType ? `import { ${inputType} } from "../schemas/${opType}${modelName}.schema"; ` : "";
7781
+ return inputType ? `import { ${lowerCaseFirst(inputType)} } from "../schemas/${lowerCaseFirst(opType)}${modelName}.schema"; ` : "";
7782
7782
  }, "getRouterSchemaImportByOpName");
7783
7783
  var getInputTypeByOpName = /* @__PURE__ */ __name((opName, modelName) => {
7784
7784
  let inputType;
@@ -10645,8 +10645,8 @@ var Transformer = class _Transformer {
10645
10645
  hasJson = false;
10646
10646
  static prismaClientOutputPath = "@prisma/client";
10647
10647
  static isCustomPrismaClientOutputPath = false;
10648
- static isGenerateSelect = false;
10649
- static isGenerateInclude = false;
10648
+ static isGenerateSelect = true;
10649
+ static isGenerateInclude = true;
10650
10650
  constructor(params) {
10651
10651
  this.name = params.name ?? "";
10652
10652
  this.fields = params.fields ?? [];
@@ -10678,21 +10678,21 @@ var Transformer = class _Transformer {
10678
10678
  async generateEnumSchemas() {
10679
10679
  for (const enumType2 of this.enumTypes) {
10680
10680
  const { name, values } = enumType2;
10681
- await writeFileSafely(path3.join(_Transformer.outputPath, `schemas/enums/${name}.schema.ts`), `${this.generateImportZodStatement()}
10682
- ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)})`)}`);
10681
+ await writeFileSafely(path3.join(_Transformer.outputPath, `schemas/enums/${lowerCaseFirst(name)}.schema.ts`), `${this.generateImportZodStatement()}
10682
+ ${this.generateExportSchemaStatement(`${lowerCaseFirst(name)}`, `z.enum(${JSON.stringify(values)})`)}`);
10683
10683
  }
10684
10684
  }
10685
10685
  generateImportZodStatement() {
10686
10686
  return "import { z } from 'zod';\n";
10687
10687
  }
10688
10688
  generateExportSchemaStatement(name, schema) {
10689
- return `export const ${name}Schema = ${schema}`;
10689
+ return `export const ${lowerCaseFirst(name)}Schema = ${schema}`;
10690
10690
  }
10691
10691
  async generateObjectSchema() {
10692
10692
  const zodObjectSchemaFields = this.generateObjectSchemaFields();
10693
10693
  const objectSchema = this.prepareObjectSchema(zodObjectSchemaFields);
10694
10694
  const objectSchemaName = this.resolveObjectSchemaName();
10695
- await writeFileSafely(path3.join(_Transformer.outputPath, `schemas/objects/${objectSchemaName}.schema.ts`), objectSchema);
10695
+ await writeFileSafely(path3.join(_Transformer.outputPath, `schemas/objects/${lowerCaseFirst(objectSchemaName)}.schema.ts`), objectSchema);
10696
10696
  }
10697
10697
  generateObjectSchemaFields() {
10698
10698
  const zodObjectSchemaFields = this.fields.map((field) => this.generateObjectSchemaField(field)).flatMap((item) => item).map((item) => {
@@ -10780,7 +10780,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10780
10780
  const arr = inputType.isList ? ".array()" : "";
10781
10781
  const opt = !field.isRequired ? ".optional()" : "";
10782
10782
  const nullable = field.inputTypes.length > 1 && field.inputTypes[1]?.type === "Null" ? ".nullable()" : "";
10783
- return inputsLength === 1 ? ` ${field.name}: z.lazy(() => ${schema})${arr}${opt}${nullable}` : `z.lazy(() => ${schema})${arr}${opt}${nullable}`;
10783
+ return inputsLength === 1 ? ` ${field.name}: z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}${nullable}` : `z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}${nullable}`;
10784
10784
  }
10785
10785
  generateFieldValidators(zodStringWithMainType, field) {
10786
10786
  const { isRequired, isNullable } = field;
@@ -10813,8 +10813,8 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10813
10813
  if (isAggregateInputType(name)) {
10814
10814
  name = `${name}Type`;
10815
10815
  }
10816
- const end = `export const ${exportName}ObjectSchema = Schema`;
10817
- return `const Schema: z.ZodType<Prisma.${name}> = ${schema};
10816
+ const end = `export const ${lowerCaseFirst(exportName)}ObjectSchema = schema`;
10817
+ return `const schema: z.ZodType<Prisma.${name}> = ${schema};
10818
10818
 
10819
10819
  ${end}`;
10820
10820
  }
@@ -10869,9 +10869,9 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10869
10869
  if (isModelQueryType) {
10870
10870
  return `import { ${this.resolveModelQuerySchemaName(modelName, queryName)} } from '../${queryName}${modelName}.schema'`;
10871
10871
  } else if (_Transformer.enumNames.includes(name)) {
10872
- return `import { ${name}Schema } from '../enums/${name}.schema'`;
10872
+ return `import { ${lowerCaseFirst(name)}Schema } from '../enums/${lowerCaseFirst(name)}.schema'`;
10873
10873
  } else {
10874
- return `import { ${name}ObjectSchema } from './${name}.schema'`;
10874
+ return `import { ${lowerCaseFirst(name)}ObjectSchema } from './${lowerCaseFirst(name)}.schema'`;
10875
10875
  }
10876
10876
  }).join(";\r\n");
10877
10877
  }
@@ -10896,9 +10896,9 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10896
10896
  };
10897
10897
  }
10898
10898
  resolveModelQuerySchemaName(modelName, queryName) {
10899
- const modelNameCapitalized = upperCaseFirst(modelName);
10899
+ const modelNameUncapitalized = lowerCaseFirst(modelName);
10900
10900
  const queryNameCapitalized = upperCaseFirst(queryName);
10901
- return `${modelNameCapitalized}${queryNameCapitalized}Schema`;
10901
+ return `${modelNameUncapitalized}${queryNameCapitalized}Schema`;
10902
10902
  }
10903
10903
  wrapWithZodUnion(zodStringFields) {
10904
10904
  let wrapped = "";
@@ -10925,12 +10925,11 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10925
10925
  name = _Transformer.rawOpsMap[name];
10926
10926
  exportName = name.replace("Args", "");
10927
10927
  }
10928
- return exportName;
10928
+ return lowerCaseFirst(exportName);
10929
10929
  }
10930
10930
  async generateModelSchemas() {
10931
10931
  for (const modelOperation of this.modelOperations) {
10932
10932
  const {
10933
- model: modelName,
10934
10933
  findUnique,
10935
10934
  findFirst,
10936
10935
  findMany,
@@ -10950,7 +10949,8 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10950
10949
  aggregate,
10951
10950
  groupBy
10952
10951
  } = modelOperation;
10953
- const model = findModelByName(this.models, modelName);
10952
+ const model = findModelByName(this.models, modelOperation.model);
10953
+ const modelName = lowerCaseFirst(modelOperation.model);
10954
10954
  const { selectImport, includeImport, selectZodSchemaLine, includeZodSchemaLine, selectZodSchemaLineLazy, includeZodSchemaLineLazy } = this.resolveSelectIncludeImportAndZodSchemaLine(model);
10955
10955
  const { orderByImport, orderByZodSchemaLine } = this.resolveOrderByWithRelationImportAndZodSchemaLine(model);
10956
10956
  if (findUnique) {
@@ -11104,19 +11104,19 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
11104
11104
  resolveSelectIncludeImportAndZodSchemaLine(model) {
11105
11105
  const { name: modelName } = model;
11106
11106
  const hasRelationToAnotherModel = checkModelHasModelRelation(model);
11107
- const selectImport = _Transformer.isGenerateSelect ? `import { ${modelName}SelectObjectSchema } from './objects/${modelName}Select.schema'` : "";
11108
- const includeImport = _Transformer.isGenerateInclude && hasRelationToAnotherModel ? `import { ${modelName}IncludeObjectSchema } from './objects/${modelName}Include.schema'` : "";
11107
+ const selectImport = _Transformer.isGenerateSelect ? `import { ${lowerCaseFirst(modelName)}SelectObjectSchema } from './objects/${lowerCaseFirst(modelName)}Select.schema'` : "";
11108
+ const includeImport = _Transformer.isGenerateInclude && hasRelationToAnotherModel ? `import { ${lowerCaseFirst(modelName)}IncludeObjectSchema } from './objects/${lowerCaseFirst(modelName)}Include.schema'` : "";
11109
11109
  let selectZodSchemaLine = "";
11110
11110
  let includeZodSchemaLine = "";
11111
11111
  let selectZodSchemaLineLazy = "";
11112
11112
  let includeZodSchemaLineLazy = "";
11113
11113
  if (_Transformer.isGenerateSelect) {
11114
- const zodSelectObjectSchema = `${modelName}SelectObjectSchema.optional()`;
11114
+ const zodSelectObjectSchema = `${lowerCaseFirst(modelName)}SelectObjectSchema.optional()`;
11115
11115
  selectZodSchemaLine = `select: ${zodSelectObjectSchema},`;
11116
11116
  selectZodSchemaLineLazy = `select: z.lazy(() => ${zodSelectObjectSchema}),`;
11117
11117
  }
11118
11118
  if (_Transformer.isGenerateInclude && hasRelationToAnotherModel) {
11119
- const zodIncludeObjectSchema = `${modelName}IncludeObjectSchema.optional()`;
11119
+ const zodIncludeObjectSchema = `${lowerCaseFirst(modelName)}IncludeObjectSchema.optional()`;
11120
11120
  includeZodSchemaLine = `include: ${zodIncludeObjectSchema},`;
11121
11121
  includeZodSchemaLineLazy = `include: z.lazy(() => ${zodIncludeObjectSchema}),`;
11122
11122
  }
@@ -11136,9 +11136,9 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
11136
11136
  "postgresql",
11137
11137
  "mysql"
11138
11138
  ].includes(_Transformer.provider) && _Transformer.previewFeatures?.includes("fullTextSearch")) {
11139
- modelOrderBy = `${modelName}OrderByWithRelationAndSearchRelevanceInput`;
11139
+ modelOrderBy = `${lowerCaseFirst(modelName)}OrderByWithRelationAndSearchRelevanceInput`;
11140
11140
  } else {
11141
- modelOrderBy = `${modelName}OrderByWithRelationInput`;
11141
+ modelOrderBy = `${lowerCaseFirst(modelName)}OrderByWithRelationInput`;
11142
11142
  }
11143
11143
  const orderByImport = `import { ${modelOrderBy}ObjectSchema } from './objects/${modelOrderBy}.schema'`;
11144
11144
  const orderByZodSchemaLine = `orderBy: z.union([${modelOrderBy}ObjectSchema, ${modelOrderBy}ObjectSchema.array()]).optional(),`;
@@ -11682,7 +11682,7 @@ ${JSON.stringify(config)}`);
11682
11682
  const plural = (0, import_pluralize.default)(lowerCaseFirst(model));
11683
11683
  consoleLog(`Generating tRPC router for model ${model}`);
11684
11684
  generateRouterImport(appRouter, plural, model);
11685
- const modelRouter = project.createSourceFile(path4.resolve(outputDir, "routers", `${model}.router.ts`), void 0, {
11685
+ const modelRouter = project.createSourceFile(path4.resolve(outputDir, "routers", `${lowerCaseFirst(model)}.router.ts`), void 0, {
11686
11686
  overwrite: true
11687
11687
  });
11688
11688
  generateCreateRouterImport({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/prisma-trpc-generator",
3
- "version": "0.10.4",
3
+ "version": "0.10.6",
4
4
  "type": "module",
5
5
  "description": "A fork of the prisma-trpc-generator code to work in ESM with Prisma v6.",
6
6
  "repository": {