prisma-generator-express 1.23.0 → 1.25.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 (34) hide show
  1. package/dist/bin.d.ts +1 -1
  2. package/dist/bin.js +1 -1
  3. package/dist/bin.js.map +1 -1
  4. package/dist/generators/generateRouter.js +5 -5
  5. package/dist/generators/generateUnifiedDocs.js +74 -65
  6. package/dist/generators/generateUnifiedDocs.js.map +1 -1
  7. package/dist/generators/generateUnifiedHandler.js +26 -13
  8. package/dist/generators/generateUnifiedHandler.js.map +1 -1
  9. package/dist/generators/generateUnifiedScalarUI.js +13 -13
  10. package/dist/generators/generateUnifiedScalarUI.js.map +1 -1
  11. package/dist/index.js +23 -23
  12. package/dist/index.js.map +1 -1
  13. package/dist/utils/copyFiles.d.ts +1 -5
  14. package/dist/utils/copyFiles.js +2 -17
  15. package/dist/utils/copyFiles.js.map +1 -1
  16. package/dist/utils/strings.d.ts +1 -1
  17. package/dist/utils/strings.js +2 -2
  18. package/dist/utils/strings.js.map +1 -1
  19. package/dist/utils/writeFileSafely.js +0 -6
  20. package/dist/utils/writeFileSafely.js.map +1 -1
  21. package/package.json +1 -1
  22. package/src/bin.ts +1 -1
  23. package/src/client/encodeQueryParams.ts +1 -1
  24. package/src/copy/buildModelOpenApi.ts +90 -19
  25. package/src/copy/parseQueryParams.ts +2 -2
  26. package/src/generators/generateImportPrismaStatement.ts +1 -1
  27. package/src/generators/generateRouter.ts +5 -5
  28. package/src/generators/generateUnifiedDocs.ts +75 -65
  29. package/src/generators/generateUnifiedHandler.ts +26 -13
  30. package/src/generators/generateUnifiedScalarUI.ts +13 -13
  31. package/src/index.ts +9 -9
  32. package/src/utils/copyFiles.ts +2 -25
  33. package/src/utils/strings.ts +2 -2
  34. package/src/utils/writeFileSafely.ts +1 -9
@@ -2,16 +2,7 @@ import { GeneratorOptions } from '@prisma/generator-helper'
2
2
  import * as fs from 'fs'
3
3
  import * as path from 'path'
4
4
 
5
- export interface CopyFilesConfig {
6
- includeCacheUtils?: boolean
7
- includeValidatorUtils?: boolean
8
- }
9
-
10
- export async function copyFiles(
11
- options: GeneratorOptions,
12
- config?: CopyFilesConfig,
13
- ): Promise<void> {
14
- const copyConfig = config || {}
5
+ export async function copyFiles(options: GeneratorOptions): Promise<void> {
15
6
  const outputPath = options.generator.output?.value
16
7
  if (!outputPath) return
17
8
 
@@ -34,20 +25,6 @@ export async function copyFiles(
34
25
  if (!ok) allCopied = false
35
26
  }
36
27
 
37
- if (copyConfig.includeCacheUtils) {
38
- const ok = await copyFile(srcDir, outputPath, 'cacheManager.ts', {
39
- required: true,
40
- })
41
- if (!ok) allCopied = false
42
- }
43
-
44
- if (copyConfig.includeValidatorUtils) {
45
- const ok = await copyFile(srcDir, outputPath, 'inputValidator.ts', {
46
- required: true,
47
- })
48
- if (!ok) allCopied = false
49
- }
50
-
51
28
  const clientDir = path.join(outputPath, 'client')
52
29
  if (!fs.existsSync(clientDir)) {
53
30
  fs.mkdirSync(clientDir, { recursive: true })
@@ -60,7 +37,7 @@ export async function copyFiles(
60
37
  'encodeQueryParams.ts',
61
38
  {
62
39
  required: true,
63
- importRewrites: [{ from: '../copy/misc', to: '../misc' }],
40
+ importRewrites: [{ from: '../copy/misc.js', to: '../misc.js' }],
64
41
  },
65
42
  )
66
43
  if (!clientOk) allCopied = false
@@ -1,7 +1,7 @@
1
1
  export const capitalize = (str: string) =>
2
2
  str.charAt(0).toUpperCase() + str.slice(1)
3
3
 
4
- export function toPascalCase(str: string) {
4
+ export function toCamelCase(str: string) {
5
5
  if (!str) return str
6
6
  return str.charAt(0).toLowerCase() + str.slice(1)
7
- }
7
+ }
@@ -33,14 +33,6 @@ export async function writeFileSafely({
33
33
  let filePath: string
34
34
 
35
35
  switch (operation) {
36
- case 'cacheConfig':
37
- filePath = path.join(outputPath, 'cacheConfig.ts')
38
- break
39
-
40
- case 'types/inputs':
41
- filePath = path.join(outputPath, 'types', 'inputs.ts')
42
- break
43
-
44
36
  case 'combinedDocs':
45
37
  filePath = path.join(outputPath, 'combinedDocs.ts')
46
38
  break
@@ -80,4 +72,4 @@ export async function writeFileSafely({
80
72
  }
81
73
 
82
74
  fs.writeFileSync(filePath, formattedContent)
83
- }
75
+ }