metal-orm 1.0.45 → 1.0.46

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 (47) hide show
  1. package/dist/index.cjs +72 -4
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +72 -4
  4. package/dist/index.d.ts +72 -4
  5. package/dist/index.js +69 -4
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/core/ast/adapters.ts +2 -1
  9. package/src/core/ddl/dialects/base-schema-dialect.ts +2 -1
  10. package/src/core/ddl/dialects/mssql-schema-dialect.ts +10 -23
  11. package/src/core/ddl/dialects/mysql-schema-dialect.ts +10 -24
  12. package/src/core/ddl/dialects/postgres-schema-dialect.ts +10 -23
  13. package/src/core/ddl/dialects/render-reference.test.ts +2 -1
  14. package/src/core/ddl/dialects/sqlite-schema-dialect.ts +9 -23
  15. package/src/core/ddl/introspect/catalogs/postgres.ts +2 -1
  16. package/src/core/ddl/introspect/mssql.ts +17 -1
  17. package/src/core/ddl/introspect/postgres.ts +2 -1
  18. package/src/core/ddl/introspect/sqlite.ts +2 -1
  19. package/src/core/ddl/schema-dialect.ts +2 -1
  20. package/src/core/ddl/schema-diff.ts +2 -1
  21. package/src/core/ddl/schema-generator.ts +2 -1
  22. package/src/core/ddl/schema-types.ts +2 -1
  23. package/src/core/ddl/sql-writing.ts +2 -1
  24. package/src/core/functions/datetime.ts +2 -1
  25. package/src/core/functions/numeric.ts +2 -1
  26. package/src/core/functions/text.ts +2 -1
  27. package/src/decorators/{column.ts → column-decorator.ts} +4 -1
  28. package/src/decorators/index.ts +1 -1
  29. package/src/index.ts +2 -1
  30. package/src/orm/entity-metadata.ts +2 -1
  31. package/src/orm/lazy-batch.ts +2 -1
  32. package/src/orm/orm-session.ts +2 -1
  33. package/src/query-builder/column-selector.ts +2 -1
  34. package/src/query-builder/delete.ts +2 -1
  35. package/src/query-builder/insert.ts +2 -1
  36. package/src/query-builder/query-ast-service.ts +2 -1
  37. package/src/query-builder/relation-projection-helper.ts +2 -1
  38. package/src/query-builder/relation-service.ts +2 -1
  39. package/src/query-builder/select/predicate-facet.ts +2 -1
  40. package/src/query-builder/select/projection-facet.ts +2 -1
  41. package/src/query-builder/select-helpers.ts +2 -1
  42. package/src/query-builder/select.ts +2 -1
  43. package/src/query-builder/update.ts +2 -1
  44. package/src/schema/{column.ts → column-types.ts} +317 -290
  45. package/src/schema/table-guards.ts +1 -1
  46. package/src/schema/table.ts +1 -1
  47. package/src/schema/types.ts +10 -8
package/dist/index.d.cts CHANGED
@@ -1,7 +1,24 @@
1
1
  /**
2
- * Supported column data types for database schema definitions
2
+ * Canonical, dialect-agnostic column data types.
3
+ * Keep this intentionally small; dialect-specific names should be expressed via `dialectTypes`.
3
4
  */
4
- type ColumnType = 'INT' | 'INTEGER' | 'BIGINT' | 'VARCHAR' | 'TEXT' | 'JSON' | 'ENUM' | 'DECIMAL' | 'FLOAT' | 'DOUBLE' | 'UUID' | 'BINARY' | 'VARBINARY' | 'BLOB' | 'BYTEA' | 'DATE' | 'DATETIME' | 'TIMESTAMP' | 'TIMESTAMPTZ' | 'BOOLEAN' | 'int' | 'integer' | 'bigint' | 'varchar' | 'text' | 'json' | 'enum' | 'decimal' | 'float' | 'double' | 'uuid' | 'binary' | 'varbinary' | 'blob' | 'bytea' | 'date' | 'datetime' | 'timestamp' | 'timestamptz' | 'boolean';
5
+ declare const STANDARD_COLUMN_TYPES: readonly ["INT", "INTEGER", "BIGINT", "VARCHAR", "TEXT", "JSON", "ENUM", "DECIMAL", "FLOAT", "DOUBLE", "UUID", "BINARY", "VARBINARY", "BLOB", "DATE", "DATETIME", "TIMESTAMP", "TIMESTAMPTZ", "BOOLEAN"];
6
+ /** Known logical types the ORM understands. */
7
+ type StandardColumnType = (typeof STANDARD_COLUMN_TYPES)[number];
8
+ /**
9
+ * Column type value.
10
+ * We allow arbitrary strings so new/dialect-specific types don't require touching this module.
11
+ */
12
+ type ColumnType = StandardColumnType | (string & {});
13
+ /**
14
+ * Normalizes a column type to its canonical lowercase form when it's one of the known logical types.
15
+ * Unknown/custom types are returned untouched to avoid clobbering dialect-specific casing.
16
+ */
17
+ declare const normalizeColumnType: (type: ColumnType) => ColumnType;
18
+ /**
19
+ * Renders a raw SQL type name with optional parameters.
20
+ */
21
+ declare const renderTypeWithArgs: (sqlType: string, args?: unknown[]) => string;
5
22
  type ReferentialAction = 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET DEFAULT';
