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.
- package/dist/bin.d.ts +1 -1
- package/dist/bin.js +1 -1
- package/dist/bin.js.map +1 -1
- package/dist/generators/generateRouter.js +5 -5
- package/dist/generators/generateUnifiedDocs.js +74 -65
- package/dist/generators/generateUnifiedDocs.js.map +1 -1
- package/dist/generators/generateUnifiedHandler.js +26 -13
- package/dist/generators/generateUnifiedHandler.js.map +1 -1
- package/dist/generators/generateUnifiedScalarUI.js +13 -13
- package/dist/generators/generateUnifiedScalarUI.js.map +1 -1
- package/dist/index.js +23 -23
- package/dist/index.js.map +1 -1
- package/dist/utils/copyFiles.d.ts +1 -5
- package/dist/utils/copyFiles.js +2 -17
- package/dist/utils/copyFiles.js.map +1 -1
- package/dist/utils/strings.d.ts +1 -1
- package/dist/utils/strings.js +2 -2
- package/dist/utils/strings.js.map +1 -1
- package/dist/utils/writeFileSafely.js +0 -6
- package/dist/utils/writeFileSafely.js.map +1 -1
- package/package.json +1 -1
- package/src/bin.ts +1 -1
- package/src/client/encodeQueryParams.ts +1 -1
- package/src/copy/buildModelOpenApi.ts +90 -19
- package/src/copy/parseQueryParams.ts +2 -2
- package/src/generators/generateImportPrismaStatement.ts +1 -1
- package/src/generators/generateRouter.ts +5 -5
- package/src/generators/generateUnifiedDocs.ts +75 -65
- package/src/generators/generateUnifiedHandler.ts +26 -13
- package/src/generators/generateUnifiedScalarUI.ts +13 -13
- package/src/index.ts +9 -9
- package/src/utils/copyFiles.ts +2 -25
- package/src/utils/strings.ts +2 -2
- package/src/utils/writeFileSafely.ts +1 -9
package/src/utils/copyFiles.ts
CHANGED
|
@@ -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
|
|
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
|
package/src/utils/strings.ts
CHANGED
|
@@ -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
|
+
}
|