metal-orm 1.0.64 → 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.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +119 -117
- package/dist/index.d.ts +119 -117
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/core/ast/aggregate-functions.ts +1 -1
- package/src/core/ast/window-functions.ts +6 -6
- package/src/core/functions/array.ts +4 -4
- package/src/core/functions/control-flow.ts +6 -6
- package/src/core/functions/json.ts +6 -6
- package/src/index.ts +2 -1
- package/src/orm/entity-context.ts +9 -7
- package/src/orm/entity-relations.ts +207 -207
- package/src/orm/entity.ts +124 -124
- package/src/orm/execute.ts +166 -166
- package/src/orm/identity-map.ts +3 -2
- package/src/orm/lazy-batch/shared.ts +1 -1
- package/src/orm/orm-session.ts +54 -54
- package/src/orm/relation-change-processor.ts +3 -3
- package/src/orm/relations/has-many.ts +1 -1
- package/src/orm/runtime-types.ts +5 -5
- package/src/orm/save-graph.ts +164 -166
- package/src/orm/unit-of-work.ts +17 -14
- package/src/query-builder/insert-query-state.ts +156 -155
- package/src/query-builder/insert.ts +5 -2
- package/src/query-builder/select.ts +112 -111
- package/src/schema/column-types.ts +14 -14
- package/src/schema/table.ts +39 -31
- package/src/schema/types.ts +54 -54
package/dist/index.d.ts
CHANGED
|
@@ -343,19 +343,19 @@ interface TableOptions {
|
|
|
343
343
|
charset?: string;
|
|
344
344
|
collation?: string;
|
|
345
345
|
}
|
|
346
|
-
interface TableHooks {
|
|
347
|
-
beforeInsert?(ctx:
|
|
348
|
-
afterInsert?(ctx:
|
|
349
|
-
beforeUpdate?(ctx:
|
|
350
|
-
afterUpdate?(ctx:
|
|
351
|
-
beforeDelete?(ctx:
|
|
352
|
-
afterDelete?(ctx:
|
|
346
|
+
interface TableHooks<TEntity = unknown, TContext = unknown> {
|
|
347
|
+
beforeInsert?(ctx: TContext, entity: TEntity): Promise<void> | void;
|
|
348
|
+
afterInsert?(ctx: TContext, entity: TEntity): Promise<void> | void;
|
|
349
|
+
beforeUpdate?(ctx: TContext, entity: TEntity): Promise<void> | void;
|
|
350
|
+
afterUpdate?(ctx: TContext, entity: TEntity): Promise<void> | void;
|
|
351
|
+
beforeDelete?(ctx: TContext, entity: TEntity): Promise<void> | void;
|
|
352
|
+
afterDelete?(ctx: TContext, entity: TEntity): Promise<void> | void;
|
|
353
353
|
}
|
|
354
354
|
/**
|
|
355
355
|
* Definition of a database table with its columns and relationships
|
|
356
356
|
* @typeParam T - Type of the columns record
|
|
357
357
|
*/
|
|
358
|
-
interface TableDef<T extends Record<string, ColumnDef> = Record<string, ColumnDef
|
|
358
|
+
interface TableDef<T extends Record<string, ColumnDef> = Record<string, ColumnDef>, TEntity = unknown, TContext = unknown> {
|
|
359
359
|
/** Name of the table */
|
|
360
360
|
name: string;
|
|
361
361
|
/** Optional schema/catalog name */
|
|
@@ -365,7 +365,7 @@ interface TableDef<T extends Record<string, ColumnDef> = Record<string, ColumnDe
|
|
|
365
365
|
/** Record of relationship definitions keyed by relation name */
|
|
366
366
|
relations: Record<string, RelationDef>;
|
|
367
367
|
/** Optional lifecycle hooks */
|
|
368
|
-
hooks?: TableHooks
|
|
368
|
+
hooks?: TableHooks<TEntity, TContext>;
|
|
369
369
|
/** Composite primary key definition (falls back to column.primary flags) */
|
|
370
370
|
primaryKey?: string[];
|
|
371
371
|
/** Secondary indexes */
|
|
@@ -396,7 +396,7 @@ interface TableDef<T extends Record<string, ColumnDef> = Record<string, ColumnDe
|
|
|
396
396
|
* });
|
|
397
397
|
* ```
|
|
398
398
|
*/
|
|
399
|
-
declare const defineTable: <T extends Record<string, ColumnDef
|
|
399
|
+
declare const defineTable: <T extends Record<string, ColumnDef>, TEntity = unknown, TContext = unknown>(name: string, columns: T, relations?: Record<string, RelationDef>, hooks?: TableHooks<TEntity, TContext>, options?: TableOptions) => TableDef<T, TEntity, TContext>;
|
|
400
400
|
/**
|
|
401
401
|
* Assigns relations to a table definition while preserving literal typing.
|
|
402
402
|
*/
|
|
@@ -458,8 +458,8 @@ type ColumnToTs<T extends ColumnDef> = [
|
|
|
458
458
|
type InferRow<TTable extends TableDef> = {
|
|
459
459
|
[K in keyof TTable['columns']]: ColumnToTs<TTable['columns'][K]>;
|
|
460
460
|
};
|
|
461
|
-
type RelationResult$1<T extends RelationDef> = T extends HasManyRelation<infer TTarget> ? InferRow<TTarget>[] : T extends HasOneRelation<infer TTarget> ? InferRow<TTarget> | null : T extends BelongsToRelation<infer TTarget> ? InferRow<TTarget> | null : T extends BelongsToManyRelation<infer TTarget,
|
|
462
|
-
_pivot?:
|
|
461
|
+
type RelationResult$1<T extends RelationDef> = T extends HasManyRelation<infer TTarget> ? InferRow<TTarget>[] : T extends HasOneRelation<infer TTarget> ? InferRow<TTarget> | null : T extends BelongsToRelation<infer TTarget> ? InferRow<TTarget> | null : T extends BelongsToManyRelation<infer TTarget, infer TPivot> ? (InferRow<TTarget> & {
|
|
462
|
+
_pivot?: InferRow<TPivot>;
|
|
463
463
|
})[] : never;
|
|
464
464
|
/**
|
|
465
465
|
* Maps relation names to the expected row results
|
|
@@ -467,10 +467,10 @@ type RelationResult$1<T extends RelationDef> = T extends HasManyRelation<infer T
|
|
|
467
467
|
type RelationMap<TTable extends TableDef> = {
|
|
468
468
|
[K in keyof TTable['relations']]: RelationResult$1<TTable['relations'][K]>;
|
|
469
469
|
};
|
|
470
|
-
type RelationWrapper$1<TRel extends RelationDef> = TRel extends HasManyRelation<infer TTarget> ? HasManyCollection<EntityInstance<TTarget>> & ReadonlyArray<EntityInstance<TTarget>> : TRel extends HasOneRelation<infer TTarget> ? HasOneReference<EntityInstance<TTarget>> : TRel extends BelongsToManyRelation<infer TTarget> ? ManyToManyCollection<EntityInstance<TTarget> & {
|
|
471
|
-
_pivot?:
|
|
470
|
+
type RelationWrapper$1<TRel extends RelationDef> = TRel extends HasManyRelation<infer TTarget> ? HasManyCollection<EntityInstance<TTarget>> & ReadonlyArray<EntityInstance<TTarget>> : TRel extends HasOneRelation<infer TTarget> ? HasOneReference<EntityInstance<TTarget>> : TRel extends BelongsToManyRelation<infer TTarget, infer TPivot> ? ManyToManyCollection<EntityInstance<TTarget> & {
|
|
471
|
+
_pivot?: InferRow<TPivot>;
|
|
472
472
|
}> & ReadonlyArray<EntityInstance<TTarget> & {
|
|
473
|
-
_pivot?:
|
|
473
|
+
_pivot?: InferRow<TPivot>;
|
|
474
474
|
}> : TRel extends BelongsToRelation<infer TTarget> ? BelongsToReference<EntityInstance<TTarget>> : never;
|
|
475
475
|
interface HasManyCollection<TChild> {
|
|
476
476
|
length: number;
|
|
@@ -1320,7 +1320,7 @@ declare const ntile: (n: number) => TypedExpression<number>;
|
|
|
1320
1320
|
* @param defaultValue - Optional default value.
|
|
1321
1321
|
* @returns A `TypedExpression<T>` representing the `LAG` window function.
|
|
1322
1322
|
*/
|
|
1323
|
-
declare const lag: <T =
|
|
1323
|
+
declare const lag: <T = unknown>(col: ColumnRef | ColumnNode, offset?: number, defaultValue?: LiteralNode["value"]) => TypedExpression<T>;
|
|
1324
1324
|
/**
|
|
1325
1325
|
* Creates a LEAD window function.
|
|
1326
1326
|
*
|
|
@@ -1329,21 +1329,21 @@ declare const lag: <T = any>(col: ColumnRef | ColumnNode, offset?: number, defau
|
|
|
1329
1329
|
* @param defaultValue - Optional default value.
|
|
1330
1330
|
* @returns A `TypedExpression<T>` representing the `LEAD` window function.
|
|
1331
1331
|
*/
|
|
1332
|
-
declare const lead: <T =
|
|
1332
|
+
declare const lead: <T = unknown>(col: ColumnRef | ColumnNode, offset?: number, defaultValue?: LiteralNode["value"]) => TypedExpression<T>;
|
|
1333
1333
|
/**
|
|
1334
1334
|
* Creates a FIRST_VALUE window function.
|
|
1335
1335
|
*
|
|
1336
1336
|
* @param col - Column or expression to get first value from.
|
|
1337
1337
|
* @returns A `TypedExpression<T>` representing the `FIRST_VALUE` window function.
|
|
1338
1338
|
*/
|
|
1339
|
-
declare const firstValue: <T =
|
|
1339
|
+
declare const firstValue: <T = unknown>(col: ColumnRef | ColumnNode) => TypedExpression<T>;
|
|
1340
1340
|
/**
|
|
1341
1341
|
* Creates a LAST_VALUE window function.
|
|
1342
1342
|
*
|
|
1343
1343
|
* @param col - Column or expression to get last value from.
|
|
1344
1344
|
* @returns A `TypedExpression<T>` representing the `LAST_VALUE` window function.
|
|
1345
1345
|
*/
|
|
1346
|
-
declare const lastValue: <T =
|
|
1346
|
+
declare const lastValue: <T = unknown>(col: ColumnRef | ColumnNode) => TypedExpression<T>;
|
|
1347
1347
|
/**
|
|
1348
1348
|
* Creates a custom window function.
|
|
1349
1349
|
*
|
|
@@ -1353,7 +1353,7 @@ declare const lastValue: <T = any>(col: ColumnRef | ColumnNode) => TypedExpressi
|
|
|
1353
1353
|
* @param orderBy - Optional ORDER BY clauses.
|
|
1354
1354
|
* @returns A `TypedExpression<T>` representing the window function.
|
|
1355
1355
|
*/
|
|
1356
|
-
declare const windowFunction: <T =
|
|
1356
|
+
declare const windowFunction: <T = unknown>(name: string, args?: (ColumnRef | ColumnNode | LiteralNode | JsonPathNode)[], partitionBy?: (ColumnRef | ColumnNode)[], orderBy?: {
|
|
1357
1357
|
column: ColumnRef | ColumnNode;
|
|
1358
1358
|
direction: OrderDirection;
|
|
1359
1359
|
}[]) => TypedExpression<T>;
|
|
@@ -2811,7 +2811,7 @@ interface TrackedEntity {
|
|
|
2811
2811
|
/** The table definition this entity belongs to */
|
|
2812
2812
|
table: TableDef;
|
|
2813
2813
|
/** The actual entity instance */
|
|
2814
|
-
entity:
|
|
2814
|
+
entity: object;
|
|
2815
2815
|
/** Primary key value of the entity */
|
|
2816
2816
|
pk: string | number | null;
|
|
2817
2817
|
/** Current status of the entity */
|
|
@@ -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:
|
|
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:
|
|
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
|
|
@@ -3060,38 +3125,38 @@ declare class UnitOfWork {
|
|
|
3060
3125
|
* @param entity - The entity to find
|
|
3061
3126
|
* @returns The tracked entity or undefined if not found
|
|
3062
3127
|
*/
|
|
3063
|
-
findTracked(entity:
|
|
3128
|
+
findTracked(entity: object): TrackedEntity | undefined;
|
|
3064
3129
|
/**
|
|
3065
3130
|
* Sets an entity in the identity map.
|
|
3066
3131
|
* @param table - The table definition
|
|
3067
3132
|
* @param pk - The primary key value
|
|
3068
3133
|
* @param entity - The entity instance
|
|
3069
3134
|
*/
|
|
3070
|
-
setEntity(table: TableDef, pk:
|
|
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:
|
|
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:
|
|
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
|
|
3088
3153
|
*/
|
|
3089
|
-
markDirty(entity:
|
|
3154
|
+
markDirty(entity: object): void;
|
|
3090
3155
|
/**
|
|
3091
3156
|
* Marks an entity as removed.
|
|
3092
3157
|
* @param entity - The entity to mark as removed
|
|
3093
3158
|
*/
|
|
3094
|
-
markRemoved(entity:
|
|
3159
|
+
markRemoved(entity: object): void;
|
|
3095
3160
|
/**
|
|
3096
3161
|
* Flushes pending changes to the database.
|
|
3097
3162
|
*/
|
|
@@ -3374,70 +3439,6 @@ interface ExecutionContext {
|
|
|
3374
3439
|
interceptors: InterceptorPipeline;
|
|
3375
3440
|
}
|
|
3376
3441
|
|
|
3377
|
-
/**
|
|
3378
|
-
* Interface for entity context providing entity tracking and management.
|
|
3379
|
-
*/
|
|
3380
|
-
interface EntityContext {
|
|
3381
|
-
/** The database dialect */
|
|
3382
|
-
dialect: Dialect;
|
|
3383
|
-
/** The database executor */
|
|
3384
|
-
executor: DbExecutor;
|
|
3385
|
-
/**
|
|
3386
|
-
* Gets an entity by table and primary key.
|
|
3387
|
-
* @param table - The table definition
|
|
3388
|
-
* @param pk - The primary key value
|
|
3389
|
-
* @returns The entity or undefined
|
|
3390
|
-
*/
|
|
3391
|
-
getEntity(table: TableDef, pk: unknown): unknown;
|
|
3392
|
-
/**
|
|
3393
|
-
* Sets an entity in the context.
|
|
3394
|
-
* @param table - The table definition
|
|
3395
|
-
* @param pk - The primary key value
|
|
3396
|
-
* @param entity - The entity to set
|
|
3397
|
-
*/
|
|
3398
|
-
setEntity(table: TableDef, pk: unknown, entity: unknown): void;
|
|
3399
|
-
/**
|
|
3400
|
-
* Tracks a new entity.
|
|
3401
|
-
* @param table - The table definition
|
|
3402
|
-
* @param entity - The new entity
|
|
3403
|
-
* @param pk - Optional primary key
|
|
3404
|
-
*/
|
|
3405
|
-
trackNew(table: TableDef, entity: unknown, pk?: unknown): void;
|
|
3406
|
-
/**
|
|
3407
|
-
* Tracks a managed entity.
|
|
3408
|
-
* @param table - The table definition
|
|
3409
|
-
* @param pk - The primary key
|
|
3410
|
-
* @param entity - The managed entity
|
|
3411
|
-
*/
|
|
3412
|
-
trackManaged(table: TableDef, pk: unknown, entity: unknown): void;
|
|
3413
|
-
/**
|
|
3414
|
-
* Marks an entity as dirty.
|
|
3415
|
-
* @param entity - The entity to mark
|
|
3416
|
-
*/
|
|
3417
|
-
markDirty(entity: unknown): void;
|
|
3418
|
-
/**
|
|
3419
|
-
* Marks an entity as removed.
|
|
3420
|
-
* @param entity - The entity to mark
|
|
3421
|
-
*/
|
|
3422
|
-
markRemoved(entity: unknown): void;
|
|
3423
|
-
/**
|
|
3424
|
-
* Gets all tracked entities for a table.
|
|
3425
|
-
* @param table - The table definition
|
|
3426
|
-
* @returns Array of tracked entities
|
|
3427
|
-
*/
|
|
3428
|
-
getEntitiesForTable(table: TableDef): TrackedEntity[];
|
|
3429
|
-
/**
|
|
3430
|
-
* Registers a relation change.
|
|
3431
|
-
* @param root - The root entity
|
|
3432
|
-
* @param relationKey - The relation key
|
|
3433
|
-
* @param rootTable - The root table definition
|
|
3434
|
-
* @param relationName - The relation name
|
|
3435
|
-
* @param relation - The relation definition
|
|
3436
|
-
* @param change - The relation change
|
|
3437
|
-
*/
|
|
3438
|
-
registerRelationChange(root: unknown, relationKey: RelationKey$1, rootTable: TableDef, relationName: string, relation: RelationDef, change: RelationChange<unknown>): void;
|
|
3439
|
-
}
|
|
3440
|
-
|
|
3441
3442
|
/**
|
|
3442
3443
|
* Context used during the hydration of entities from database results.
|
|
3443
3444
|
* It carries necessary services and processors to handle identity management,
|
|
@@ -3577,38 +3578,38 @@ declare class OrmSession<E extends DomainEvent = OrmDomainEvent> implements Enti
|
|
|
3577
3578
|
* @param pk - The primary key value
|
|
3578
3579
|
* @returns The entity or undefined if not found
|
|
3579
3580
|
*/
|
|
3580
|
-
getEntity(table: TableDef, pk:
|
|
3581
|
+
getEntity(table: TableDef, pk: PrimaryKey$1): object | undefined;
|
|
3581
3582
|
/**
|
|
3582
3583
|
* Sets an entity in the identity map.
|
|
3583
3584
|
* @param table - The table definition
|
|
3584
3585
|
* @param pk - The primary key value
|
|
3585
3586
|
* @param entity - The entity instance
|
|
3586
3587
|
*/
|
|
3587
|
-
setEntity(table: TableDef, pk:
|
|
3588
|
+
setEntity(table: TableDef, pk: PrimaryKey$1, entity: object): void;
|
|
3588
3589
|
/**
|
|
3589
3590
|
* Tracks a new entity.
|
|
3590
3591
|
* @param table - The table definition
|
|
3591
3592
|
* @param entity - The entity instance
|
|
3592
3593
|
* @param pk - Optional primary key value
|
|
3593
3594
|
*/
|
|
3594
|
-
trackNew(table: TableDef, entity:
|
|
3595
|
+
trackNew(table: TableDef, entity: object, pk?: PrimaryKey$1): void;
|
|
3595
3596
|
/**
|
|
3596
3597
|
* Tracks a managed entity.
|
|
3597
3598
|
* @param table - The table definition
|
|
3598
3599
|
* @param pk - The primary key value
|
|
3599
3600
|
* @param entity - The entity instance
|
|
3600
3601
|
*/
|
|
3601
|
-
trackManaged(table: TableDef, pk:
|
|
3602
|
+
trackManaged(table: TableDef, pk: PrimaryKey$1, entity: object): void;
|
|
3602
3603
|
/**
|
|
3603
3604
|
* Marks an entity as dirty (modified).
|
|
3604
3605
|
* @param entity - The entity to mark as dirty
|
|
3605
3606
|
*/
|
|
3606
|
-
markDirty(entity:
|
|
3607
|
+
markDirty(entity: object): void;
|
|
3607
3608
|
/**
|
|
3608
3609
|
* Marks an entity as removed.
|
|
3609
3610
|
* @param entity - The entity to mark as removed
|
|
3610
3611
|
*/
|
|
3611
|
-
markRemoved(entity:
|
|
3612
|
+
markRemoved(entity: object): void;
|
|
3612
3613
|
/**
|
|
3613
3614
|
* Registers a relation change.
|
|
3614
3615
|
* @param root - The root entity
|
|
@@ -4229,7 +4230,7 @@ declare class SelectQueryBuilder<T = EntityInstance<TableDef>, TTable extends Ta
|
|
|
4229
4230
|
* .where(eq(userTable.columns.active, false));
|
|
4230
4231
|
* qb.union(activeUsers).union(inactiveUsers);
|
|
4231
4232
|
*/
|
|
4232
|
-
union<TSub extends TableDef>(query: SelectQueryBuilder<
|
|
4233
|
+
union<TSub extends TableDef>(query: SelectQueryBuilder<T, TSub> | SelectQueryNode): SelectQueryBuilder<T, TTable>;
|
|
4233
4234
|
/**
|
|
4234
4235
|
* Combines this query with another using UNION ALL
|
|
4235
4236
|
* @param query - Query to union with
|
|
@@ -4239,7 +4240,7 @@ declare class SelectQueryBuilder<T = EntityInstance<TableDef>, TTable extends Ta
|
|
|
4239
4240
|
* const q2 = new SelectQueryBuilder(userTable).where(lt(userTable.columns.score, 20));
|
|
4240
4241
|
* qb.unionAll(q1).unionAll(q2);
|
|
4241
4242
|
*/
|
|
4242
|
-
unionAll<TSub extends TableDef>(query: SelectQueryBuilder<
|
|
4243
|
+
unionAll<TSub extends TableDef>(query: SelectQueryBuilder<T, TSub> | SelectQueryNode): SelectQueryBuilder<T, TTable>;
|
|
4243
4244
|
/**
|
|
4244
4245
|
* Combines this query with another using INTERSECT
|
|
4245
4246
|
* @param query - Query to intersect with
|
|
@@ -4251,7 +4252,7 @@ declare class SelectQueryBuilder<T = EntityInstance<TableDef>, TTable extends Ta
|
|
|
4251
4252
|
* .where(eq(userTable.columns.premium, true));
|
|
4252
4253
|
* qb.intersect(activeUsers).intersect(premiumUsers);
|
|
4253
4254
|
*/
|
|
4254
|
-
intersect<TSub extends TableDef>(query: SelectQueryBuilder<
|
|
4255
|
+
intersect<TSub extends TableDef>(query: SelectQueryBuilder<T, TSub> | SelectQueryNode): SelectQueryBuilder<T, TTable>;
|
|
4255
4256
|
/**
|
|
4256
4257
|
* Combines this query with another using EXCEPT
|
|
4257
4258
|
* @param query - Query to subtract
|
|
@@ -4262,7 +4263,7 @@ declare class SelectQueryBuilder<T = EntityInstance<TableDef>, TTable extends Ta
|
|
|
4262
4263
|
* .where(eq(userTable.columns.active, false));
|
|
4263
4264
|
* qb.except(allUsers).except(inactiveUsers); // Only active users
|
|
4264
4265
|
*/
|
|
4265
|
-
except<TSub extends TableDef>(query: SelectQueryBuilder<
|
|
4266
|
+
except<TSub extends TableDef>(query: SelectQueryBuilder<T, TSub> | SelectQueryNode): SelectQueryBuilder<T, TTable>;
|
|
4266
4267
|
/**
|
|
4267
4268
|
* Adds a WHERE EXISTS condition to the query
|
|
4268
4269
|
* @param subquery - Subquery to check for existence
|
|
@@ -4369,6 +4370,7 @@ type Ctor<T> = {
|
|
|
4369
4370
|
*/
|
|
4370
4371
|
declare function esel<TEntity extends object, K extends keyof TEntity & string>(entity: Ctor<TEntity>, ...props: K[]): Record<K, ColumnDef>;
|
|
4371
4372
|
|
|
4373
|
+
type InsertRows = Record<string, ValueOperandInput>[];
|
|
4372
4374
|
/**
|
|
4373
4375
|
* Maintains immutable state for building INSERT queries
|
|
4374
4376
|
*/
|
|
@@ -4392,7 +4394,7 @@ declare class InsertQueryState {
|
|
|
4392
4394
|
* @throws Error if mixing VALUES with SELECT source
|
|
4393
4395
|
* @throws Error if invalid values are provided
|
|
4394
4396
|
*/
|
|
4395
|
-
withValues(rows:
|
|
4397
|
+
withValues(rows: InsertRows): InsertQueryState;
|
|
4396
4398
|
/**
|
|
4397
4399
|
* Sets the columns for the INSERT query
|
|
4398
4400
|
* @param columns - Column nodes to insert into
|
|
@@ -4435,7 +4437,7 @@ declare class InsertQueryBuilder<T> {
|
|
|
4435
4437
|
* @param rowOrRows - Single row object or array of row objects to insert
|
|
4436
4438
|
* @returns A new InsertQueryBuilder with the VALUES clause added
|
|
4437
4439
|
*/
|
|
4438
|
-
values(rowOrRows: Record<string,
|
|
4440
|
+
values(rowOrRows: Record<string, ValueOperandInput> | Record<string, ValueOperandInput>[]): InsertQueryBuilder<T>;
|
|
4439
4441
|
/**
|
|
4440
4442
|
* Specifies the columns for the INSERT query
|
|
4441
4443
|
* @param columns - Column definitions or nodes to insert into
|
|
@@ -5917,7 +5919,7 @@ type OperandInput$2 = OperandNode | ColumnDef | string | number | boolean | null
|
|
|
5917
5919
|
* @example
|
|
5918
5920
|
* coalesce(users.nickname, users.firstName, 'Guest');
|
|
5919
5921
|
*/
|
|
5920
|
-
declare const coalesce: <T =
|
|
5922
|
+
declare const coalesce: <T = unknown>(...args: OperandInput$2[]) => TypedExpression<T>;
|
|
5921
5923
|
/**
|
|
5922
5924
|
* Returns null if the two arguments are equal, otherwise returns the first argument.
|
|
5923
5925
|
*
|
|
@@ -5925,21 +5927,21 @@ declare const coalesce: <T = any>(...args: OperandInput$2[]) => TypedExpression<
|
|
|
5925
5927
|
* @param val2 - The second value to compare against.
|
|
5926
5928
|
* @returns A `TypedExpression<T>` representing the `NULLIF` SQL function.
|
|
5927
5929
|
*/
|
|
5928
|
-
declare const nullif: <T =
|
|
5930
|
+
declare const nullif: <T = unknown>(val1: OperandInput$2, val2: OperandInput$2) => TypedExpression<T>;
|
|
5929
5931
|
/**
|
|
5930
5932
|
* Returns the largest value in a list.
|
|
5931
5933
|
*
|
|
5932
5934
|
* @param args - The list of values or columns to compare.
|
|
5933
5935
|
* @returns A `TypedExpression<T>` representing the `GREATEST` SQL function.
|
|
5934
5936
|
*/
|
|
5935
|
-
declare const greatest: <T =
|
|
5937
|
+
declare const greatest: <T = unknown>(...args: OperandInput$2[]) => TypedExpression<T>;
|
|
5936
5938
|
/**
|
|
5937
5939
|
* Returns the smallest value in a list.
|
|
5938
5940
|
*
|
|
5939
5941
|
* @param args - The list of values or columns to compare.
|
|
5940
5942
|
* @returns A `TypedExpression<T>` representing the `LEAST` SQL function.
|
|
5941
5943
|
*/
|
|
5942
|
-
declare const least: <T =
|
|
5944
|
+
declare const least: <T = unknown>(...args: OperandInput$2[]) => TypedExpression<T>;
|
|
5943
5945
|
/**
|
|
5944
5946
|
* Returns the first argument if it is not null, otherwise returns the second argument.
|
|
5945
5947
|
*
|
|
@@ -5947,7 +5949,7 @@ declare const least: <T = any>(...args: OperandInput$2[]) => TypedExpression<T>;
|
|
|
5947
5949
|
* @param defaultValue - The default value to return if val is null.
|
|
5948
5950
|
* @returns A `TypedExpression<T>` representing the `COALESCE` SQL function.
|
|
5949
5951
|
*/
|
|
5950
|
-
declare const ifNull: <T =
|
|
5952
|
+
declare const ifNull: <T = unknown>(val: OperandInput$2, defaultValue: OperandInput$2) => TypedExpression<T>;
|
|
5951
5953
|
|
|
5952
5954
|
type OperandInput$1 = OperandNode | ColumnDef | string | number | boolean | null;
|
|
5953
5955
|
/**
|
|
@@ -5964,16 +5966,16 @@ declare const jsonLength: (target: OperandInput$1, path?: OperandInput$1) => Typ
|
|
|
5964
5966
|
* @param target - JSON column or value.
|
|
5965
5967
|
* @param path - JSON path to set.
|
|
5966
5968
|
* @param value - Value to set.
|
|
5967
|
-
* @returns A `TypedExpression<
|
|
5969
|
+
* @returns A `TypedExpression<T>` representing the `JSON_SET` SQL function.
|
|
5968
5970
|
*/
|
|
5969
|
-
declare const jsonSet: (target: OperandInput$1, path: OperandInput$1, value: OperandInput$1) => TypedExpression<
|
|
5971
|
+
declare const jsonSet: <T = unknown>(target: OperandInput$1, path: OperandInput$1, value: OperandInput$1) => TypedExpression<T>;
|
|
5970
5972
|
/**
|
|
5971
5973
|
* Aggregates values into a JSON array.
|
|
5972
5974
|
*
|
|
5973
5975
|
* @param value - Column or expression to aggregate.
|
|
5974
|
-
* @returns A `TypedExpression<
|
|
5976
|
+
* @returns A `TypedExpression<unknown[]>` representing the `JSON_ARRAYAGG` SQL function.
|
|
5975
5977
|
*/
|
|
5976
|
-
declare const jsonArrayAgg: (value: OperandInput$1) => TypedExpression<
|
|
5978
|
+
declare const jsonArrayAgg: (value: OperandInput$1) => TypedExpression<unknown[]>;
|
|
5977
5979
|
/**
|
|
5978
5980
|
* Checks if a JSON document contains a specific piece of data.
|
|
5979
5981
|
*
|
|
@@ -5990,9 +5992,9 @@ type OperandInput = OperandNode | ColumnDef | string | number | boolean | null;
|
|
|
5990
5992
|
*
|
|
5991
5993
|
* @param array - Array column or value.
|
|
5992
5994
|
* @param value - Value to append.
|
|
5993
|
-
* @returns A `TypedExpression<
|
|
5995
|
+
* @returns A `TypedExpression<unknown[]>` representing the `ARRAY_APPEND` SQL function.
|
|
5994
5996
|
*/
|
|
5995
|
-
declare const arrayAppend: (array: OperandInput, value: OperandInput) => TypedExpression<
|
|
5997
|
+
declare const arrayAppend: (array: OperandInput, value: OperandInput) => TypedExpression<unknown[]>;
|
|
5996
5998
|
|
|
5997
5999
|
/**
|
|
5998
6000
|
* Browser-compatible implementation of AsyncLocalStorage.
|
|
@@ -6946,4 +6948,4 @@ type PooledExecutorFactoryOptions<TConn> = {
|
|
|
6946
6948
|
*/
|
|
6947
6949
|
declare function createPooledExecutorFactory<TConn>(opts: PooledExecutorFactoryOptions<TConn>): DbExecutorFactory;
|
|
6948
6950
|
|
|
6949
|
-
export { type AliasRefNode, type AnyDomainEvent, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetweenExpressionNode, type BinaryExpressionNode, type BitwiseExpressionNode, 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, ConstructorMaterializationStrategy, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type 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, type IntrospectOptions, type JsonPathNode, type Jsonify, type JsonifyScalar, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, PrototypeMaterializationStrategy, 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 ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SelectableKeys, type SimpleQueryRunner, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeScriptGenerator, type TypedExpression, type TypedLike, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, age, aliasRef, and, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, concat, concatWs, correlateBy, cos, cot, count, countAll, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, endOfMonth, entityRef, eq, esel, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, generateSchemaSqlFor, getColumn, getDecoratorMetadata, getSchemaIntrospector, getTableDefFromEntity, greatest, groupConcat, gt, gte, hasMany, hasOne, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isOperandNode, 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, materializeAs, max, md5, min, minute, mod, month, mul, neq, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pi, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, second, sel, selectFrom, selectFromEntity, setRelations, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, update, upper, utcNow, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, windowFunction, year };
|
|
6951
|
+
export { type AliasRefNode, type AnyDomainEvent, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetweenExpressionNode, type BinaryExpressionNode, type BitwiseExpressionNode, 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, ConstructorMaterializationStrategy, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, 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 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, type IntrospectOptions, type JsonPathNode, type Jsonify, type JsonifyScalar, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, PrototypeMaterializationStrategy, 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 ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SelectableKeys, type SimpleQueryRunner, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeScriptGenerator, type TypedExpression, type TypedLike, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, age, aliasRef, and, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, concat, concatWs, correlateBy, cos, cot, count, countAll, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, endOfMonth, entityRef, eq, esel, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, generateSchemaSqlFor, getColumn, getDecoratorMetadata, getSchemaIntrospector, getTableDefFromEntity, greatest, groupConcat, gt, gte, hasMany, hasOne, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isOperandNode, 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, materializeAs, max, md5, min, minute, mod, month, mul, neq, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pi, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, second, sel, selectFrom, selectFromEntity, setRelations, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, update, upper, utcNow, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, windowFunction, year };
|
package/dist/index.js
CHANGED
|
@@ -11124,6 +11124,7 @@ var UnitOfWork = class {
|
|
|
11124
11124
|
const key = findPrimaryKey(tracked.table);
|
|
11125
11125
|
const val = tracked.entity[key];
|
|
11126
11126
|
if (val === void 0 || val === null) return null;
|
|
11127
|
+
if (typeof val !== "string" && typeof val !== "number") return null;
|
|
11127
11128
|
return val;
|
|
11128
11129
|
}
|
|
11129
11130
|
};
|