metal-orm 1.0.99 → 1.0.101

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/index.d.cts CHANGED
@@ -3571,6 +3571,12 @@ type RelationInput<TEntity> = {
3571
3571
  * - Only entity scalar keys + relation keys are accepted.
3572
3572
  */
3573
3573
  type SaveGraphInputPayload<TEntity> = ColumnInput$1<TEntity> & RelationInput<TEntity>;
3574
+ /**
3575
+ * Typed payload accepted by `OrmSession.patchGraph`:
3576
+ * - All keys are optional (partial update semantics).
3577
+ * - Only entity scalar keys + relation keys are accepted.
3578
+ */
3579
+ type PatchGraphInputPayload<TEntity> = Partial<ColumnInput$1<TEntity>> & Partial<RelationInput<TEntity>>;
3574
3580
 
3575
3581
  /**
3576
3582
  * Interface for ORM interceptors that allow hooking into the flush lifecycle.
@@ -3770,6 +3776,15 @@ declare class OrmSession<E extends DomainEvent = OrmDomainEvent> implements Enti
3770
3776
  * @returns The root entity instance or null if not found
3771
3777
  */
3772
3778
  updateGraph<TCtor extends EntityConstructor<object>>(entityClass: TCtor, payload: SaveGraphInputPayload<InstanceType<TCtor>>, options?: SaveGraphSessionOptions): Promise<InstanceType<TCtor> | null>;
3779
+ /**
3780
+ * Patches an existing entity with partial data (requires a primary key in the payload).
3781
+ * Only the provided fields are updated; other fields remain unchanged.
3782
+ * @param entityClass - Root entity constructor
3783
+ * @param payload - Partial DTO payload containing column values and nested relations
3784
+ * @param options - Graph save options
3785
+ * @returns The patched entity instance or null if not found
3786
+ */
3787
+ patchGraph<TCtor extends EntityConstructor<object>>(entityClass: TCtor, payload: PatchGraphInputPayload<InstanceType<TCtor>>, options?: SaveGraphSessionOptions): Promise<InstanceType<TCtor> | null>;
3773
3788
  /**
3774
3789
  * Persists an entity (either inserts or updates).
3775
3790
  * @param entity - The entity to persist
@@ -4985,7 +5000,11 @@ declare abstract class SqlDialectBase extends Dialect {
4985
5000
  private compileInsertColumnList;
4986
5001
  private compileSelectCore;
4987
5002
  protected compileUpdateAst(ast: UpdateQueryNode, ctx: CompilerContext): string;
4988
- private compileUpdateAssignments;
5003
+ protected compileUpdateAssignments(assignments: {
5004
+ column: ColumnNode;
5005
+ value: OperandNode;
5006
+ }[], table: TableNode, ctx: CompilerContext): string;
5007
+ protected compileSetTarget(column: ColumnNode, table: TableNode): string;
4989
5008
  protected compileQualifiedColumn(column: ColumnNode, table: TableNode): string;
4990
5009
  protected compileDeleteAst(ast: DeleteQueryNode, ctx: CompilerContext): string;
4991
5010
  protected formatReturningColumns(returning: ColumnNode[]): string;
@@ -5129,6 +5148,10 @@ declare class PostgresDialect extends SqlDialectBase {
5129
5148
  protected compileJsonPath(node: JsonPathNode): string;
5130
5149
  protected compileReturning(returning: ColumnNode[] | undefined, ctx: CompilerContext): string;
5131
5150
  supportsReturning(): boolean;
5151
+ /**
5152
+ * PostgreSQL requires unqualified column names in SET clause
5153
+ */
5154
+ protected compileSetTarget(column: ColumnNode, _table: TableNode): string;
5132
5155
  }
5133
5156
 
5134
5157
  /** Represents the differences detected in a database column's properties. */
@@ -8057,4 +8080,4 @@ declare const paginationParamsSchema: OpenApiSchema;
8057
8080
  declare function toPaginationParams(): OpenApiParameter[];
8058
8081
  declare function pagedResponseToOpenApiSchema<T extends OpenApiSchema>(itemSchema: T): OpenApiSchema;
8059
8082
 
