metal-orm 1.0.65 → 1.0.66

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
@@ -2986,6 +2986,71 @@ declare class Orm<E extends DomainEvent = OrmDomainEvent> {
2986
2986
  dispose(): Promise<void>;
2987
2987
  }
2988
2988
 
2989
+ type PrimaryKey$1 = string | number;
2990
+ /**
2991
+ * Interface for entity context providing entity tracking and management.
2992
+ */
2993
+ interface EntityContext {
2994
+ /** The database dialect */
2995
+ dialect: Dialect;
2996
+ /** The database executor */
2997
+ executor: DbExecutor;
2998
+ /**
2999
+ * Gets an entity by table and primary key.
3000
+ * @param table - The table definition
3001
+ * @param pk - The primary key value
3002
+ * @returns The entity or undefined
3003
+ */
3004
+ getEntity(table: TableDef, pk: PrimaryKey$1): object | undefined;
3005
+ /**
3006
+ * Sets an entity in the context.
3007
+ * @param table - The table definition
3008
+ * @param pk - The primary key value
3009
+ * @param entity - The entity to set
3010
+ */
3011
+ setEntity(table: TableDef, pk: PrimaryKey$1, entity: object): void;
3012
+ /**
3013
+ * Tracks a new entity.
3014
+ * @param table - The table definition
3015
+ * @param entity - The new entity
3016
+ * @param pk - Optional primary key
3017
+ */
3018
+ trackNew(table: TableDef, entity: object, pk?: PrimaryKey$1): void;
3019
+ /**
3020
+ * Tracks a managed entity.
3021
+ * @param table - The table definition
3022
+ * @param pk - The primary key
3023
+ * @param entity - The managed entity
3024
+ */
3025
+ trackManaged(table: TableDef, pk: PrimaryKey$1, entity: object): void;
3026
+ /**
3027
+ * Marks an entity as dirty.
3028
+ * @param entity - The entity to mark
3029
+ */
3030
+ markDirty(entity: object): void;
3031
+ /**
3032
+ * Marks an entity as removed.
3033
+ * @param entity - The entity to mark
3034
+ */
3035
+ markRemoved(entity: object): void;
3036
+ /**
3037
+ * Gets all tracked entities for a table.
3038
+ * @param table - The table definition
3039
+ * @returns Array of tracked entities
3040
+ */
3041
+ getEntitiesForTable(table: TableDef): TrackedEntity[];
3042
+ /**
3043
+ * Registers a relation change.
3044
+ * @param root - The root entity
3045
+ * @param relationKey - The relation key
3046
+ * @param rootTable - The root table definition
3047
+ * @param relationName - The relation name
3048
+ * @param relation - The relation definition
3049
+ * @param change - The relation change
3050
+ */
3051
+ registerRelationChange(root: unknown, relationKey: RelationKey$1, rootTable: TableDef, relationName: string, relation: RelationDef, change: RelationChange<unknown>): void;
3052
+ }
3053
+
2989
3054
  /**
2990
3055
  * Simple identity map for tracking entities within a session.
2991
3056
  * Ensures that the same database record is represented by a single entity instance.
@@ -2999,7 +3064,7 @@ declare class IdentityMap {
2999
3064
  * @param pk The primary key value.
3000
3065
  * @returns The entity instance if found, undefined otherwise.
3001
3066
  */
3002
- getEntity(table: TableDef, pk: string | number): object | undefined;
3067
+ getEntity(table: TableDef, pk: PrimaryKey$1): object | undefined;
3003
3068
  /**
3004
3069
  * Registers a tracked entity in the identity map.
3005
3070
  * @param tracked The tracked entity metadata and instance.
@@ -3048,7 +3113,7 @@ declare class UnitOfWork {
3048
3113
  * @param pk - The primary key value
3049
3114
  * @returns The entity or undefined if not found
3050
3115
  */
3051
- getEntity(table: TableDef, pk: string | number): object | undefined;
3116
+ getEntity(table: TableDef, pk: PrimaryKey$1): object | undefined;
3052
3117
  /**
3053
3118
  * Gets all tracked entities for a specific table.
3054
3119
  * @param table - The table definition
@@ -3067,21 +3132,21 @@ declare class UnitOfWork {
3067
3132
  * @param pk - The primary key value
3068
3133
  * @param entity - The entity instance
3069
3134
  */
