metal-orm 1.1.6 → 1.1.8

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
@@ -7655,6 +7655,10 @@ declare const entityRefs: <T extends readonly EntityConstructor<object>[]>(...ct
7655
7655
  /**
7656
7656
  * Bag for storing decorator metadata during the decoration phase.
7657
7657
  */
7658
+ interface DecoratorTreeMetadata {
7659
+ parentProperty?: string;
7660
+ childrenProperty?: string;
7661
+ }
7658
7662
  interface DecoratorMetadataBag {
7659
7663
  columns: Array<{
7660
7664
  propertyName: string;
@@ -7668,6 +7672,7 @@ interface DecoratorMetadataBag {
7668
7672
  propertyName: string;
7669
7673
  metadata: TransformerMetadata;
7670
7674
  }>;
7675
+ tree?: DecoratorTreeMetadata;
7671
7676
  }
7672
7677
  /**
7673
7678
  * Public helper to read decorator metadata from a class constructor.
@@ -9743,7 +9748,7 @@ interface TreeDecoratorOptions {
9743
9748
  * }
9744
9749
  * ```
9745
9750
  */
9746
- declare function Tree(options?: TreeDecoratorOptions): <T extends abstract new (...args: unknown[]) => object>(target: T) => T;
9751
+ declare function Tree(options?: TreeDecoratorOptions): <T extends abstract new (...args: unknown[]) => object>(target: T, context: ClassDecoratorContext<T>) => T;
9747
9752
  /**
9748
9753
  * Decorator to mark a property as the parent relation in a tree entity.
9749
9754
  *
@@ -9764,6 +9769,11 @@ declare function TreeParent(): <T, V>(_value: undefined, context: ClassFieldDeco
9764
9769
  * ```
9765
9770
  */
9766
9771
  declare function TreeChildren(): <T, V>(_value: undefined, context: ClassFieldDecoratorContext<T, V>) => void;
9772
+ /**
9773
+ * Synchronizes tree metadata + self-relations for entities using @Tree decorators.
9774
+ * Safe to call multiple times (idempotent).
9775
+ */
9776
+ declare function syncTreeEntityMetadata(ctor: EntityConstructor, treeMetadata?: DecoratorTreeMetadata): void;
9767
9777
  /**
9768
9778
  * Gets tree metadata from an entity class.
9769
9779
  */
@@ -9840,4 +9850,4 @@ declare function setTreeBounds(entity: object, config: TreeConfig, lft: number,
9840
9850
  */
9841
9851
  declare function setTreeParentId(entity: object, config: TreeConfig, parentId: unknown): void;
9842
9852
 
9843
- export { type AliasRefNode, Alphanumeric, type AnyDomainEvent, type ApiRouteDefinition, type ApplyFilterOptions, 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, BinaryTypeStrategy, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, CEP, CNPJ, CPF, type CacheCapabilities, type CacheInvalidator, type CacheOptions, type CacheProvider, type CacheReader, type CacheState, type CacheStrategy, type CacheWriter, type CallProcedureOptions, 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, ConflictBuilder, ConstructorMaterializationStrategy, type ValidationResult as CountryValidationResult, type CountryValidator, type CountryValidatorFactory, type CreateDto, type CreateTediousClientOptions, DEFAULT_TREE_CONFIG, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DatabaseView, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultCacheStrategy, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, type Duration, Email, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecuteFilteredPagedOptions, type ExecutionContext, type ExecutionPayload, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type FindChildrenOptions, type FindPathOptions, 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 InvalidationStrategy, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, KeyvCacheAdapter, Length, type LiteralNode, type LiteralValue, type LogicalExpressionNode, Lower, type ManyToManyCollection, MemoryCacheAdapter, type MoveOptions, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NestedSetBounds, type NestedSetRow, NestedSetStrategy, type NodeWithPk, 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 OrmCacheOptions, 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, ProcedureCallBuilder, type ProcedureCallNode, type ProcedureDirection, type ProcedureExecutionResult, type ProcedureOutOptions, type ProcedureParamNode, type ProcedureRefNode, type PropertySanitizer, type PropertyTransformer, type PropertyValidator, PrototypeMaterializationStrategy, QueryCacheManager, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type RecoverResult, RedisCacheAdapter, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationFilter, 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, TagIndex, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type ThreadedNode, Title, type ToJsonOptions, type TrackedEntity, type TransformContext, type TransformerConfig, type TransformerMetadata, Tree, TreeChildren, type TreeColumns, type TreeConfig, type TreeDecoratorOptions, type TreeInsertData, type TreeListEntry, type TreeListOptions, type TreeListSchemaOptions, TreeManager, type TreeManagerOptions, type TreeMetadata, type TreeMoveData, type TreeNode, type TreeNodeResult, type TreeNodeResultSchemaOptions, type TreeNodeSchemaOptions, TreeParent, type TreeQuery, type TreeScope, type TreeValidationResult, 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, addEntityRelation, addRelation, age, aliasRef, and, applyFilter, applyNullability, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterExpression, buildScopeConditions, calculateRowDepths, calculateTotalPages, callProcedure, 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, createTreeManager, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, exclude, executeFilteredPaged, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeProcedureAst, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, extractScopeValues, firstValue, floor, formatDuration, formatTreeList, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, generateTreeComponents, getColumn, getColumnMap, getColumnType, getDateKind, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getRegisteredValidators, getSchemaIntrospector, getTableDefFromEntity, getTreeBounds, getTreeColumns, getTreeConfig, getTreeMetadata, getTreeParentId, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hasTreeBehavior, hasValidator, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isNullableColumn, isOperandNode, isTableDef, isTreeConfig, isValidDuration, 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, parseDuration, payloadResultSets, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, registerValidator, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, resolveTreeConfig, resolveValidator, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, setTreeBounds, setTreeMetadata, setTreeParentId, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, threadResults, threadedNodeToOpenApiSchema, toColumnRef, toExecutionPayload, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, treeEntityRegistry, treeListEntryToOpenApiSchema, treeNodeResultToOpenApiSchema, treeNodeToOpenApiSchema, treeQuery, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, validateTreeTable, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };
9853
+ export { type AliasRefNode, Alphanumeric, type AnyDomainEvent, type ApiRouteDefinition, type ApplyFilterOptions, 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, BinaryTypeStrategy, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, CEP, CNPJ, CPF, type CacheCapabilities, type CacheInvalidator, type CacheOptions, type CacheProvider, type CacheReader, type CacheState, type CacheStrategy, type CacheWriter, type CallProcedureOptions, 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, ConflictBuilder, ConstructorMaterializationStrategy, type ValidationResult as CountryValidationResult, type CountryValidator, type CountryValidatorFactory, type CreateDto, type CreateTediousClientOptions, DEFAULT_TREE_CONFIG, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DatabaseView, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultCacheStrategy, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, type Duration, Email, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecuteFilteredPagedOptions, type ExecutionContext, type ExecutionPayload, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type FindChildrenOptions, type FindPathOptions, 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 InvalidationStrategy, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, KeyvCacheAdapter, Length, type LiteralNode, type LiteralValue, type LogicalExpressionNode, Lower, type ManyToManyCollection, MemoryCacheAdapter, type MoveOptions, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NestedSetBounds, type NestedSetRow, NestedSetStrategy, type NodeWithPk, 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 OrmCacheOptions, 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, ProcedureCallBuilder, type ProcedureCallNode, type ProcedureDirection, type ProcedureExecutionResult, type ProcedureOutOptions, type ProcedureParamNode, type ProcedureRefNode, type PropertySanitizer, type PropertyTransformer, type PropertyValidator, PrototypeMaterializationStrategy, QueryCacheManager, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type RecoverResult, RedisCacheAdapter, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationFilter, 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, TagIndex, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type ThreadedNode, Title, type ToJsonOptions, type TrackedEntity, type TransformContext, type TransformerConfig, type TransformerMetadata, Tree, TreeChildren, type TreeColumns, type TreeConfig, type TreeDecoratorOptions, type TreeInsertData, type TreeListEntry, type TreeListOptions, type TreeListSchemaOptions, TreeManager, type TreeManagerOptions, type TreeMetadata, type TreeMoveData, type TreeNode, type TreeNodeResult, type TreeNodeResultSchemaOptions, type TreeNodeSchemaOptions, TreeParent, type TreeQuery, type TreeScope, type TreeValidationResult, 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, addEntityRelation, addRelation, age, aliasRef, and, applyFilter, applyNullability, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterExpression, buildScopeConditions, calculateRowDepths, calculateTotalPages, callProcedure, 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, createTreeManager, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, exclude, executeFilteredPaged, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeProcedureAst, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, extractScopeValues, firstValue, floor, formatDuration, formatTreeList, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, generateTreeComponents, getColumn, getColumnMap, getColumnType, getDateKind, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getRegisteredValidators, getSchemaIntrospector, getTableDefFromEntity, getTreeBounds, getTreeColumns, getTreeConfig, getTreeMetadata, getTreeParentId, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hasTreeBehavior, hasValidator, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isNullableColumn, isOperandNode, isTableDef, isTreeConfig, isValidDuration, 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, parseDuration, payloadResultSets, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, registerValidator, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, resolveTreeConfig, resolveValidator, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, setTreeBounds, setTreeMetadata, setTreeParentId, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, syncTreeEntityMetadata, synchronizeSchema, tableRef, tan, threadResults, threadedNodeToOpenApiSchema, toColumnRef, toExecutionPayload, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, treeEntityRegistry, treeListEntryToOpenApiSchema, treeNodeResultToOpenApiSchema, treeNodeToOpenApiSchema, treeQuery, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, validateTreeTable, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };
package/dist/index.d.ts CHANGED
@@ -7655,6 +7655,10 @@ declare const entityRefs: <T extends readonly EntityConstructor<object>[]>(...ct
7655
7655
  /**
7656
7656
  * Bag for storing decorator metadata during the decoration phase.
7657
7657
  */
7658
+ interface DecoratorTreeMetadata {
7659
+ parentProperty?: string;
7660
+ childrenProperty?: string;
7661
+ }
7658
7662
  interface DecoratorMetadataBag {
7659
7663
  columns: Array<{
7660
7664
  propertyName: string;
@@ -7668,6 +7672,7 @@ interface DecoratorMetadataBag {
7668
7672
  propertyName: string;
7669
7673
  metadata: TransformerMetadata;
7670
7674
  }>;
7675
+ tree?: DecoratorTreeMetadata;
7671
7676
  }
7672
7677
  /**
7673
7678
  * Public helper to read decorator metadata from a class constructor.
@@ -9743,7 +9748,7 @@ interface TreeDecoratorOptions {
9743
9748
  * }
9744
9749
  * ```
9745
9750
  */
9746
- declare function Tree(options?: TreeDecoratorOptions): <T extends abstract new (...args: unknown[]) => object>(target: T) => T;
9751
+ declare function Tree(options?: TreeDecoratorOptions): <T extends abstract new (...args: unknown[]) => object>(target: T, context: ClassDecoratorContext<T>) => T;
9747
9752
  /**
9748
9753
  * Decorator to mark a property as the parent relation in a tree entity.
9749
9754
  *
@@ -9764,6 +9769,11 @@ declare function TreeParent(): <T, V>(_value: undefined, context: ClassFieldDeco
9764
9769
  * ```
9765
9770
  */
9766
9771
  declare function TreeChildren(): <T, V>(_value: undefined, context: ClassFieldDecoratorContext<T, V>) => void;
9772
+ /**
9773
+ * Synchronizes tree metadata + self-relations for entities using @Tree decorators.
9774
+ * Safe to call multiple times (idempotent).
9775
+ */
9776
+ declare function syncTreeEntityMetadata(ctor: EntityConstructor, treeMetadata?: DecoratorTreeMetadata): void;
9767
9777
  /**
9768
9778
  * Gets tree metadata from an entity class.
9769
9779
  */
@@ -9840,4 +9850,4 @@ declare function setTreeBounds(entity: object, config: TreeConfig, lft: number,
9840
9850
  */
9841
9851
  declare function setTreeParentId(entity: object, config: TreeConfig, parentId: unknown): void;
9842
9852
 
9843
- export { type AliasRefNode, Alphanumeric, type AnyDomainEvent, type ApiRouteDefinition, type ApplyFilterOptions, 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, BinaryTypeStrategy, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, CEP, CNPJ, CPF, type CacheCapabilities, type CacheInvalidator, type CacheOptions, type CacheProvider, type CacheReader, type CacheState, type CacheStrategy, type CacheWriter, type CallProcedureOptions, 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, ConflictBuilder, ConstructorMaterializationStrategy, type ValidationResult as CountryValidationResult, type CountryValidator, type CountryValidatorFactory, type CreateDto, type CreateTediousClientOptions, DEFAULT_TREE_CONFIG, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DatabaseView, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultCacheStrategy, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, type Duration, Email, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecuteFilteredPagedOptions, type ExecutionContext, type ExecutionPayload, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type FindChildrenOptions, type FindPathOptions, 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 InvalidationStrategy, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, KeyvCacheAdapter, Length, type LiteralNode, type LiteralValue, type LogicalExpressionNode, Lower, type ManyToManyCollection, MemoryCacheAdapter, type MoveOptions, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NestedSetBounds, type NestedSetRow, NestedSetStrategy, type NodeWithPk, 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 OrmCacheOptions, 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, ProcedureCallBuilder, type ProcedureCallNode, type ProcedureDirection, type ProcedureExecutionResult, type ProcedureOutOptions, type ProcedureParamNode, type ProcedureRefNode, type PropertySanitizer, type PropertyTransformer, type PropertyValidator, PrototypeMaterializationStrategy, QueryCacheManager, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type RecoverResult, RedisCacheAdapter, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationFilter, 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, TagIndex, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type ThreadedNode, Title, type ToJsonOptions, type TrackedEntity, type TransformContext, type TransformerConfig, type TransformerMetadata, Tree, TreeChildren, type TreeColumns, type TreeConfig, type TreeDecoratorOptions, type TreeInsertData, type TreeListEntry, type TreeListOptions, type TreeListSchemaOptions, TreeManager, type TreeManagerOptions, type TreeMetadata, type TreeMoveData, type TreeNode, type TreeNodeResult, type TreeNodeResultSchemaOptions, type TreeNodeSchemaOptions, TreeParent, type TreeQuery, type TreeScope, type TreeValidationResult, 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, addEntityRelation, addRelation, age, aliasRef, and, applyFilter, applyNullability, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterExpression, buildScopeConditions, calculateRowDepths, calculateTotalPages, callProcedure, 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, createTreeManager, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, exclude, executeFilteredPaged, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeProcedureAst, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, extractScopeValues, firstValue, floor, formatDuration, formatTreeList, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, generateTreeComponents, getColumn, getColumnMap, getColumnType, getDateKind, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getRegisteredValidators, getSchemaIntrospector, getTableDefFromEntity, getTreeBounds, getTreeColumns, getTreeConfig, getTreeMetadata, getTreeParentId, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hasTreeBehavior, hasValidator, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isNullableColumn, isOperandNode, isTableDef, isTreeConfig, isValidDuration, 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, parseDuration, payloadResultSets, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, registerValidator, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, resolveTreeConfig, resolveValidator, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, setTreeBounds, setTreeMetadata, setTreeParentId, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, threadResults, threadedNodeToOpenApiSchema, toColumnRef, toExecutionPayload, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, treeEntityRegistry, treeListEntryToOpenApiSchema, treeNodeResultToOpenApiSchema, treeNodeToOpenApiSchema, treeQuery, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, validateTreeTable, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };
9853
+ export { type AliasRefNode, Alphanumeric, type AnyDomainEvent, type ApiRouteDefinition, type ApplyFilterOptions, 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, BinaryTypeStrategy, type BitwiseExpressionNode, type BooleanFilter, BooleanTypeStrategy, CEP, CNPJ, CPF, type CacheCapabilities, type CacheInvalidator, type CacheOptions, type CacheProvider, type CacheReader, type CacheState, type CacheStrategy, type CacheWriter, type CallProcedureOptions, 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, ConflictBuilder, ConstructorMaterializationStrategy, type ValidationResult as CountryValidationResult, type CountryValidator, type CountryValidatorFactory, type CreateDto, type CreateTediousClientOptions, DEFAULT_TREE_CONFIG, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DatabaseView, type DateFilter, DateTimeTypeStrategy, type DbExecutor, type DbExecutorFactory, DecimalTypeStrategy, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultCacheStrategy, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, DefaultTypeStrategy, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, type Dto, type Duration, Email, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecuteFilteredPagedOptions, type ExecutionContext, type ExecutionPayload, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type FieldFilter, type FilterOperator, type FilterValue, type FindChildrenOptions, type FindPathOptions, 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 InvalidationStrategy, type JsonArray, type JsonObject, type JsonPathNode, type JsonValue, type Jsonify, type JsonifyScalar, KeyvCacheAdapter, Length, type LiteralNode, type LiteralValue, type LogicalExpressionNode, Lower, type ManyToManyCollection, MemoryCacheAdapter, type MoveOptions, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NestedDtoOptions, type NestedSetBounds, type NestedSetRow, NestedSetStrategy, type NodeWithPk, 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 OrmCacheOptions, 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, ProcedureCallBuilder, type ProcedureCallNode, type ProcedureDirection, type ProcedureExecutionResult, type ProcedureOutOptions, type ProcedureParamNode, type ProcedureRefNode, type PropertySanitizer, type PropertyTransformer, type PropertyValidator, PrototypeMaterializationStrategy, QueryCacheManager, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type RecoverResult, RedisCacheAdapter, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationFilter, 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, TagIndex, type TargetType, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type ThreadedNode, Title, type ToJsonOptions, type TrackedEntity, type TransformContext, type TransformerConfig, type TransformerMetadata, Tree, TreeChildren, type TreeColumns, type TreeConfig, type TreeDecoratorOptions, type TreeInsertData, type TreeListEntry, type TreeListOptions, type TreeListSchemaOptions, TreeManager, type TreeManagerOptions, type TreeMetadata, type TreeMoveData, type TreeNode, type TreeNodeResult, type TreeNodeResultSchemaOptions, type TreeNodeSchemaOptions, TreeParent, type TreeQuery, type TreeScope, type TreeValidationResult, 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, addEntityRelation, addRelation, age, aliasRef, and, applyFilter, applyNullability, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterExpression, buildScopeConditions, calculateRowDepths, calculateTotalPages, callProcedure, 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, createTreeManager, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, deepCloneSchema, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, dtoToOpenApiSchema, endOfMonth, entityRef, entityRefs, eq, esel, exclude, executeFilteredPaged, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeProcedureAst, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractReusableSchemas, extractScopeValues, firstValue, floor, formatDuration, formatTreeList, fromUnixTime, generateComponentSchemas, generateCreateTableSql, generateOpenApiDocument, generateRelationComponents, generateSchemaSql, generateSchemaSqlFor, generateTreeComponents, getColumn, getColumnMap, getColumnType, getDateKind, getDecoratorMetadata, getDeterministicComponentName, getOpenApiVersionForDialect, getRegisteredValidators, getSchemaIntrospector, getTableDefFromEntity, getTreeBounds, getTreeColumns, getTreeConfig, getTreeMetadata, getTreeParentId, greatest, groupConcat, gt, gte, hasMany, hasNextPage as hasNextPageMeta, hasOne, hasPrevPage as hasPrevPageMeta, hasTreeBehavior, hasValidator, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isComponentReference, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isNullableColumn, isOperandNode, isTableDef, isTreeConfig, isValidDuration, 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, parseDuration, payloadResultSets, pi, pick, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, registerValidator, relationFilterToOpenApiSchema, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, replaceWithRefs, resolveTreeConfig, resolveValidator, responseToRef, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, schemaToRef, second, sel, selectFrom, selectFromEntity, setRelations, setTreeBounds, setTreeMetadata, setTreeParentId, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, syncTreeEntityMetadata, synchronizeSchema, tableRef, tan, threadResults, threadedNodeToOpenApiSchema, toColumnRef, toExecutionPayload, toPagedResponse, toPagedResponseBuilder, toPaginationParams, toResponse, toResponseBuilder, toTableRef, treeEntityRegistry, treeListEntryToOpenApiSchema, treeNodeResultToOpenApiSchema, treeNodeToOpenApiSchema, treeQuery, trim, trunc, truncate, typeMappingService, unixTimestamp, update, updateDtoToOpenApiSchema, updateDtoWithRelationsToOpenApiSchema, upper, utcNow, validateTreeTable, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, whereInputToOpenApiSchema, whereInputWithRelationsToOpenApiSchema, windowFunction, withDefaults, withDefaultsBuilder, year };
package/dist/index.js CHANGED
@@ -14566,6 +14566,265 @@ var jsonify = (value) => {
14566
14566
  return result;
14567
14567
  };
14568
14568
 
14569
+ // src/tree/tree-types.ts
14570
+ var DEFAULT_TREE_CONFIG = {
14571
+ parentKey: "parentId",
14572
+ leftKey: "lft",
14573
+ rightKey: "rght",
14574
+ cascadeCallbacks: false
14575
+ };
14576
+ function isTreeConfig(value) {
14577
+ if (typeof value !== "object" || value === null) return false;
14578
+ const obj = value;
14579
+ return typeof obj.parentKey === "string" && typeof obj.leftKey === "string" && typeof obj.rightKey === "string";
14580
+ }
14581
+ function resolveTreeConfig(partial) {
14582
+ return {
14583
+ parentKey: partial.parentKey ?? DEFAULT_TREE_CONFIG.parentKey,
14584
+ leftKey: partial.leftKey ?? DEFAULT_TREE_CONFIG.leftKey,
14585
+ rightKey: partial.rightKey ?? DEFAULT_TREE_CONFIG.rightKey,
14586
+ depthKey: partial.depthKey,
14587
+ scope: partial.scope,
14588
+ cascadeCallbacks: partial.cascadeCallbacks ?? DEFAULT_TREE_CONFIG.cascadeCallbacks,
14589
+ recoverOrder: partial.recoverOrder
14590
+ };
14591
+ }
14592
+ function validateTreeTable(table, config) {
14593
+ const missingColumns = [];
14594
+ const warnings = [];
14595
+ const requiredColumns = [config.parentKey, config.leftKey, config.rightKey];
14596
+ for (const col2 of requiredColumns) {
14597
+ if (!(col2 in table.columns)) {
14598
+ missingColumns.push(col2);
14599
+ }
14600
+ }
14601
+ if (config.depthKey && !(config.depthKey in table.columns)) {
14602
+ warnings.push(`Optional depth column '${config.depthKey}' not found in table '${table.name}'`);
14603
+ }
14604
+ if (config.scope) {
14605
+ for (const scopeCol of config.scope) {
14606
+ if (!(scopeCol in table.columns)) {
14607
+ missingColumns.push(scopeCol);
14608
+ }
14609
+ }
14610
+ }
14611
+ const leftCol = table.columns[config.leftKey];
14612
+ const rightCol = table.columns[config.rightKey];
14613
+ if (leftCol && leftCol.type !== "int" && leftCol.type !== "integer") {
14614
+ warnings.push(`Left column '${config.leftKey}' should be an integer type`);
14615
+ }
14616
+ if (rightCol && rightCol.type !== "int" && rightCol.type !== "integer") {
14617
+ warnings.push(`Right column '${config.rightKey}' should be an integer type`);
14618
+ }
14619
+ return {
14620
+ valid: missingColumns.length === 0,
14621
+ missingColumns,
14622
+ warnings
14623
+ };
14624
+ }
14625
+ function getTreeColumns(table, config) {
14626
+ const parentColumn = table.columns[config.parentKey];
14627
+ const leftColumn = table.columns[config.leftKey];
14628
+ const rightColumn = table.columns[config.rightKey];
14629
+ const depthColumn = config.depthKey ? table.columns[config.depthKey] : void 0;
14630
+ const scopeColumns = (config.scope ?? []).map((s) => table.columns[s]).filter(Boolean);
14631
+ if (!parentColumn || !leftColumn || !rightColumn) {
14632
+ throw new Error(
14633
+ `Table '${table.name}' is missing required tree columns. Required: ${config.parentKey}, ${config.leftKey}, ${config.rightKey}`
14634
+ );
14635
+ }
14636
+ return {
14637
+ parentColumn,
14638
+ leftColumn,
14639
+ rightColumn,
14640
+ depthColumn,
14641
+ scopeColumns
14642
+ };
14643
+ }
14644
+
14645
+ // src/tree/tree-decorator.ts
14646
+ var TREE_METADATA_KEY = /* @__PURE__ */ Symbol("metal-orm:tree");
14647
+ function Tree(options = {}) {
14648
+ return function(target, context) {
14649
+ const config = resolveTreeConfig(options);
14650
+ const metadataBag = readMetadataBag(context) ?? readMetadataBagFromConstructor(target);
14651
+ const metadata = {
14652
+ config,
14653
+ parentProperty: metadataBag?.tree?.parentProperty,
14654
+ childrenProperty: metadataBag?.tree?.childrenProperty
14655
+ };
14656
+ setTreeMetadataOnClass(target, metadata);
14657
+ registerTreeRelations(target, metadata);
14658
+ return target;
14659
+ };
14660
+ }
14661
+ function TreeParent() {
14662
+ return function(_value, context) {
14663
+ if (!context.name) {
14664
+ throw new Error("TreeParent decorator requires a property name");
14665
+ }
14666
+ if (context.private) {
14667
+ throw new Error("TreeParent decorator does not support private fields");
14668
+ }
14669
+ const propertyName = String(context.name);
14670
+ const bag = getOrCreateMetadataBag(context);
14671
+ bag.tree = { ...bag.tree, parentProperty: propertyName };
14672
+ };
14673
+ }
14674
+ function TreeChildren() {
14675
+ return function(_value, context) {
14676
+ if (!context.name) {
14677
+ throw new Error("TreeChildren decorator requires a property name");
14678
+ }
14679
+ if (context.private) {
14680
+ throw new Error("TreeChildren decorator does not support private fields");
14681
+ }
14682
+ const propertyName = String(context.name);
14683
+ const bag = getOrCreateMetadataBag(context);
14684
+ bag.tree = { ...bag.tree, childrenProperty: propertyName };
14685
+ };
14686
+ }
14687
+ function syncTreeEntityMetadata(ctor, treeMetadata) {
14688
+ const current = getTreeMetadata(ctor);
14689
+ if (!current) return;
14690
+ const metadataBag = readMetadataBagFromConstructor(ctor);
14691
+ const nextParentProperty = treeMetadata?.parentProperty ?? metadataBag?.tree?.parentProperty ?? current.parentProperty;
14692
+ const nextChildrenProperty = treeMetadata?.childrenProperty ?? metadataBag?.tree?.childrenProperty ?? current.childrenProperty;
14693
+ if (nextParentProperty !== current.parentProperty || nextChildrenProperty !== current.childrenProperty) {
14694
+ setTreeMetadata(ctor, {
14695
+ ...current,
14696
+ parentProperty: nextParentProperty,
14697
+ childrenProperty: nextChildrenProperty
14698
+ });
14699
+ }
14700
+ registerTreeRelations(ctor, {
14701
+ ...current,
14702
+ parentProperty: nextParentProperty,
14703
+ childrenProperty: nextChildrenProperty
14704
+ });
14705
+ }
14706
+ function getTreeMetadata(target) {
14707
+ return target[TREE_METADATA_KEY];
14708
+ }
14709
+ function setTreeMetadata(target, metadata) {
14710
+ target[TREE_METADATA_KEY] = metadata;
14711
+ }
14712
+ var registerTreeRelations = (target, metadata) => {
14713
+ const entityMeta = getEntityMetadata(target);
14714
+ if (!entityMeta) return;
14715
+ if (metadata.parentProperty && !entityMeta.relations[metadata.parentProperty]) {
14716
+ addRelationMetadata(target, metadata.parentProperty, {
14717
+ kind: RelationKinds.BelongsTo,
14718
+ propertyKey: metadata.parentProperty,
14719
+ target: () => target,
14720
+ foreignKey: metadata.config.parentKey
14721
+ });
14722
+ if (entityMeta.table && !entityMeta.table.relations[metadata.parentProperty]) {
14723
+ entityMeta.table.relations[metadata.parentProperty] = belongsTo(
14724
+ entityMeta.table,
14725
+ metadata.config.parentKey
14726
+ );
14727
+ }
14728
+ }
14729
+ if (metadata.childrenProperty && !entityMeta.relations[metadata.childrenProperty]) {
14730
+ addRelationMetadata(target, metadata.childrenProperty, {
14731
+ kind: RelationKinds.HasMany,
14732
+ propertyKey: metadata.childrenProperty,
14733
+ target: () => target,
14734
+ foreignKey: metadata.config.parentKey
14735
+ });
14736
+ if (entityMeta.table && !entityMeta.table.relations[metadata.childrenProperty]) {
14737
+ entityMeta.table.relations[metadata.childrenProperty] = hasMany(
14738
+ entityMeta.table,
14739
+ metadata.config.parentKey
14740
+ );
14741
+ }
14742
+ }
14743
+ };
14744
+ function setTreeMetadataOnClass(target, metadata) {
14745
+ target[TREE_METADATA_KEY] = metadata;
14746
+ }
14747
+ function hasTreeBehavior(target) {
14748
+ return getTreeMetadata(target) !== void 0;
14749
+ }
14750
+ function getTreeConfig(target) {
14751
+ return getTreeMetadata(target)?.config;
14752
+ }
14753
+ var TreeEntityRegistry = class {
14754
+ entities = /* @__PURE__ */ new Map();
14755
+ tableNames = /* @__PURE__ */ new Map();
14756
+ /**
14757
+ * Registers an entity class with its table name.
14758
+ */
14759
+ register(entityClass, tableName) {
14760
+ this.entities.set(tableName, entityClass);
14761
+ this.tableNames.set(entityClass, tableName);
14762
+ }
14763
+ /**
14764
+ * Gets the entity class for a table name.
14765
+ */
14766
+ getByTableName(tableName) {
14767
+ return this.entities.get(tableName);
14768
+ }
14769
+ /**
14770
+ * Gets the table name for an entity class.
14771
+ */
14772
+ getTableName(entityClass) {
14773
+ return this.tableNames.get(entityClass);
14774
+ }
14775
+ /**
14776
+ * Checks if a table has tree behavior.
14777
+ */
14778
+ isTreeTable(tableName) {
14779
+ const entity = this.entities.get(tableName);
14780
+ return entity ? hasTreeBehavior(entity) : false;
14781
+ }
14782
+ /**
14783
+ * Gets all registered tree entities.
14784
+ */
14785
+ getAll() {
14786
+ const result = [];
14787
+ for (const [tableName, entityClass] of this.entities) {
14788
+ const metadata = getTreeMetadata(entityClass);
14789
+ if (metadata) {
14790
+ result.push({ entityClass, tableName, metadata });
14791
+ }
14792
+ }
14793
+ return result;
14794
+ }
14795
+ /**
14796
+ * Clears the registry.
14797
+ */
14798
+ clear() {
14799
+ this.entities.clear();
14800
+ this.tableNames.clear();
14801
+ }
14802
+ };
14803
+ var treeEntityRegistry = new TreeEntityRegistry();
14804
+ function getTreeBounds(entity, config) {
14805
+ const data = entity;
14806
+ const lft = data[config.leftKey];
14807
+ const rght = data[config.rightKey];
14808
+ if (typeof lft !== "number" || typeof rght !== "number") {
14809
+ return null;
14810
+ }
14811
+ return { lft, rght };
14812
+ }
14813
+ function getTreeParentId(entity, config) {
14814
+ return entity[config.parentKey];
14815
+ }
14816
+ function setTreeBounds(entity, config, lft, rght, depth) {
14817
+ const data = entity;
14818
+ data[config.leftKey] = lft;
14819
+ data[config.rightKey] = rght;
14820
+ if (config.depthKey && depth !== void 0) {
14821
+ data[config.depthKey] = depth;
14822
+ }
14823
+ }
14824
+ function setTreeParentId(entity, config, parentId) {
14825
+ entity[config.parentKey] = parentId;
14826
+ }
14827
+
14569
14828
  // src/decorators/entity.ts
14570
14829
  var toSnakeCase2 = (value) => {
14571
14830
  return value.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^a-z0-9_]+/gi, "_").replace(/__+/g, "_").replace(/^_|_$/g, "").toLowerCase();
@@ -14609,6 +14868,7 @@ function Entity(options = {}) {
14609
14868
  addRelationMetadata(ctor, entry.propertyName, relationCopy);
14610
14869
  }
14611
14870
  }
14871
+ syncTreeEntityMetadata(ctor, bag?.tree);
14612
14872
  return ctor;
14613
14873
  };
14614
14874
  }
@@ -17535,208 +17795,6 @@ function extractReusableSchemas(schema, existing = {}, prefix = "") {
17535
17795
  return existing;
17536
17796
  }
17537
17797
 
17538
- // src/tree/tree-types.ts
17539
- var DEFAULT_TREE_CONFIG = {
17540
- parentKey: "parentId",
17541
- leftKey: "lft",
17542
- rightKey: "rght",
17543
- cascadeCallbacks: false
17544
- };
17545
- function isTreeConfig(value) {
17546
- if (typeof value !== "object" || value === null) return false;
17547
- const obj = value;
17548
- return typeof obj.parentKey === "string" && typeof obj.leftKey === "string" && typeof obj.rightKey === "string";
17549
- }
17550
- function resolveTreeConfig(partial) {
17551
- return {
17552
- parentKey: partial.parentKey ?? DEFAULT_TREE_CONFIG.parentKey,
17553
- leftKey: partial.leftKey ?? DEFAULT_TREE_CONFIG.leftKey,
17554
- rightKey: partial.rightKey ?? DEFAULT_TREE_CONFIG.rightKey,
17555
- depthKey: partial.depthKey,
17556
- scope: partial.scope,
17557
- cascadeCallbacks: partial.cascadeCallbacks ?? DEFAULT_TREE_CONFIG.cascadeCallbacks,
17558
- recoverOrder: partial.recoverOrder
17559
- };
17560
- }
17561
- function validateTreeTable(table, config) {
17562
- const missingColumns = [];
17563
- const warnings = [];
17564
- const requiredColumns = [config.parentKey, config.leftKey, config.rightKey];
17565
- for (const col2 of requiredColumns) {
17566
- if (!(col2 in table.columns)) {
17567
- missingColumns.push(col2);
17568
- }
17569
- }
17570
- if (config.depthKey && !(config.depthKey in table.columns)) {
17571
- warnings.push(`Optional depth column '${config.depthKey}' not found in table '${table.name}'`);
17572
- }
17573
- if (config.scope) {
17574
- for (const scopeCol of config.scope) {
17575
- if (!(scopeCol in table.columns)) {
17576
- missingColumns.push(scopeCol);
17577
- }
17578
- }
17579
- }
17580
- const leftCol = table.columns[config.leftKey];
17581
- const rightCol = table.columns[config.rightKey];
17582
- if (leftCol && leftCol.type !== "int" && leftCol.type !== "integer") {
17583
- warnings.push(`Left column '${config.leftKey}' should be an integer type`);
17584
- }
17585
- if (rightCol && rightCol.type !== "int" && rightCol.type !== "integer") {
17586
- warnings.push(`Right column '${config.rightKey}' should be an integer type`);
17587
- }
17588
- return {
17589
- valid: missingColumns.length === 0,
17590
- missingColumns,
17591
- warnings
17592
- };
17593
- }
17594
- function getTreeColumns(table, config) {
17595
- const parentColumn = table.columns[config.parentKey];
17596
- const leftColumn = table.columns[config.leftKey];
17597
- const rightColumn = table.columns[config.rightKey];
17598
- const depthColumn = config.depthKey ? table.columns[config.depthKey] : void 0;
17599
- const scopeColumns = (config.scope ?? []).map((s) => table.columns[s]).filter(Boolean);
17600
- if (!parentColumn || !leftColumn || !rightColumn) {
17601
- throw new Error(
17602
- `Table '${table.name}' is missing required tree columns. Required: ${config.parentKey}, ${config.leftKey}, ${config.rightKey}`
17603
- );
17604
- }
17605
- return {
17606
- parentColumn,
17607
- leftColumn,
17608
- rightColumn,
17609
- depthColumn,
17610
- scopeColumns
17611
- };
17612
- }
17613
-
17614
- // src/tree/tree-decorator.ts
17615
- var TREE_METADATA_KEY = /* @__PURE__ */ Symbol("metal-orm:tree");
17616
- function Tree(options = {}) {
17617
- return function(target) {
17618
- const config = resolveTreeConfig(options);
17619
- const metadata = { config };
17620
- setTreeMetadataOnClass(target, metadata);
17621
- return target;
17622
- };
17623
- }
17624
- function TreeParent() {
17625
- return function(_value, context) {
17626
- const propertyName = String(context.name);
17627
- context.addInitializer(function() {
17628
- const constructor = this.constructor;
17629
- const metadata = getTreeMetadata(constructor);
17630
- if (metadata) {
17631
- metadata.parentProperty = propertyName;
17632
- setTreeMetadata(constructor, metadata);
17633
- }
17634
- });
17635
- };
17636
- }
17637
- function TreeChildren() {
17638
- return function(_value, context) {
17639
- const propertyName = String(context.name);
17640
- context.addInitializer(function() {
17641
- const constructor = this.constructor;
17642
- const metadata = getTreeMetadata(constructor);
17643
- if (metadata) {
17644
- metadata.childrenProperty = propertyName;
17645
- setTreeMetadata(constructor, metadata);
17646
- }
17647
- });
17648
- };
17649
- }
17650
- function getTreeMetadata(target) {
17651
- return target[TREE_METADATA_KEY];
17652
- }
17653
- function setTreeMetadata(target, metadata) {
17654
- target[TREE_METADATA_KEY] = metadata;
17655
- }
17656
- function setTreeMetadataOnClass(target, metadata) {
17657
- target[TREE_METADATA_KEY] = metadata;
17658
- }
17659
- function hasTreeBehavior(target) {
17660
- return getTreeMetadata(target) !== void 0;
17661
- }
17662
- function getTreeConfig(target) {
17663
- return getTreeMetadata(target)?.config;
17664
- }
17665
- var TreeEntityRegistry = class {
17666
- entities = /* @__PURE__ */ new Map();
17667
- tableNames = /* @__PURE__ */ new Map();
17668
- /**
17669
- * Registers an entity class with its table name.
17670
- */
17671
- register(entityClass, tableName) {
17672
- this.entities.set(tableName, entityClass);
17673
- this.tableNames.set(entityClass, tableName);
17674
- }
17675
- /**
17676
- * Gets the entity class for a table name.
17677
- */
17678
- getByTableName(tableName) {
17679
- return this.entities.get(tableName);
17680
- }
17681
- /**
17682
- * Gets the table name for an entity class.
17683
- */
17684
- getTableName(entityClass) {
17685
- return this.tableNames.get(entityClass);
17686
- }
17687
- /**
17688
- * Checks if a table has tree behavior.
17689
- */
17690
- isTreeTable(tableName) {
17691
- const entity = this.entities.get(tableName);
17692
- return entity ? hasTreeBehavior(entity) : false;
17693
- }
17694
- /**
17695
- * Gets all registered tree entities.
17696
- */
17697
- getAll() {
17698
- const result = [];
17699
- for (const [tableName, entityClass] of this.entities) {
17700
- const metadata = getTreeMetadata(entityClass);
17701
- if (metadata) {
17702
- result.push({ entityClass, tableName, metadata });
17703
- }
17704
- }
17705
- return result;
17706
- }
17707
- /**
17708
- * Clears the registry.
17709
- */
17710
- clear() {
17711
- this.entities.clear();
17712
- this.tableNames.clear();
17713
- }
17714
- };
17715
- var treeEntityRegistry = new TreeEntityRegistry();
17716
- function getTreeBounds(entity, config) {
17717
- const data = entity;
17718
- const lft = data[config.leftKey];
17719
- const rght = data[config.rightKey];
17720
- if (typeof lft !== "number" || typeof rght !== "number") {
17721
- return null;
17722
- }
17723
- return { lft, rght };
17724
- }
17725
- function getTreeParentId(entity, config) {
17726
- return entity[config.parentKey];
17727
- }
17728
- function setTreeBounds(entity, config, lft, rght, depth) {
17729
- const data = entity;
17730
- data[config.leftKey] = lft;
17731
- data[config.rightKey] = rght;
17732
- if (config.depthKey && depth !== void 0) {
17733
- data[config.depthKey] = depth;
17734
- }
17735
- }
17736
- function setTreeParentId(entity, config, parentId) {
17737
- entity[config.parentKey] = parentId;
17738
- }
17739
-
17740
17798
  // src/dto/openapi/generators/tree.ts
17741
17799
  function threadedNodeToOpenApiSchema(target, options) {
17742
17800
  const componentName = options?.componentName;
@@ -19760,6 +19818,7 @@ export {
19760
19818
  sub,
19761
19819
  substr,
19762
19820
  sum,
19821
+ syncTreeEntityMetadata,
19763
19822
  synchronizeSchema,
19764
19823
  tableRef,
19765
19824
  tan,