8060
- export { type AliasRefNode, Alphanumeric, type AnyDomainEvent, type ApiRouteDefinition, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, type AutoCorrectionResult, type AutoTransformResult, type AutoTransformableValidator, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetweenExpressionNode, BigIntTypeStrategy, type BinaryExpressionNode, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, CEP, CNPJ, CPF, Capitalize, type CascadeMode, type CaseExpressionNode, type CastExpressionNode, type CheckConstraint, type CollateExpressionNode, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type ComponentOptions, type ComponentReference, type CompositeTransformer, ConstructorMaterializationStrategy, type ValidationResult as CountryValidationResult, type CountryValidator, type CountryValidatorFactory, type CreateDto, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, Email, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneReferenceApi, 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, IntegerTypeStrategy, InterceptorPipeline, type IntrospectOptions, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, Length, type LiteralNode, type LiteralValue, type LogicalExpressionNode, Lower, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NullExpressionNode, type NumberFilter, type OpenApiComponent, type OpenApiDialect, type OpenApiDocument, type OpenApiDocumentInfo, type OpenApiDocumentOptions, type OpenApiOperation, type OpenApiParameter, type OpenApiParameterObject, type OpenApiResponseObject, type OpenApiSchema, type OpenApiType, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PagedResponse, type PaginatedResult, type PaginationParams, Pattern, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, type PropertySanitizer, type PropertyTransformer, type PropertyValidator, PrototypeMaterializationStrategy, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey$1 as RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, STANDARD_COLUMN_TYPES, type SaveGraphInputPayload, type SaveGraphInputScalar, type SaveGraphJsonScalar, type SaveGraphSessionOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SelectableKeys, type SimpleQueryRunner, type SimpleWhereInput, type Simplify, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type StringFilter, StringTypeStrategy, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, Title, type TrackedEntity, type TransformContext, type TransformerConfig, type TransformerMetadata, Trim, TypeMappingService, type TypeMappingStrategy, TypeScriptGenerator, type TypedExpression, type TypedLike, type UpdateDto, UpdateQueryBuilder, Upper, UuidTypeStrategy, type ValidationOptions, type ValidationResult$1 as ValidationResult, type ValidatorFactoryOptions, type ValueOperandInput, type WhereInput, type WindowFunctionNode, type WithRelations, abs, acos, add, addDomainEvent, age, aliasRef, and, applyFilter, applyNullability, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterExpression, calculateTotalPages, canonicalizeSchema, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, columnToFilterSchema, columnToOpenApiSchema, columnTypeToOpenApiFormat, columnTypeToOpenApiType, computePaginationMetadata, computeSchemaHash, concat, concatWs, correlateBy, cos, cot, count, countAll, createApiComponentsSection, createDeterministicNamingState, createDtoToOpenApiSchema, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createRef, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, exclude, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, firstValue, floor, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, getColumn, getColumnMap, getColumnType, getDateKind, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getRegisteredValidators, getSchemaIntrospector, getTableDefFromEntity, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hasValidator, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isNullableColumn, isOperandNode, isTableDef, isValueOperandInput, isWindowFunctionNode, jsonArrayAgg, jsonContains, jsonLength, jsonPath, jsonSet, jsonify, lag, lastValue, lead, least, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, localTime, localTimestamp, locate, log, log10, log2, logBase, lower, lpad, lt, lte, ltrim, mapFields, materializeAs, max, md5, mergeSchemas, min, minute, mod, month, mul, neq, nestedDtoToOpenApiSchema, nestedWhereInputToOpenApiSchema, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pagedResponseToOpenApiSchema, paginationParamsSchema, parameterToRef, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, registerValidator, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, resolveValidator, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };
8083
+ export { type AliasRefNode, Alphanumeric, type AnyDomainEvent, type ApiRouteDefinition, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, type AutoCorrectionResult, type AutoTransformResult, type AutoTransformableValidator, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetweenExpressionNode, BigIntTypeStrategy, type BinaryExpressionNode, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, CEP, CNPJ, CPF, Capitalize, type CascadeMode, type CaseExpressionNode, type CastExpressionNode, type CheckConstraint, type CollateExpressionNode, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type ComponentOptions, type ComponentReference, type CompositeTransformer, ConstructorMaterializationStrategy, type ValidationResult as CountryValidationResult, type CountryValidator, type CountryValidatorFactory, type CreateDto, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, Email, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneReferenceApi, 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, IntegerTypeStrategy, InterceptorPipeline, type IntrospectOptions, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, Length, type LiteralNode, type LiteralValue, type LogicalExpressionNode, Lower, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NullExpressionNode, type NumberFilter, type OpenApiComponent, type OpenApiDialect, type OpenApiDocument, type OpenApiDocumentInfo, type OpenApiDocumentOptions, type OpenApiOperation, type OpenApiParameter, type OpenApiParameterObject, type OpenApiResponseObject, type OpenApiSchema, type OpenApiType, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PagedResponse, type PaginatedResult, type PaginationParams, type PatchGraphInputPayload, Pattern, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, type PropertySanitizer, type PropertyTransformer, type PropertyValidator, PrototypeMaterializationStrategy, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey$1 as RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, STANDARD_COLUMN_TYPES, type SaveGraphInputPayload, type SaveGraphInputScalar, type SaveGraphJsonScalar, type SaveGraphSessionOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SelectableKeys, type SimpleQueryRunner, type SimpleWhereInput, type Simplify, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type StringFilter, StringTypeStrategy, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, Title, type TrackedEntity, type TransformContext, type TransformerConfig, type TransformerMetadata, Trim, TypeMappingService, type TypeMappingStrategy, TypeScriptGenerator, type TypedExpression, type TypedLike, type UpdateDto, UpdateQueryBuilder, Upper, UuidTypeStrategy, type ValidationOptions, type ValidationResult$1 as ValidationResult, type ValidatorFactoryOptions, type ValueOperandInput, type WhereInput, type WindowFunctionNode, type WithRelations, abs, acos, add, addDomainEvent, age, aliasRef, and, applyFilter, applyNullability, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterExpression, calculateTotalPages, canonicalizeSchema, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, columnToFilterSchema, columnToOpenApiSchema, columnTypeToOpenApiFormat, columnTypeToOpenApiType, computePaginationMetadata, computeSchemaHash, concat, concatWs, correlateBy, cos, cot, count, countAll, createApiComponentsSection, createDeterministicNamingState, createDtoToOpenApiSchema, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createRef, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, exclude, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, firstValue, floor, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, getColumn, getColumnMap, getColumnType, getDateKind, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getRegisteredValidators, getSchemaIntrospector, getTableDefFromEntity, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hasValidator, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isNullableColumn, isOperandNode, isTableDef, isValueOperandInput, isWindowFunctionNode, jsonArrayAgg, jsonContains, jsonLength, jsonPath, jsonSet, jsonify, lag, lastValue, lead, least, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, localTime, localTimestamp, locate, log, log10, log2, logBase, lower, lpad, lt, lte, ltrim, mapFields, materializeAs, max, md5, mergeSchemas, min, minute, mod, month, mul, neq, nestedDtoToOpenApiSchema, nestedWhereInputToOpenApiSchema, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pagedResponseToOpenApiSchema, paginationParamsSchema, parameterToRef, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, registerValidator, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, resolveValidator, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };
package/dist/index.d.ts CHANGED
@@ -3571,6 +3571,12 @@ type RelationInput<TEntity> = {
3571
3571
  * - Only entity scalar keys + relation keys are accepted.
3572
3572
  */
3573
3573
  type SaveGraphInputPayload<TEntity> = ColumnInput$1<TEntity> & RelationInput<TEntity>;
3574
+ /**
3575
+ * Typed payload accepted by `OrmSession.patchGraph`:
3576
+ * - All keys are optional (partial update semantics).
3577
+ * - Only entity scalar keys + relation keys are accepted.
3578
+ */
3579
+ type PatchGraphInputPayload<TEntity> = Partial<ColumnInput$1<TEntity>> & Partial<RelationInput<TEntity>>;
3574
3580
 
3575
3581
  /**
3576
3582
  * Interface for ORM interceptors that allow hooking into the flush lifecycle.
@@ -3770,6 +3776,15 @@ declare class OrmSession<E extends DomainEvent = OrmDomainEvent> implements Enti
3770
3776
  * @returns The root entity instance or null if not found
3771
3777
  */
3772
3778
  updateGraph<TCtor extends EntityConstructor<object>>(entityClass: TCtor, payload: SaveGraphInputPayload<InstanceType<TCtor>>, options?: SaveGraphSessionOptions): Promise<InstanceType<TCtor> | null>;
3779
+ /**
3780
+ * Patches an existing entity with partial data (requires a primary key in the payload).
3781
+ * Only the provided fields are updated; other fields remain unchanged.
3782
+ * @param entityClass - Root entity constructor
3783
+ * @param payload - Partial DTO payload containing column values and nested relations
3784
+ * @param options - Graph save options
3785
+ * @returns The patched entity instance or null if not found
3786
+ */
3787
+ patchGraph<TCtor extends EntityConstructor<object>>(entityClass: TCtor, payload: PatchGraphInputPayload<InstanceType<TCtor>>, options?: SaveGraphSessionOptions): Promise<InstanceType<TCtor> | null>;
3773
3788
  /**
3774
3789
  * Persists an entity (either inserts or updates).
3775
3790
  * @param entity - The entity to persist
@@ -4985,7 +5000,11 @@ declare abstract class SqlDialectBase extends Dialect {
4985
5000
  private compileInsertColumnList;
4986
5001
  private compileSelectCore;
4987
5002
  protected compileUpdateAst(ast: UpdateQueryNode, ctx: CompilerContext): string;
4988
- private compileUpdateAssignments;
5003
+ protected compileUpdateAssignments(assignments: {
5004
+ column: ColumnNode;
5005
+ value: OperandNode;
5006
+ }[], table: TableNode, ctx: CompilerContext): string;
5007
+ protected compileSetTarget(column: ColumnNode, table: TableNode): string;
4989
5008
  protected compileQualifiedColumn(column: ColumnNode, table: TableNode): string;
4990
5009
  protected compileDeleteAst(ast: DeleteQueryNode, ctx: CompilerContext): string;
4991
5010
  protected formatReturningColumns(returning: ColumnNode[]): string;
@@ -5129,6 +5148,10 @@ declare class PostgresDialect extends SqlDialectBase {
5129
5148
  protected compileJsonPath(node: JsonPathNode): string;
5130
5149
  protected compileReturning(returning: ColumnNode[] | undefined, ctx: CompilerContext): string;
5131
5150
  supportsReturning(): boolean;
5151
+ /**
5152
+ * PostgreSQL requires unqualified column names in SET clause
5153
+ */
5154
+ protected compileSetTarget(column: ColumnNode, _table: TableNode): string;
5132
5155
  }