3070
- setEntity(table: TableDef, pk: string | number, entity: object): void;
3135
+ setEntity(table: TableDef, pk: PrimaryKey$1, entity: object): void;
3071
3136
  /**
3072
3137
  * Tracks a new entity.
3073
3138
  * @param table - The table definition
3074
3139
  * @param entity - The entity instance
3075
3140
  * @param pk - Optional primary key value
3076
3141
  */
3077
- trackNew(table: TableDef, entity: object, pk?: string | number): void;
3142
+ trackNew(table: TableDef, entity: object, pk?: PrimaryKey$1): void;
3078
3143
  /**
3079
3144
  * Tracks a managed entity.
3080
3145
  * @param table - The table definition
3081
3146
  * @param pk - The primary key value
3082
3147
  * @param entity - The entity instance
3083
3148
  */
3084
- trackManaged(table: TableDef, pk: string | number, entity: object): void;
3149
+ trackManaged(table: TableDef, pk: PrimaryKey$1, entity: object): void;
3085
3150
  /**
3086
3151
  * Marks an entity as dirty (modified).
3087
3152
  * @param entity - The entity to mark as dirty
@@ -3374,71 +3439,6 @@ interface ExecutionContext {
3374
3439
  interceptors: InterceptorPipeline;
3375
3440
  }
3376
3441
 
3377
- type PrimaryKey$1 = string | number;
3378
- /**
3379
- * Interface for entity context providing entity tracking and management.
3380
- */
3381
- interface EntityContext {
3382
- /** The database dialect */
3383
- dialect: Dialect;
3384
- /** The database executor */
3385
- executor: DbExecutor;
3386
- /**
3387
- * Gets an entity by table and primary key.
3388
- * @param table - The table definition
3389
- * @param pk - The primary key value
3390
- * @returns The entity or undefined
3391
- */
3392
- getEntity(table: TableDef, pk: PrimaryKey$1): object | undefined;
3393
- /**
3394
- * Sets an entity in the context.
3395
- * @param table - The table definition
3396
- * @param pk - The primary key value
3397
- * @param entity - The entity to set
3398
- */
3399
- setEntity(table: TableDef, pk: PrimaryKey$1, entity: object): void;
3400
- /**
3401
- * Tracks a new entity.
3402
- * @param table - The table definition
3403
- * @param entity - The new entity
3404
- * @param pk - Optional primary key
3405
- */
3406
- trackNew(table: TableDef, entity: object, pk?: PrimaryKey$1): void;
3407
- /**
3408
- * Tracks a managed entity.
3409
- * @param table - The table definition
3410
- * @param pk - The primary key
3411
- * @param entity - The managed entity
3412
- */
3413
- trackManaged(table: TableDef, pk: PrimaryKey$1, entity: object): void;
3414
- /**
3415
- * Marks an entity as dirty.
3416
- * @param entity - The entity to mark
3417
- */
3418
- markDirty(entity: object): void;
3419
- /**
3420
- * Marks an entity as removed.
3421
- * @param entity - The entity to mark
3422
- */
3423
- markRemoved(entity: object): void;
3424
- /**
3425
- * Gets all tracked entities for a table.
3426
- * @param table - The table definition
3427
- * @returns Array of tracked entities
3428
- */
3429
- getEntitiesForTable(table: TableDef): TrackedEntity[];
3430
- /**
3431
- * Registers a relation change.
3432
- * @param root - The root entity
3433
- * @param relationKey - The relation key
3434
- * @param rootTable - The root table definition
3435
- * @param relationName - The relation name
3436
- * @param relation - The relation definition
3437
- * @param change - The relation change
3438
- */
3439
- registerRelationChange(root: unknown, relationKey: RelationKey$1, rootTable: TableDef, relationName: string, relation: RelationDef, change: RelationChange<unknown>): void;
3440
- }
3441
-
3442
3442
  /**
3443
3443
  * Context used during the hydration of entities from database results.
3444
3444
  * It carries necessary services and processors to handle identity management,
package/dist/index.d.ts CHANGED
@@ -2986,6 +2986,71 @@ declare class Orm<E extends DomainEvent = OrmDomainEvent> {
2986
2986
  dispose(): Promise<void>;
2987
2987
  }
2988
2988
 
2989
+ type PrimaryKey$1 = string | number;
2990
+ /**
2991
+ * Interface for entity context providing entity tracking and management.
2992
+ */
2993
+ interface EntityContext {
2994
+ /** The database dialect */
2995
+ dialect: Dialect;
2996
+ /** The database executor */
2997
+ executor: DbExecutor;
2998
+ /**
2999
+ * Gets an entity by table and primary key.
3000
+ * @param table - The table definition
3001
+ * @param pk - The primary key value
3002
+ * @returns The entity or undefined
3003
+ */
3004
+ getEntity(table: TableDef, pk: PrimaryKey$1): object | undefined;
3005
+ /**
3006
+ * Sets an entity in the context.
3007
+ * @param table - The table definition
3008
+ * @param pk - The primary key value
3009
+ * @param entity - The entity to set
3010
+ */
3011
+ setEntity(table: TableDef, pk: PrimaryKey$1, entity: object): void;
3012
+ /**
3013
+ * Tracks a new entity.
3014
+ * @param table - The table definition
3015
+ * @param entity - The new entity
3016
+ * @param pk - Optional primary key
3017
+ */
3018
+ trackNew(table: TableDef, entity: object, pk?: PrimaryKey$1): void;
3019
+ /**
3020
+ * Tracks a managed entity.
3021
+ * @param table - The table definition
3022
+ * @param pk - The primary key
3023
+ * @param entity - The managed entity
3024
+ */
3025
+ trackManaged(table: TableDef, pk: PrimaryKey$1, entity: object): void;
3026
+ /**
3027
+ * Marks an entity as dirty.
3028
+ * @param entity - The entity to mark
3029
+ */
3030
+ markDirty(entity: object): void;
3031
+ /**
3032
+ * Marks an entity as removed.
3033
+ * @param entity - The entity to mark
3034
+ */
3035
+ markRemoved(entity: object): void;
3036
+ /**
3037
+ * Gets all tracked entities for a table.
3038
+ * @param table - The table definition
3039
+ * @returns Array of tracked entities
3040
+ */
3041
+ getEntitiesForTable(table: TableDef): TrackedEntity[];
3042
+ /**
3043
+ * Registers a relation change.
3044
+ * @param root - The root entity
3045
+ * @param relationKey - The relation key
3046
+ * @param rootTable - The root table definition
3047
+ * @param relationName - The relation name
3048
+ * @param relation - The relation definition
3049
+ * @param change - The relation change
3050
+ */
3051
+ registerRelationChange(root: unknown, relationKey: RelationKey$1, rootTable: TableDef, relationName: string, relation: RelationDef, change: RelationChange<unknown>): void;
3052
+ }
3053
+
2989
3054
  /**
2990
3055
  * Simple identity map for tracking entities within a session.
2991
3056
  * Ensures that the same database record is represented by a single entity instance.
@@ -2999,7 +3064,7 @@ declare class IdentityMap {
2999
3064
  * @param pk The primary key value.
3000
3065
  * @returns The entity instance if found, undefined otherwise.
3001
3066
  */
