chore:little fixes and formating and linting and patches

This commit is contained in:
2026-03-31 15:50:54 +02:00
parent a1ce71ffb6
commit 9b197abcfa
815 changed files with 22960 additions and 8982 deletions

View File

@@ -1,6 +1,5 @@
import { readFileSync, readdirSync, writeFileSync } from 'node:fs';
import { join } from 'node:path';
import { dirname } from 'node:path';
import { readdirSync, readFileSync, writeFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
const __filename = fileURLToPath(import.meta.url);
@@ -52,7 +51,7 @@ function parseSchemaForJsonTypes(schemaPath: string): JsonFieldMapping[] {
function processGeneratedFiles(
generatedDir: string,
mappings: JsonFieldMapping[],
mappings: JsonFieldMapping[]
): void {
// Process the main files in the generated directory
const mainFiles = [
@@ -100,7 +99,7 @@ function processGeneratedFiles(
function replaceJsonValueInFileForModel(
filePath: string,
mappings: JsonFieldMapping[],
mappings: JsonFieldMapping[]
): void {
let content = readFileSync(filePath, 'utf-8');
let modified = false;
@@ -109,12 +108,12 @@ function replaceJsonValueInFileForModel(
// Pattern 1: Simple runtime.JsonValue replacement (for select/return types)
const simpleJsonValueRegex = new RegExp(
`\\b${mapping.field}:\\s*runtime\\.JsonValue\\b`,
'g',
'g'
);
if (simpleJsonValueRegex.test(content)) {
content = content.replace(
simpleJsonValueRegex,
`${mapping.field}: PrismaJson.${mapping.type}`,
`${mapping.field}: PrismaJson.${mapping.type}`
);
modified = true;
}
@@ -122,12 +121,12 @@ function replaceJsonValueInFileForModel(
// Pattern 2: runtime.InputJsonValue with optional JsonNullValueInput (for create/update inputs)
const inputJsonValueRegex = new RegExp(
`\\b${mapping.field}:\\s*(?:Prisma\\.JsonNullValueInput\\s*\\|\\s*)?runtime\\.InputJsonValue\\b`,
'g',
'g'
);
if (inputJsonValueRegex.test(content)) {
content = content.replace(
inputJsonValueRegex,
`${mapping.field}: PrismaJson.${mapping.type}`,
`${mapping.field}: PrismaJson.${mapping.type}`
);
modified = true;
}
@@ -135,12 +134,12 @@ function replaceJsonValueInFileForModel(
// Pattern 3: Optional runtime.InputJsonValue with optional JsonNullValueInput
const optionalInputJsonValueRegex = new RegExp(
`\\b${mapping.field}\\?:\\s*(?:Prisma\\.JsonNullValueInput\\s*\\|\\s*)?runtime\\.InputJsonValue\\b`,
'g',
'g'
);
if (optionalInputJsonValueRegex.test(content)) {
content = content.replace(
optionalInputJsonValueRegex,
`${mapping.field}?: PrismaJson.${mapping.type}`,
`${mapping.field}?: PrismaJson.${mapping.type}`
);
modified = true;
}
@@ -151,7 +150,7 @@ function replaceJsonValueInFileForModel(
if (unionJsonValueRegex.test(content)) {
content = content.replace(
unionJsonValueRegex,
`$1PrismaJson.${mapping.type}`,
`$1PrismaJson.${mapping.type}`
);
modified = true;
}
@@ -161,7 +160,7 @@ function replaceJsonValueInFileForModel(
if (simpleInputJsonValueRegex.test(content)) {
content = content.replace(
simpleInputJsonValueRegex,
`| PrismaJson.${mapping.type}`,
`| PrismaJson.${mapping.type}`
);
modified = true;
}
@@ -169,12 +168,12 @@ function replaceJsonValueInFileForModel(
// Pattern 6: Optional union types with JsonNullValueInput | runtime.InputJsonValue
const optionalUnionJsonValueRegex = new RegExp(
`\\b${mapping.field}\\?:\\s*(?:Prisma\\.JsonNullValueInput\\s*\\|\\s*)?runtime\\.InputJsonValue\\b`,
'g',
'g'
);
if (optionalUnionJsonValueRegex.test(content)) {
content = content.replace(
optionalUnionJsonValueRegex,
`${mapping.field}?: PrismaJson.${mapping.type}`,
`${mapping.field}?: PrismaJson.${mapping.type}`
);
modified = true;
}