kysely-kit
Advanced tools
Comparing version 0.5.1 to 0.6.0
@@ -6,8 +6,19 @@ import camelcase from 'camelcase'; | ||
const [tableName, columnName] = column.split('.'); | ||
sourceFile | ||
.getInterfaceOrThrow(camelcase(`${tableName}Table`, { pascalCase: true })) | ||
.getPropertyOrThrow(camelcase(columnName)) | ||
.setType(type); | ||
if (tableName === '*') { | ||
sourceFile.getInterfaces().forEach((interface_) => { | ||
interface_.getProperties().forEach((property) => { | ||
if (property.getName() === camelcase(columnName)) { | ||
property.setType(type); | ||
} | ||
}); | ||
}); | ||
} | ||
else { | ||
sourceFile | ||
.getInterfaceOrThrow(camelcase(`${tableName}Table`, { pascalCase: true })) | ||
.getPropertyOrThrow(camelcase(columnName)) | ||
.setType(type); | ||
} | ||
}); | ||
} | ||
} |
@@ -13,18 +13,10 @@ import camelcase from 'camelcase'; | ||
let type = mapDataType(isArray ? column.dataType.slice(1) : column.dataType); | ||
if (name === 'createdAt' && type === 'Date' && column.hasDefaultValue) { | ||
type = 'GeneratedAlways<Date>'; | ||
if (isArray) { | ||
type = `${type}[]`; | ||
} | ||
else if (name === 'updatedAt' && type === 'Date' && column.isNullable) { | ||
type = 'ColumnType<Date | null, never, Date>'; | ||
if (column.isAutoIncrementing) { | ||
type = `GeneratedAlways<${type}>`; | ||
} | ||
else { | ||
if (isArray) { | ||
type = `${type}[]`; | ||
} | ||
if (column.isAutoIncrementing) { | ||
type = `GeneratedAlways<${type}>`; | ||
} | ||
if (column.isNullable) { | ||
type = `${type} | null`; | ||
} | ||
if (column.isNullable) { | ||
type = `${type} | null`; | ||
} | ||
@@ -31,0 +23,0 @@ return { |
{ | ||
"name": "kysely-kit", | ||
"description": "Useful utilities for working with Kysely", | ||
"version": "0.5.1", | ||
"version": "0.6.0", | ||
"author": "Vlad Shcherbin <vlad.shcherbin@gmail.com>", | ||
@@ -21,4 +21,4 @@ "repository": "vladshcherbin/kysely-kit", | ||
"sade": "^1.8.1", | ||
"ts-morph": "^21.0.1", | ||
"valibot": "^0.29.0" | ||
"ts-morph": "^22.0.0", | ||
"valibot": "^0.30.0" | ||
}, | ||
@@ -30,11 +30,11 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@shcherbin/eslint-config-node-typescript": "^0.1.1", | ||
"@tsconfig/node20": "^20.1.2", | ||
"@types/node": "^20.11.24", | ||
"@types/pg": "^8.11.2", | ||
"@shcherbin/eslint-config-node-typescript": "^0.2.0", | ||
"@tsconfig/node20": "^20.1.4", | ||
"@types/node": "^20.12.7", | ||
"@types/pg": "^8.11.5", | ||
"eslint": "^8.57.0", | ||
"kysely": "^0.27.2", | ||
"pg": "^8.11.3", | ||
"tsx": "^4.7.1", | ||
"typescript": "^5.3.3" | ||
"kysely": "^0.27.3", | ||
"pg": "^8.11.5", | ||
"tsx": "^4.7.2", | ||
"typescript": "^5.4.5" | ||
}, | ||
@@ -41,0 +41,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8956
217
+ Added@ts-morph/common@0.23.0(transitive)
+ Addedcode-block-writer@13.0.3(transitive)
+ Addedts-morph@22.0.0(transitive)
+ Addedvalibot@0.30.0(transitive)
- Removed@ts-morph/common@0.22.0(transitive)
- Removedcode-block-writer@12.0.0(transitive)
- Removedts-morph@21.0.1(transitive)
- Removedvalibot@0.29.0(transitive)
Updatedts-morph@^22.0.0
Updatedvalibot@^0.30.0