3002
- getEntity(table: TableDef, pk: string | number): object | undefined;
3067
+ getEntity(table: TableDef, pk: PrimaryKey$1): object | undefined;
3003
3068
  /**
3004
3069
  * Registers a tracked entity in the identity map.
3005
3070
  * @param tracked The tracked entity metadata and instance.
@@ -3048,7 +3113,7 @@ declare class UnitOfWork {
3048
3113
  * @param pk - The primary key value
3049
3114
  * @returns The entity or undefined if not found
3050
3115
  */
3051
- getEntity(table: TableDef, pk: string | number): object | undefined;
3116
+ getEntity(table: TableDef, pk: PrimaryKey$1): object | undefined;
3052
3117
  /**
3053
3118
  * Gets all tracked entities for a specific table.
3054
3119
  * @param table - The table definition
@@ -3067,21 +3132,21 @@ declare class UnitOfWork {
3067
3132
  * @param pk - The primary key value
3068
3133
  * @param entity - The entity instance
3069
3134
  */
3070
- setEntity(table: TableDef, pk: string | number, entity: object): void;
3135
+ setEntity(table: TableDef, pk: PrimaryKey$1, entity: object): void;
3071
3136
  /**
3072
3137
  * Tracks a new entity.
3073
3138
  * @param table - The table definition
3074
3139
  * @param entity - The entity instance
3075
3140
  * @param pk - Optional primary key value
3076
3141
  */
