ts-sql-query
Advanced tools
Comparing version 1.41.0 to 1.42.0
import type { MandatoryInsertSets, MandatoryInsertValues } from "../expressions/insert"; | ||
import type { UpdateSets, UpdateValues } from "../expressions/update"; | ||
import type { ITable, ITableOrView } from "../utils/ITableOrView"; | ||
import type { ITable } from "../utils/ITableOrView"; | ||
import type { ResultObjectValues } from "../utils/resultUtils"; | ||
import type { Column, ComputedColumn } from "../utils/Column"; | ||
import { AnyValueSource } from "../expressions/values"; | ||
export type SelectedRow<TABLE extends ITableOrView<any>> = ResultObjectValues<{ | ||
[K in ColumnKeys<TABLE>]: TABLE[K]; | ||
export type SelectedRow<TABLE> = ResultObjectValues<{ | ||
[K in ColumnKeys<TABLE> & keyof TABLE]: TABLE[K]; | ||
}>; | ||
export type SelectedValues<TABLE extends ITableOrView<any>> = ResultObjectValues<{ | ||
export type SelectedValues<TABLE> = ResultObjectValues<{ | ||
[K in ColumnKeys<TABLE>]: TABLE[K]; | ||
}>; | ||
export type InsertableRow<TABLE extends ITable<any>> = MakeTypeVisible<MandatoryInsertSets<TABLE>>; | ||
export type InsertableValues<TABLE extends ITable<any>> = MakeTypeVisible<MandatoryInsertValues<TABLE>>; | ||
export type UpdatableRow<TABLE extends ITable<any>> = MakeTypeVisible<UpdateSets<TABLE, TABLE>>; | ||
export type UpdatableValues<TABLE extends ITable<any>> = MakeTypeVisible<UpdateValues<TABLE>>; | ||
export type InsertableRow<TABLE> = TABLE extends ITable<any> ? MakeTypeVisible<MandatoryInsertSets<TABLE>> : MakeTypeVisible<MandatoryInsertSets<TABLE & ITable<any>>>; | ||
export type InsertableValues<TABLE> = TABLE extends ITable<any> ? MakeTypeVisible<MandatoryInsertValues<TABLE>> : MakeTypeVisible<MandatoryInsertValues<TABLE & ITable<any>>>; | ||
export type UpdatableRow<TABLE> = TABLE extends ITable<any> ? MakeTypeVisible<UpdateSets<TABLE, TABLE>> : MakeTypeVisible<UpdateSets<TABLE & ITable<any>, TABLE & ITable<any>>>; | ||
export type UpdatableValues<TABLE> = TABLE extends ITable<any> ? MakeTypeVisible<UpdateValues<TABLE>> : MakeTypeVisible<UpdateValues<TABLE & ITable<any>>>; | ||
type MakeTypeVisible<T> = { | ||
[P in keyof T]: T[P]; | ||
}; | ||
export type ColumnKeys<O extends object> = { | ||
export type ColumnKeys<O> = { | ||
[K in keyof O]-?: O[K] extends AnyValueSource ? K : never; | ||
}[keyof O]; | ||
export type WritableColumnKeys<O extends object> = { | ||
export type WritableColumnKeys<O> = { | ||
[K in keyof O]-?: O[K] extends Column ? (O[K] extends ComputedColumn ? never : K) : never; | ||
}[keyof O]; | ||
export {}; |
{ | ||
"name": "ts-sql-query", | ||
"version": "1.41.0", | ||
"version": "1.42.0", | ||
"description": "Type-safe SQL query builder like QueryDSL or JOOQ in Java or Linq in .Net for TypeScript with MariaDB, MySql, Oracle, PostgreSql, Sqlite and SqlServer support.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -24,3 +24,3 @@ import { AnyDB } from "../databases"; | ||
export type FixOptionalProperties<RESULT> = undefined extends string ? RESULT : { | ||
[P in keyof OptionalMap<RESULT>]: true extends OptionalMap<RESULT> ? RESULT[P] : NonNullable<RESULT[P]>; | ||
[P in keyof RESULT]: true extends OptionalMap<RESULT> ? RESULT[P] : NonNullable<RESULT[P]>; | ||
}; | ||
@@ -27,0 +27,0 @@ type OptionalMap<TYPE> = { |
2008800