6
23
  interface RawDefaultValue {
7
24
  raw: string;
@@ -29,6 +46,8 @@ interface ColumnDef<T extends ColumnType = ColumnType, TRuntime = unknown> {
29
46
  name: string;
30
47
  /** Data type of the column */
31
48
  type: T;
49
+ /** Optional explicit SQL type per dialect (e.g., { postgres: 'bytea' }) */
50
+ dialectTypes?: Partial<Record<string, string>>;
32
51
  /** Optional override for the inferred TypeScript type */
33
52
  tsType?: TRuntime;
34
53
  /** Whether this column is a primary key */
@@ -132,6 +151,15 @@ declare const col: {
132
151
  * @param values - Enum values
133
152
  */
134
153
  enum: (values: string[]) => ColumnDef<"ENUM">;
154
+ /**
155
+ * Creates a column definition with a custom SQL type.
156
+ * Useful for dialect-specific types without polluting the standard set.
157
+ */
158
+ custom: (type: string, opts?: {
159
+ dialect?: string;
160
+ args?: unknown[];
161
+ tsType?: unknown;
162
+ }) => ColumnDef;
135
163
  /**
136
164
  * Marks a column definition as a primary key
137
165
  * @param def - Column definition to modify
@@ -407,12 +435,13 @@ declare function getColumn<T extends TableDef>(table: T, key: string): ColumnDef
407
435
  * Resolves a relation definition to its target table type.
408
436
  */
409
437
  type RelationTargetTable<TRel extends RelationDef> = TRel extends HasManyRelation<infer TTarget> ? TTarget : TRel extends HasOneRelation<infer TTarget> ? TTarget : TRel extends BelongsToRelation<infer TTarget> ? TTarget : TRel extends BelongsToManyRelation<infer TTarget> ? TTarget : never;
438
+ type NormalizedColumnType<T extends ColumnDef> = Lowercase<T['type'] & string>;
410
439
  /**
411
440
  * Maps a ColumnDef to its TypeScript type representation
412
441
  */
413
442
  type ColumnToTs<T extends ColumnDef> = [
414
443
  unknown
415
- ] extends [T['tsType']] ? T['type'] extends 'INT' | 'INTEGER' | 'int' | 'integer' ? number : T['type'] extends 'BIGINT' | 'bigint' ? number | bigint : T['type'] extends 'DECIMAL' | 'decimal' | 'FLOAT' | 'float' | 'DOUBLE' | 'double' ? number : T['type'] extends 'BOOLEAN' | 'boolean' ? boolean : T['type'] extends 'JSON' | 'json' ? unknown : T['type'] extends 'BLOB' | 'blob' | 'BINARY' | 'binary' | 'VARBINARY' | 'varbinary' | 'BYTEA' | 'bytea' ? Buffer : T['type'] extends 'DATE' | 'date' | 'DATETIME' | 'datetime' | 'TIMESTAMP' | 'timestamp' | 'TIMESTAMPTZ' | 'timestamptz' ? string : string : Exclude<T['tsType'], undefined>;
444
+ ] extends [T['tsType']] ? NormalizedColumnType<T> extends 'int' | 'integer' ? number : NormalizedColumnType<T> extends 'bigint' ? number | bigint : NormalizedColumnType<T> extends 'decimal' | 'float' | 'double' ? number : NormalizedColumnType<T> extends 'boolean' ? boolean : NormalizedColumnType<T> extends 'json' ? unknown : NormalizedColumnType<T> extends 'blob' | 'binary' | 'varbinary' | 'bytea' ? Buffer : NormalizedColumnType<T> extends 'date' | 'datetime' | 'timestamp' | 'timestamptz' ? string : string : Exclude<T['tsType'], undefined>;
416
445
  /**
417
446
  * Infers a row shape from a table definition
418
447
  */
@@ -2932,6 +2961,9 @@ interface HydrationContext<E extends DomainEvent = AnyDomainEvent> {
2932
2961
  entityContext: EntityContext;
2933
2962
  }
2934
2963
 
2964
+ /**
2965
+ * Options for controlling the behavior of save graph operations.
2966
+ */
2935
2967
  interface SaveGraphOptions {
2936
2968
  /** Remove existing collection members that are not present in the payload */
2937
2969
  pruneMissing?: boolean;
@@ -4998,10 +5030,45 @@ declare const createEntityProxy: <TTable extends TableDef, TLazy extends keyof R
4998
5030
  */
4999
5031
  declare const createEntityFromRow: <TTable extends TableDef, TResult extends EntityInstance<TTable> = EntityInstance<TTable>>(ctx: EntityContext, table: TTable, row: Record<string, unknown>, lazyRelations?: (keyof RelationMap<TTable>)[]) => TResult;
5000
5032
 
5033
+ /**
5034
+ * An array of database rows, each represented as a record of string keys to unknown values.
5035
+ */
5001
5036
  type Rows$3 = Record<string, unknown>[];
5037
+ /**
5038
+ * Loads related entities for a has-many relation in batch.
5039
+ * @param ctx - The entity context.
5040
+ * @param rootTable - The root table of the relation.
5041
+ * @param _relationName - The name of the relation (unused).
5042
+ * @param relation - The has-many relation definition.
5043
+ * @returns A promise resolving to a map of root keys to arrays of related rows.
5044
+ */
5002
5045
  declare const loadHasManyRelation: (ctx: EntityContext, rootTable: TableDef, _relationName: string, relation: HasManyRelation) => Promise<Map<string, Rows$3>>;
5046
+ /**
5047
+ * Loads related entities for a has-one relation in batch.
5048
+ * @param ctx - The entity context.
5049
+ * @param rootTable - The root table of the relation.
5050
+ * @param _relationName - The name of the relation (unused).
5051
+ * @param relation - The has-one relation definition.
5052
+ * @returns A promise resolving to a map of root keys to single related rows.
5053
+ */
5003
5054
  declare const loadHasOneRelation: (ctx: EntityContext, rootTable: TableDef, _relationName: string, relation: HasOneRelation) => Promise<Map<string, Record<string, unknown>>>;
5055
+ /**
5056
+ * Loads related entities for a belongs-to relation in batch.
5057
+ * @param ctx - The entity context.
5058
+ * @param rootTable - The root table of the relation.
5059
+ * @param _relationName - The name of the relation (unused).
5060
+ * @param relation - The belongs-to relation definition.
5061
+ * @returns A promise resolving to a map of foreign keys to single related rows.
5062
+ */
5004
5063
  declare const loadBelongsToRelation: (ctx: EntityContext, rootTable: TableDef, _relationName: string, relation: BelongsToRelation) => Promise<Map<string, Record<string, unknown>>>;
5064
+ /**
5065
+ * Loads related entities for a belongs-to-many relation in batch, including pivot data.
5066
+ * @param ctx - The entity context.
5067
+ * @param rootTable - The root table of the relation.
5068
+ * @param _relationName - The name of the relation (unused).
5069
+ * @param relation - The belongs-to-many relation definition.
5070
+ * @returns A promise resolving to a map of root keys to arrays of related rows with pivot data.
5071
+ */
5005
5072
  declare const loadBelongsToManyRelation: (ctx: EntityContext, rootTable: TableDef, _relationName: string, relation: BelongsToManyRelation) => Promise<Map<string, Rows$3>>;
5006
5073
 
5007
5074
  /**
@@ -5206,6 +5273,7 @@ declare function Entity(options?: EntityOptions): DualModeClassDecorator;
5206
5273
  interface ColumnOptions {
5207
5274
  type: ColumnType;
5208
5275
  args?: ColumnDef['args'];
5276
+ dialectTypes?: ColumnDef['dialectTypes'];
5209
5277
  notNull?: boolean;
5210
5278
  primary?: boolean;
5211
5279
  tsType?: ColumnDef['tsType'];
@@ -5459,4 +5527,4 @@ type PooledExecutorFactoryOptions<TConn> = {
5459
5527
  */
5460
5528
  declare function createPooledExecutorFactory<TConn>(opts: PooledExecutorFactoryOptions<TConn>): DbExecutorFactory;
5461
5529
 
5462
- export { type AliasRefNode, type AnyDomainEvent, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToRelation, type BetweenExpressionNode, type BinaryExpressionNode, type CascadeMode, type CaseExpressionNode, type CheckConstraint, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityOptions, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type InExpressionRight, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, InsertQueryBuilder, type IntrospectOptions, type JsonPathNode, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SimpleQueryRunner, SqlServerDialect, type SqliteClientLike, SqliteDialect, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeScriptGenerator, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, aliasRef, and, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bootstrapEntities, caseWhen, ceil, ceiling, char, charLength, clearExpressionDispatchers, clearOperandDispatchers, col, columnOperand, concat, concatWs, correlateBy, cos, cot, count, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, denseRank, diffSchema, div, endOfMonth, entityRef, eq, esel, executeHydrated, executeHydratedWithContexts, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, getColumn, getSchemaIntrospector, getTableDefFromEntity, groupConcat, gt, gte, hasMany, hasOne, hydrateRows, inList, inSubquery, instr, introspectSchema, isCaseExpressionNode, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isOperandNode, isValueOperandInput, isWindowFunctionNode, jsonPath, lag, lastValue, lead, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, locate, log, log10, logBase, lower, lpad, lt, lte, ltrim, max, min, mod, month, mul, neq, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, or, outerRef, pi, position, pow, power, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, renderColumnDefinition, repeat, replace, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, sel, selectFromEntity, sign, sin, space, sqrt, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, upper, utcNow, valueToOperand, visitExpression, visitOperand, weekOfYear, windowFunction, year };
5530
+ export { type AliasRefNode, type AnyDomainEvent, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToRelation, type BetweenExpressionNode, type BinaryExpressionNode, type CascadeMode, type CaseExpressionNode, type CheckConstraint, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityOptions, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type InExpressionRight, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, InsertQueryBuilder, type IntrospectOptions, type JsonPathNode, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, STANDARD_COLUMN_TYPES, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SimpleQueryRunner, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeScriptGenerator, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, aliasRef, and, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bootstrapEntities, caseWhen, ceil, ceiling, char, charLength, clearExpressionDispatchers, clearOperandDispatchers, col, columnOperand, concat, concatWs, correlateBy, cos, cot, count, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, denseRank, diffSchema, div, endOfMonth, entityRef, eq, esel, executeHydrated, executeHydratedWithContexts, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, getColumn, getSchemaIntrospector, getTableDefFromEntity, groupConcat, gt, gte, hasMany, hasOne, hydrateRows, inList, inSubquery, instr, introspectSchema, isCaseExpressionNode, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isOperandNode, isValueOperandInput, isWindowFunctionNode, jsonPath, lag, lastValue, lead, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, locate, log, log10, logBase, lower, lpad, lt, lte, ltrim, max, min, mod, month, mul, neq, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, or, outerRef, pi, position, pow, power, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, renderColumnDefinition, renderTypeWithArgs, repeat, replace, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, sel, selectFromEntity, sign, sin, space, sqrt, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, upper, utcNow, valueToOperand, visitExpression, visitOperand, weekOfYear, windowFunction, year };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,24 @@
1
1
  /**
2
- * Supported column data types for database schema definitions
2
+ * Canonical, dialect-agnostic column data types.
3
+ * Keep this intentionally small; dialect-specific names should be expressed via `dialectTypes`.
3
4
  */
4
- type ColumnType = 'INT' | 'INTEGER' | 'BIGINT' | 'VARCHAR' | 'TEXT' | 'JSON' | 'ENUM' | 'DECIMAL' | 'FLOAT' | 'DOUBLE' | 'UUID' | 'BINARY' | 'VARBINARY' | 'BLOB' | 'BYTEA' | 'DATE' | 'DATETIME' | 'TIMESTAMP' | 'TIMESTAMPTZ' | 'BOOLEAN' | 'int' | 'integer' | 'bigint' | 'varchar' | 'text' | 'json' | 'enum' | 'decimal' | 'float' | 'double' | 'uuid' | 'binary' | 'varbinary' | 'blob' | 'bytea' | 'date' | 'datetime' | 'timestamp' | 'timestamptz' | 'boolean';
5
+ declare const STANDARD_COLUMN_TYPES: readonly ["INT", "INTEGER", "BIGINT", "VARCHAR", "TEXT", "JSON", "ENUM", "DECIMAL", "FLOAT", "DOUBLE", "UUID", "BINARY", "VARBINARY", "BLOB", "DATE", "DATETIME", "TIMESTAMP", "TIMESTAMPTZ", "BOOLEAN"];
6
+ /** Known logical types the ORM understands. */
7
+ type StandardColumnType = (typeof STANDARD_COLUMN_TYPES)[number];
8
+ /**
9
+ * Column type value.
10
+ * We allow arbitrary strings so new/dialect-specific types don't require touching this module.
11
+ */
12
+ type ColumnType = StandardColumnType | (string & {});
13
+ /**
14
+ * Normalizes a column type to its canonical lowercase form when it's one of the known logical types.
15
+ * Unknown/custom types are returned untouched to avoid clobbering dialect-specific casing.
16
+ */
17
+ declare const normalizeColumnType: (type: ColumnType) => ColumnType;
18
+ /**
19
+ * Renders a raw SQL type name with optional parameters.
20
+ */
21
+ declare const renderTypeWithArgs: (sqlType: string, args?: unknown[]) => string;
5
22
  type ReferentialAction = 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET DEFAULT';
6
23
  interface RawDefaultValue {
7
24
  raw: string;
@@ -29,6 +46,8 @@ interface ColumnDef<T extends ColumnType = ColumnType, TRuntime = unknown> {
29
46
  name: string;
30
47
  /** Data type of the column */
31
48
  type: T;
49
+ /** Optional explicit SQL type per dialect (e.g., { postgres: 'bytea' }) */
50
+ dialectTypes?: Partial<Record<string, string>>;
32
51
  /** Optional override for the inferred TypeScript type */
33
52
  tsType?: TRuntime;
34
53
  /** Whether this column is a primary key */
@@ -132,6 +151,15 @@ declare const col: {
132
151
  * @param values - Enum values
133
152
  */
134
153
  enum: (values: string[]) => ColumnDef<"ENUM">;
154
+ /**
155
+ * Creates a column definition with a custom SQL type.
156
+ * Useful for dialect-specific types without polluting the standard set.
157
+ */
158
+ custom: (type: string, opts?: {
159
+ dialect?: string;
160
+ args?: unknown[];
161
+ tsType?: unknown;
162
+ }) => ColumnDef;
135
163
  /**
136
164
  * Marks a column definition as a primary key
137
165
  * @param def - Column definition to modify
@@ -407,12 +435,13 @@ declare function getColumn<T extends TableDef>(table: T, key: string): ColumnDef
407
435
  * Resolves a relation definition to its target table type.
408
436
  */
409
437
  type RelationTargetTable<TRel extends RelationDef> = TRel extends HasManyRelation<infer TTarget> ? TTarget : TRel extends HasOneRelation<infer TTarget> ? TTarget : TRel extends BelongsToRelation<infer TTarget> ? TTarget : TRel extends BelongsToManyRelation<infer TTarget> ? TTarget : never;
438
+ type NormalizedColumnType<T extends ColumnDef> = Lowercase<T['type'] & string>;
410
439
  /**
411
440
  * Maps a ColumnDef to its TypeScript type representation
412
441
  */
413
442
  type ColumnToTs<T extends ColumnDef> = [
414
443
  unknown
415
- ] extends [T['tsType']] ? T['type'] extends 'INT' | 'INTEGER' | 'int' | 'integer' ? number : T['type'] extends 'BIGINT' | 'bigint' ? number | bigint : T['type'] extends 'DECIMAL' | 'decimal' | 'FLOAT' | 'float' | 'DOUBLE' | 'double' ? number : T['type'] extends 'BOOLEAN' | 'boolean' ? boolean : T['type'] extends 'JSON' | 'json' ? unknown : T['type'] extends 'BLOB' | 'blob' | 'BINARY' | 'binary' | 'VARBINARY' | 'varbinary' | 'BYTEA' | 'bytea' ? Buffer : T['type'] extends 'DATE' | 'date' | 'DATETIME' | 'datetime' | 'TIMESTAMP' | 'timestamp' | 'TIMESTAMPTZ' | 'timestamptz' ? string : string : Exclude<T['tsType'], undefined>;
444
+ ] extends [T['tsType']] ? NormalizedColumnType<T> extends 'int' | 'integer' ? number : NormalizedColumnType<T> extends 'bigint' ? number | bigint : NormalizedColumnType<T> extends 'decimal' | 'float' | 'double' ? number : NormalizedColumnType<T> extends 'boolean' ? boolean : NormalizedColumnType<T> extends 'json' ? unknown : NormalizedColumnType<T> extends 'blob' | 'binary' | 'varbinary' | 'bytea' ? Buffer : NormalizedColumnType<T> extends 'date' | 'datetime' | 'timestamp' | 'timestamptz' ? string : string : Exclude<T['tsType'], undefined>;
416
445
  /**
417
446
  * Infers a row shape from a table definition
418
447
  */
@@ -2932,6 +2961,9 @@ interface HydrationContext<E extends DomainEvent = AnyDomainEvent> {
2932
2961
  entityContext: EntityContext;
2933
2962
  }
2934
2963
 
2964
+ /**
2965
+ * Options for controlling the behavior of save graph operations.
2966
+ */
2935
2967
  interface SaveGraphOptions {
2936
2968
  /** Remove existing collection members that are not present in the payload */
2937
2969
  pruneMissing?: boolean;
@@ -4998,10 +5030,45 @@ declare const createEntityProxy: <TTable extends TableDef, TLazy extends keyof R
4998
5030
  */
4999
5031
  declare const createEntityFromRow: <TTable extends TableDef, TResult extends EntityInstance<TTable> = EntityInstance<TTable>>(ctx: EntityContext, table: TTable, row: Record<string, unknown>, lazyRelations?: (keyof RelationMap<TTable>)[]) => TResult;
5000
5032
 
5033
+ /**
5034
+ * An array of database rows, each represented as a record of string keys to unknown values.
5035
+ */
5001
5036
  type Rows$3 = Record<string, unknown>[];
5037
+ /**
5038
+ * Loads related entities for a has-many relation in batch.
5039
+ * @param ctx - The entity context.
5040
+ * @param rootTable - The root table of the relation.
5041
+ * @param _relationName - The name of the relation (unused).
5042
+ * @param relation - The has-many relation definition.
5043
+ * @returns A promise resolving to a map of root keys to arrays of related rows.
5044
+ */
5002
5045
  declare const loadHasManyRelation: (ctx: EntityContext, rootTable: TableDef, _relationName: string, relation: HasManyRelation) => Promise<Map<string, Rows$3>>;
5046
+ /**
5047
+ * Loads related entities for a has-one relation in batch.
5048
+ * @param ctx - The entity context.
5049
+ * @param rootTable - The root table of the relation.
5050
+ * @param _relationName - The name of the relation (unused).
5051
+ * @param relation - The has-one relation definition.
5052
+ * @returns A promise resolving to a map of root keys to single related rows.
5053
+ */
5003
5054
  declare const loadHasOneRelation: (ctx: EntityContext, rootTable: TableDef, _relationName: string, relation: HasOneRelation) => Promise<Map<string, Record<string, unknown>>>;
5055
+ /**
5056
+ * Loads related entities for a belongs-to relation in batch.
5057
+ * @param ctx - The entity context.
5058
+ * @param rootTable - The root table of the relation.
5059
+ * @param _relationName - The name of the relation (unused).
5060
+ * @param relation - The belongs-to relation definition.
5061
+ * @returns A promise resolving to a map of foreign keys to single related rows.
5062
+ */
5004
5063
  declare const loadBelongsToRelation: (ctx: EntityContext, rootTable: TableDef, _relationName: string, relation: BelongsToRelation) => Promise<Map<string, Record<string, unknown>>>;
5064
+ /**
5065
+ * Loads related entities for a belongs-to-many relation in batch, including pivot data.
5066
+ * @param ctx - The entity context.
5067
+ * @param rootTable - The root table of the relation.
5068
+ * @param _relationName - The name of the relation (unused).
5069
+ * @param relation - The belongs-to-many relation definition.
5070
+ * @returns A promise resolving to a map of root keys to arrays of related rows with pivot data.
5071
+ */
5005
5072
  declare const loadBelongsToManyRelation: (ctx: EntityContext, rootTable: TableDef, _relationName: string, relation: BelongsToManyRelation) => Promise<Map<string, Rows$3>>;
5006
5073
 
5007
5074
  /**
@@ -5206,6 +5273,7 @@ declare function Entity(options?: EntityOptions): DualModeClassDecorator;
5206
5273
  interface ColumnOptions {
5207
5274
  type: ColumnType;
5208
5275
  args?: ColumnDef['args'];
5276
+ dialectTypes?: ColumnDef['dialectTypes'];
5209
5277
  notNull?: boolean;
5210
5278
  primary?: boolean;
5211
5279
  tsType?: ColumnDef['tsType'];
@@ -5459,4 +5527,4 @@ type PooledExecutorFactoryOptions<TConn> = {
5459
5527
  */
5460
5528
  declare function createPooledExecutorFactory<TConn>(opts: PooledExecutorFactoryOptions<TConn>): DbExecutorFactory;
5461
5529
 
5462
- export { type AliasRefNode, type AnyDomainEvent, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToRelation, type BetweenExpressionNode, type BinaryExpressionNode, type CascadeMode, type CaseExpressionNode, type CheckConstraint, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityOptions, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type InExpressionRight, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, InsertQueryBuilder, type IntrospectOptions, type JsonPathNode, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SimpleQueryRunner, SqlServerDialect, type SqliteClientLike, SqliteDialect, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeScriptGenerator, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, aliasRef, and, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bootstrapEntities, caseWhen, ceil, ceiling, char, charLength, clearExpressionDispatchers, clearOperandDispatchers, col, columnOperand, concat, concatWs, correlateBy, cos, cot, count, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, denseRank, diffSchema, div, endOfMonth, entityRef, eq, esel, executeHydrated, executeHydratedWithContexts, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, getColumn, getSchemaIntrospector, getTableDefFromEntity, groupConcat, gt, gte, hasMany, hasOne, hydrateRows, inList, inSubquery, instr, introspectSchema, isCaseExpressionNode, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isOperandNode, isValueOperandInput, isWindowFunctionNode, jsonPath, lag, lastValue, lead, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, locate, log, log10, logBase, lower, lpad, lt, lte, ltrim, max, min, mod, month, mul, neq, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, or, outerRef, pi, position, pow, power, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, renderColumnDefinition, repeat, replace, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, sel, selectFromEntity, sign, sin, space, sqrt, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, upper, utcNow, valueToOperand, visitExpression, visitOperand, weekOfYear, windowFunction, year };
5530
+ export { type AliasRefNode, type AnyDomainEvent, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToRelation, type BetweenExpressionNode, type BinaryExpressionNode, type CascadeMode, type CaseExpressionNode, type CheckConstraint, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityOptions, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type InExpressionRight, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, InsertQueryBuilder, type IntrospectOptions, type JsonPathNode, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, STANDARD_COLUMN_TYPES, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SimpleQueryRunner, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeScriptGenerator, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, aliasRef, and, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bootstrapEntities, caseWhen, ceil, ceiling, char, charLength, clearExpressionDispatchers, clearOperandDispatchers, col, columnOperand, concat, concatWs, correlateBy, cos, cot, count, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, denseRank, diffSchema, div, endOfMonth, entityRef, eq, esel, executeHydrated, executeHydratedWithContexts, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, getColumn, getSchemaIntrospector, getTableDefFromEntity, groupConcat, gt, gte, hasMany, hasOne, hydrateRows, inList, inSubquery, instr, introspectSchema, isCaseExpressionNode, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isOperandNode, isValueOperandInput, isWindowFunctionNode, jsonPath, lag, lastValue, lead, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, locate, log, log10, logBase, lower, lpad, lt, lte, ltrim, max, min, mod, month, mul, neq, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, or, outerRef, pi, position, pow, power, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, renderColumnDefinition, renderTypeWithArgs, repeat, replace, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, sel, selectFromEntity, sign, sin, space, sqrt, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, upper, utcNow, valueToOperand, visitExpression, visitOperand, weekOfYear, windowFunction, year };
package/dist/index.js CHANGED
@@ -111,7 +111,38 @@ function getColumn(table, key) {
111
111
  return col2;
112
112
  }
113
113
 
114
- // src/schema/column.ts
114
+ // src/schema/column-types.ts
115
+ var STANDARD_COLUMN_TYPES = [
116
+ "INT",
117
+ "INTEGER",
118
+ "BIGINT",
119
+ "VARCHAR",
120
+ "TEXT",
121
+ "JSON",
122
+ "ENUM",
123
+ "DECIMAL",
124
+ "FLOAT",
125
+ "DOUBLE",
126
+ "UUID",
127
+ "BINARY",
128
+ "VARBINARY",
129
+ "BLOB",
130
+ "DATE",
131
+ "DATETIME",
132
+ "TIMESTAMP",
133
+ "TIMESTAMPTZ",
134
+ "BOOLEAN"
135
+ ];
136
+ var STANDARD_TYPE_SET = new Set(STANDARD_COLUMN_TYPES.map((t) => t.toLowerCase()));
137
+ var normalizeColumnType = (type) => {
138
+ if (typeof type !== "string") return type;
139
+ const lower2 = type.toLowerCase();
140
+ return STANDARD_TYPE_SET.has(lower2) ? lower2 : type;
141
+ };
142
+ var renderTypeWithArgs = (sqlType, args) => {
143
+ if (!args || args.length === 0) return sqlType;
144
+ return `${sqlType}(${args.join(", ")})`;
145
+ };
115
146
  var col = {
116
147
  /**
117
148
  * Creates an integer column definition
@@ -171,7 +202,10 @@ var col = {
171
202
  /**
172
203
  * Creates a Postgres bytea column definition
173
204
  */
174
- bytea: () => ({ name: "", type: "BYTEA" }),
205
+ bytea: () => ({
206
+ name: "",
207
+ type: "BYTEA"
208
+ }),
175
209
  /**
176
210
  * Creates a timestamp column definition
177
211
  */
@@ -203,6 +237,17 @@ var col = {
203
237
  * @param values - Enum values
204
238
  */
205
239
  enum: (values) => ({ name: "", type: "ENUM", args: values }),
240
+ /**
241
+ * Creates a column definition with a custom SQL type.
242
+ * Useful for dialect-specific types without polluting the standard set.
243
+ */
244
+ custom: (type, opts = {}) => ({
245
+ name: "",
246
+ type,
247
+ args: opts.args,
248
+ tsType: opts.tsType,
249
+ dialectTypes: opts.dialect ? { [opts.dialect]: type } : void 0
250
+ }),
206
251
  /**
207
252
  * Marks a column definition as a primary key
208
253
  * @param def - Column definition to modify
@@ -6941,7 +6986,23 @@ var mssqlIntrospector = {
6941
6986
  sch.name AS table_schema,
6942
6987
  t.name AS table_name,
6943
6988
  c.name AS column_name,
6944
- ty.name AS data_type,
6989
+ LOWER(ty.name)
6990
+ + CASE
6991
+ WHEN LOWER(ty.name) IN ('varchar', 'char', 'varbinary', 'binary', 'nvarchar', 'nchar') THEN
6992
+ '('
6993
+ + (
6994
+ CASE
6995
+ WHEN c.max_length = -1 THEN 'max'
6996
+ WHEN LOWER(ty.name) IN ('nvarchar', 'nchar') THEN CAST(c.max_length / 2 AS varchar(10))
6997
+ ELSE CAST(c.max_length AS varchar(10))
6998
+ END
6999
+ )
7000
+ + ')'
7001
+ WHEN LOWER(ty.name) IN ('decimal', 'numeric') THEN
7002
+ '(' + CAST(c.precision AS varchar(10)) + ',' + CAST(c.scale AS varchar(10)) + ')'
7003
+ ELSE
7004
+ ''
7005
+ END AS data_type,
6945
7006
  c.is_nullable,
6946
7007
  c.is_identity,
6947
7008
  object_definition(c.default_object_id) AS column_default
@@ -9033,13 +9094,14 @@ function Entity(options = {}) {
9033
9094
  return decoratorWithContext;
9034
9095
  }
9035
9096
 
9036
- // src/decorators/column.ts
9097
+ // src/decorators/column-decorator.ts
9037
9098
  var normalizeColumnInput = (input) => {
9038
9099
  const asOptions = input;
9039
9100
  const asDefinition = input;
9040
9101
  const column = {
9041
9102
  type: asOptions.type ?? asDefinition.type,
9042
9103
  args: asOptions.args ?? asDefinition.args,
9104
+ dialectTypes: asOptions.dialectTypes ?? asDefinition.dialectTypes,
9043
9105
  notNull: asOptions.notNull ?? asDefinition.notNull,
9044
9106
  primary: asOptions.primary ?? asDefinition.primary,
9045
9107
  tsType: asDefinition.tsType ?? asOptions.tsType,
@@ -9743,6 +9805,7 @@ export {
9743
9805
  PostgresDialect,
9744
9806
  PrimaryKey,
9745
9807
  RelationKinds,
9808
+ STANDARD_COLUMN_TYPES,
9746
9809
  SelectQueryBuilder,
9747
9810
  SqlServerDialect,
9748
9811
  SqliteDialect,
@@ -9865,6 +9928,7 @@ export {
9865
9928
  month,
9866
9929
  mul,
9867
9930
  neq,
9931
+ normalizeColumnType,
9868
9932
  notBetween,
9869
9933
  notExists,
9870
9934
  notInList,
@@ -9886,6 +9950,7 @@ export {
9886
9950
  registerOperandDispatcher,
9887
9951
  registerSchemaIntrospector,
9888
9952
  renderColumnDefinition,
9953
+ renderTypeWithArgs,
9889
9954
  repeat,
9890
9955
  replace,
9891
9956
  right,