3077
- trackNew(table: TableDef, entity: object, pk?: string | number): void;
3142
+ trackNew(table: TableDef, entity: object, pk?: PrimaryKey$1): void;
3078
3143
  /**
3079
3144
  * Tracks a managed entity.
3080
3145
  * @param table - The table definition
3081
3146
  * @param pk - The primary key value
3082
3147
  * @param entity - The entity instance
3083
3148
  */
3084
- trackManaged(table: TableDef, pk: string | number, entity: object): void;
3149
+ trackManaged(table: TableDef, pk: PrimaryKey$1, entity: object): void;
3085
3150
  /**
3086
3151
  * Marks an entity as dirty (modified).
3087
3152
  * @param entity - The entity to mark as dirty
@@ -3374,71 +3439,6 @@ interface ExecutionContext {
3374
3439
  interceptors: InterceptorPipeline;
3375
3440
  }
3376
3441
 
3377
- type PrimaryKey$1 = string | number;
3378
- /**
3379
- * Interface for entity context providing entity tracking and management.
3380
- */
3381
- interface EntityContext {
3382
- /** The database dialect */
3383
- dialect: Dialect;
3384
- /** The database executor */
3385
- executor: DbExecutor;
3386
- /**
3387
- * Gets an entity by table and primary key.
3388
- * @param table - The table definition
3389
- * @param pk - The primary key value
3390
- * @returns The entity or undefined
3391
- */
3392
- getEntity(table: TableDef, pk: PrimaryKey$1): object | undefined;
3393
- /**
3394
- * Sets an entity in the context.
3395
- * @param table - The table definition
3396
- * @param pk - The primary key value
3397
- * @param entity - The entity to set
3398
- */
3399
- setEntity(table: TableDef, pk: PrimaryKey$1, entity: object): void;
3400
- /**
3401
- * Tracks a new entity.
3402
- * @param table - The table definition
3403
- * @param entity - The new entity
3404
- * @param pk - Optional primary key
3405
- */
3406
- trackNew(table: TableDef, entity: object, pk?: PrimaryKey$1): void;
3407
- /**
3408
- * Tracks a managed entity.
3409
- * @param table - The table definition
3410
- * @param pk - The primary key
3411
- * @param entity - The managed entity
3412
- */
3413
- trackManaged(table: TableDef, pk: PrimaryKey$1, entity: object): void;
3414
- /**
3415
- * Marks an entity as dirty.
3416
- * @param entity - The entity to mark
3417
- */
3418
- markDirty(entity: object): void;
3419
- /**
3420
- * Marks an entity as removed.
3421
- * @param entity - The entity to mark
3422
- */
3423
- markRemoved(entity: object): void;
3424
- /**
3425
- * Gets all tracked entities for a table.
3426
- * @param table - The table definition
3427
- * @returns Array of tracked entities
3428
- */
3429
- getEntitiesForTable(table: TableDef): TrackedEntity[];
3430
- /**
3431
- * Registers a relation change.
3432
- * @param root - The root entity
3433
- * @param relationKey - The relation key
3434
- * @param rootTable - The root table definition
3435
- * @param relationName - The relation name
3436
- * @param relation - The relation definition
3437
- * @param change - The relation change
3438
- */
3439
- registerRelationChange(root: unknown, relationKey: RelationKey$1, rootTable: TableDef, relationName: string, relation: RelationDef, change: RelationChange<unknown>): void;
3440
- }
3441
-
3442
3442
  /**
3443
3443
  * Context used during the hydration of entities from database results.
3444
3444
  * It carries necessary services and processors to handle identity management,