5133
5156
 
5134
5157
  /** Represents the differences detected in a database column's properties. */
@@ -8057,4 +8080,4 @@ declare const paginationParamsSchema: OpenApiSchema;
8057
8080
  declare function toPaginationParams(): OpenApiParameter[];
8058
8081
  declare function pagedResponseToOpenApiSchema<T extends OpenApiSchema>(itemSchema: T): OpenApiSchema;
8059
8082
 
8060
- export { type AliasRefNode, Alphanumeric, type AnyDomainEvent, type ApiRouteDefinition, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, type AutoCorrectionResult, type AutoTransformResult, type AutoTransformableValidator, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetweenExpressionNode, BigIntTypeStrategy, type BinaryExpressionNode, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, CEP, CNPJ, CPF, Capitalize, type CascadeMode, type CaseExpressionNode, type CastExpressionNode, type CheckConstraint, type CollateExpressionNode, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type ComponentOptions, type ComponentReference, type CompositeTransformer, ConstructorMaterializationStrategy, type ValidationResult as CountryValidationResult, type CountryValidator, type CountryValidatorFactory, type CreateDto, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, Email, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneReferenceApi, 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, IntegerTypeStrategy, InterceptorPipeline, type IntrospectOptions, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, Length, type LiteralNode, type LiteralValue, type LogicalExpressionNode, Lower, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NullExpressionNode, type NumberFilter, type OpenApiComponent, type OpenApiDialect, type OpenApiDocument, type OpenApiDocumentInfo, type OpenApiDocumentOptions, type OpenApiOperation, type OpenApiParameter, type OpenApiParameterObject, type OpenApiResponseObject, type OpenApiSchema, type OpenApiType, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PagedResponse, type PaginatedResult, type PaginationParams, Pattern, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, type PropertySanitizer, type PropertyTransformer, type PropertyValidator, PrototypeMaterializationStrategy, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey$1 as RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, STANDARD_COLUMN_TYPES, type SaveGraphInputPayload, type SaveGraphInputScalar, type SaveGraphJsonScalar, type SaveGraphSessionOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SelectableKeys, type SimpleQueryRunner, type SimpleWhereInput, type Simplify, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type StringFilter, StringTypeStrategy, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, Title, type TrackedEntity, type TransformContext, type TransformerConfig, type TransformerMetadata, Trim, TypeMappingService, type TypeMappingStrategy, TypeScriptGenerator, type TypedExpression, type TypedLike, type UpdateDto, UpdateQueryBuilder, Upper, UuidTypeStrategy, type ValidationOptions, type ValidationResult$1 as ValidationResult, type ValidatorFactoryOptions, type ValueOperandInput, type WhereInput, type WindowFunctionNode, type WithRelations, abs, acos, add, addDomainEvent, age, aliasRef, and, applyFilter, applyNullability, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterExpression, calculateTotalPages, canonicalizeSchema, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, columnToFilterSchema, columnToOpenApiSchema, columnTypeToOpenApiFormat, columnTypeToOpenApiType, computePaginationMetadata, computeSchemaHash, concat, concatWs, correlateBy, cos, cot, count, countAll, createApiComponentsSection, createDeterministicNamingState, createDtoToOpenApiSchema, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createRef, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, exclude, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, firstValue, floor, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, getColumn, getColumnMap, getColumnType, getDateKind, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getRegisteredValidators, getSchemaIntrospector, getTableDefFromEntity, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hasValidator, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isNullableColumn, isOperandNode, isTableDef, isValueOperandInput, isWindowFunctionNode, jsonArrayAgg, jsonContains, jsonLength, jsonPath, jsonSet, jsonify, lag, lastValue, lead, least, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, localTime, localTimestamp, locate, log, log10, log2, logBase, lower, lpad, lt, lte, ltrim, mapFields, materializeAs, max, md5, mergeSchemas, min, minute, mod, month, mul, neq, nestedDtoToOpenApiSchema, nestedWhereInputToOpenApiSchema, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pagedResponseToOpenApiSchema, paginationParamsSchema, parameterToRef, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, registerValidator, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, resolveValidator, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };
8083
+ export { type AliasRefNode, Alphanumeric, type AnyDomainEvent, type ApiRouteDefinition, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, type AutoCorrectionResult, type AutoTransformResult, type AutoTransformableValidator, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetweenExpressionNode, BigIntTypeStrategy, type BinaryExpressionNode, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, CEP, CNPJ, CPF, Capitalize, type CascadeMode, type CaseExpressionNode, type CastExpressionNode, type CheckConstraint, type CollateExpressionNode, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type ComponentOptions, type ComponentReference, type CompositeTransformer, ConstructorMaterializationStrategy, type ValidationResult as CountryValidationResult, type CountryValidator, type CountryValidatorFactory, type CreateDto, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, Email, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneReferenceApi, 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, IntegerTypeStrategy, InterceptorPipeline, type IntrospectOptions, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, Length, type LiteralNode, type LiteralValue, type LogicalExpressionNode, Lower, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NullExpressionNode, type NumberFilter, type OpenApiComponent, type OpenApiDialect, type OpenApiDocument, type OpenApiDocumentInfo, type OpenApiDocumentOptions, type OpenApiOperation, type OpenApiParameter, type OpenApiParameterObject, type OpenApiResponseObject, type OpenApiSchema, type OpenApiType, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PagedResponse, type PaginatedResult, type PaginationParams, type PatchGraphInputPayload, Pattern, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, type PropertySanitizer, type PropertyTransformer, type PropertyValidator, PrototypeMaterializationStrategy, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey$1 as RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, STANDARD_COLUMN_TYPES, type SaveGraphInputPayload, type SaveGraphInputScalar, type SaveGraphJsonScalar, type SaveGraphSessionOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SelectableKeys, type SimpleQueryRunner, type SimpleWhereInput, type Simplify, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type StringFilter, StringTypeStrategy, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, Title, type TrackedEntity, type TransformContext, type TransformerConfig, type TransformerMetadata, Trim, TypeMappingService, type TypeMappingStrategy, TypeScriptGenerator, type TypedExpression, type TypedLike, type UpdateDto, UpdateQueryBuilder, Upper, UuidTypeStrategy, type ValidationOptions, type ValidationResult$1 as ValidationResult, type ValidatorFactoryOptions, type ValueOperandInput, type WhereInput, type WindowFunctionNode, type WithRelations, abs, acos, add, addDomainEvent, age, aliasRef, and, applyFilter, applyNullability, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterExpression, calculateTotalPages, canonicalizeSchema, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, columnToFilterSchema, columnToOpenApiSchema, columnTypeToOpenApiFormat, columnTypeToOpenApiType, computePaginationMetadata, computeSchemaHash, concat, concatWs, correlateBy, cos, cot, count, countAll, createApiComponentsSection, createDeterministicNamingState, createDtoToOpenApiSchema, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createRef, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, exclude, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, firstValue, floor, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, getColumn, getColumnMap, getColumnType, getDateKind, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getRegisteredValidators, getSchemaIntrospector, getTableDefFromEntity, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hasValidator, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isNullableColumn, isOperandNode, isTableDef, isValueOperandInput, isWindowFunctionNode, jsonArrayAgg, jsonContains, jsonLength, jsonPath, jsonSet, jsonify, lag, lastValue, lead, least, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, localTime, localTimestamp, locate, log, log10, log2, logBase, lower, lpad, lt, lte, ltrim, mapFields, materializeAs, max, md5, mergeSchemas, min, minute, mod, month, mul, neq, nestedDtoToOpenApiSchema, nestedWhereInputToOpenApiSchema, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pagedResponseToOpenApiSchema, paginationParamsSchema, parameterToRef, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, registerValidator, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, resolveValidator, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };
package/dist/index.js CHANGED
@@ -1943,11 +1943,14 @@ var SqlDialectBase = class extends Dialect {
1943
1943
  compileUpdateAssignments(assignments, table, ctx) {
1944
1944
  return assignments.map((assignment) => {
1945
1945
  const col2 = assignment.column;
1946
- const target = this.compileQualifiedColumn(col2, table);
1946
+ const target = this.compileSetTarget(col2, table);
1947
1947
  const value = this.compileOperand(assignment.value, ctx);
1948
1948
  return `${target} = ${value}`;
1949
1949
  }).join(", ");
1950
1950
  }
1951
+ compileSetTarget(column, table) {
1952
+ return this.compileQualifiedColumn(column, table);
1953
+ }
1951
1954
  compileQualifiedColumn(column, table) {
1952
1955
  const baseTableName = table.name;
1953
1956
  const alias = table.alias;
@@ -2290,6 +2293,12 @@ var PostgresDialect = class extends SqlDialectBase {
2290
2293
  supportsReturning() {
2291
2294
  return true;
2292
2295
  }
2296
+ /**
2297
+ * PostgreSQL requires unqualified column names in SET clause
2298
+ */
2299
+ compileSetTarget(column, _table) {
2300
+ return this.quoteIdentifier(column.name);
2301
+ }
2293
2302
  };
2294
2303
 
2295
2304
  // src/core/dialect/mysql/functions.ts
@@ -11855,6 +11864,14 @@ var saveGraphInternal = async (session, entityClass, payload, options = {}) => {
11855
11864
  await applyGraphToEntity(session, table, root, payload, options);
11856
11865
  return root;
11857
11866
  };
11867
+ var patchGraphInternal = async (session, entityClass, existing, payload, options = {}) => {
11868
+ const table = getTableDefFromEntity(entityClass);
11869
+ if (!table) {
11870
+ throw new Error("Entity metadata has not been bootstrapped");
11871
+ }
11872
+ await applyGraphToEntity(session, table, existing, payload, options);
11873
+ return existing;
11874
+ };
11858
11875
 
11859
11876
  // src/orm/orm-session.ts
11860
11877
  var OrmSession = class {
@@ -12115,6 +12132,33 @@ var OrmSession = class {
12115
12132
  }
12116
12133
  return this.transaction(() => execute());
12117
12134
  }
12135
+ async patchGraph(entityClass, payload, options) {
12136
+ const table = getTableDefFromEntity(entityClass);
12137
+ if (!table) {
12138
+ throw new Error("Entity metadata has not been bootstrapped");
12139
+ }
12140
+ const primaryKey = findPrimaryKey(table);
12141
+ const pkValue = payload[primaryKey];
12142
+ if (pkValue === void 0 || pkValue === null) {
12143
+ throw new Error(`patchGraph requires a primary key value for "${primaryKey}"`);
12144
+ }
12145
+ const resolved = this.resolveSaveGraphOptions(options);
12146
+ const { transactional = true, flush = false, ...graphOptions } = resolved;
12147
+ const execute = async () => {
12148
+ const tracked = this.getEntity(table, pkValue);
12149
+ const existing = tracked ?? await this.find(entityClass, pkValue);
12150
+ if (!existing) return null;
12151
+ return patchGraphInternal(this, entityClass, existing, payload, graphOptions);
12152
+ };
12153
+ if (!transactional) {
12154
+ const result = await execute();
12155
+ if (result && flush) {
12156
+ await this.flush();
12157
+ }
12158
+ return result;
12159
+ }
12160
+ return this.transaction(() => execute());
12161
+ }
12118
12162
  /**
12119
12163
  * Persists an entity (either inserts or updates).
12120
12164
  * @param entity - The entity to persist