metal-orm 1.0.59 → 1.0.62
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/README.md +15 -11
- package/dist/index.cjs +432 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +375 -9
- package/dist/index.d.ts +375 -9
- package/dist/index.js +424 -63
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/decorators/bootstrap.ts +127 -119
- package/src/decorators/index.ts +4 -0
- package/src/index.ts +7 -7
- package/src/orm/entity-materializer.ts +159 -0
- package/src/orm/entity-registry.ts +39 -0
- package/src/orm/execute.ts +62 -18
- package/src/query-builder/select/select-operations.ts +1 -2
- package/src/query-builder/select.ts +594 -345
package/dist/index.d.cts
CHANGED
|
@@ -3509,7 +3509,7 @@ type DeepSelectConfig<TTable extends TableDef> = DeepSelectEntry<TTable>[];
|
|
|
3509
3509
|
* @typeParam T - Result type for projections (unused)
|
|
3510
3510
|
* @typeParam TTable - Table definition being queried
|
|
3511
3511
|
*/
|
|
3512
|
-
declare class SelectQueryBuilder<T =
|
|
3512
|
+
declare class SelectQueryBuilder<T = EntityInstance<any>, TTable extends TableDef = TableDef> {
|
|
3513
3513
|
private readonly env;
|
|
3514
3514
|
private readonly context;
|
|
3515
3515
|
private readonly columnSelector;
|
|
@@ -3522,6 +3522,7 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3522
3522
|
private readonly relationFacet;
|
|
3523
3523
|
private readonly lazyRelations;
|
|
3524
3524
|
private readonly lazyRelationOptions;
|
|
3525
|
+
private readonly entityConstructor?;
|
|
3525
3526
|
/**
|
|
3526
3527
|
* Creates a new SelectQueryBuilder instance
|
|
3527
3528
|
* @param table - Table definition to query
|
|
@@ -3529,7 +3530,7 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3529
3530
|
* @param hydration - Optional hydration manager
|
|
3530
3531
|
* @param dependencies - Optional query builder dependencies
|
|
3531
3532
|
*/
|
|
3532
|
-
constructor(table: TTable, state?: SelectQueryState, hydration?: HydrationManager, dependencies?: Partial<SelectQueryBuilderDependencies>, lazyRelations?: Set<string>, lazyRelationOptions?: Map<string, RelationIncludeOptions>);
|
|
3533
|
+
constructor(table: TTable, state?: SelectQueryState, hydration?: HydrationManager, dependencies?: Partial<SelectQueryBuilderDependencies>, lazyRelations?: Set<string>, lazyRelationOptions?: Map<string, RelationIncludeOptions>, entityConstructor?: EntityConstructor<any>);
|
|
3533
3534
|
/**
|
|
3534
3535
|
* Creates a new SelectQueryBuilder instance with updated context and lazy relations
|
|
3535
3536
|
* @param context - Updated query context
|
|
@@ -3540,6 +3541,8 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3540
3541
|
/**
|
|
3541
3542
|
* Applies an alias to the root FROM table.
|
|
3542
3543
|
* @param alias - Alias to apply
|
|
3544
|
+
* @example
|
|
3545
|
+
* const qb = new SelectQueryBuilder(userTable).as('u');
|
|
3543
3546
|
*/
|
|
3544
3547
|
as(alias: string): SelectQueryBuilder<T, TTable>;
|
|
3545
3548
|
/**
|
|
@@ -3567,6 +3570,15 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3567
3570
|
* Can be called with column names or a projection object.
|
|
3568
3571
|
* @param args - Column names or projection object
|
|
3569
3572
|
* @returns New query builder instance with selected columns
|
|
3573
|
+
* @example
|
|
3574
|
+
* // Select specific columns
|
|
3575
|
+
* qb.select('id', 'name', 'email');
|
|
3576
|
+
* @example
|
|
3577
|
+
* // Select with aliases and expressions
|
|
3578
|
+
* qb.select({
|
|
3579
|
+
* id: userTable.columns.id,
|
|
3580
|
+
* fullName: concat(userTable.columns.firstName, ' ', userTable.columns.lastName)
|
|
3581
|
+
* });
|
|
3570
3582
|
*/
|
|
3571
3583
|
select<K extends keyof TTable['columns'] & string>(...args: K[]): SelectQueryBuilder<T, TTable>;
|
|
3572
3584
|
select(columns: Record<string, ColumnSelectionValue>): SelectQueryBuilder<T, TTable>;
|
|
@@ -3574,6 +3586,8 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3574
3586
|
* Selects raw column expressions
|
|
3575
3587
|
* @param cols - Column expressions as strings
|
|
3576
3588
|
* @returns New query builder instance with raw column selections
|
|
3589
|
+
* @example
|
|
3590
|
+
* qb.selectRaw('COUNT(*) as total', 'UPPER(name) as upper_name');
|
|
3577
3591
|
*/
|
|
3578
3592
|
selectRaw(...cols: string[]): SelectQueryBuilder<T, TTable>;
|
|
3579
3593
|
/**
|
|
@@ -3582,6 +3596,12 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3582
3596
|
* @param query - Query builder or query node for the CTE
|
|
3583
3597
|
* @param columns - Optional column names for the CTE
|
|
3584
3598
|
* @returns New query builder instance with the CTE
|
|
3599
|
+
* @example
|
|
3600
|
+
* const recentUsers = new SelectQueryBuilder(userTable)
|
|
3601
|
+
* .where(gt(userTable.columns.createdAt, subDays(now(), 30)));
|
|
3602
|
+
* const qb = new SelectQueryBuilder(userTable)
|
|
3603
|
+
* .with('recent_users', recentUsers)
|
|
3604
|
+
* .from('recent_users');
|
|
3585
3605
|
*/
|
|
3586
3606
|
with<TSub extends TableDef>(name: string, query: SelectQueryBuilder<unknown, TSub> | SelectQueryNode, columns?: string[]): SelectQueryBuilder<T, TTable>;
|
|
3587
3607
|
/**
|
|
@@ -3590,6 +3610,19 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3590
3610
|
* @param query - Query builder or query node for the CTE
|
|
3591
3611
|
* @param columns - Optional column names for the CTE
|
|
3592
3612
|
* @returns New query builder instance with the recursive CTE
|
|
3613
|
+
* @example
|
|
3614
|
+
* // Base case: select root nodes
|
|
3615
|
+
* const baseQuery = new SelectQueryBuilder(orgTable)
|
|
3616
|
+
* .where(eq(orgTable.columns.parentId, 1));
|
|
3617
|
+
* // Recursive case: join with the CTE itself
|
|
3618
|
+
* const recursiveQuery = new SelectQueryBuilder(orgTable)
|
|
3619
|
+
* .join('org_hierarchy', 'oh', eq(orgTable.columns.parentId, col('oh.id')));
|
|
3620
|
+
* // Combine base and recursive parts
|
|
3621
|
+
* const orgHierarchy = baseQuery.union(recursiveQuery);
|
|
3622
|
+
* // Use in main query
|
|
3623
|
+
* const qb = new SelectQueryBuilder(orgTable)
|
|
3624
|
+
* .withRecursive('org_hierarchy', orgHierarchy)
|
|
3625
|
+
* .from('org_hierarchy');
|
|
3593
3626
|
*/
|
|
3594
3627
|
withRecursive<TSub extends TableDef>(name: string, query: SelectQueryBuilder<unknown, TSub> | SelectQueryNode, columns?: string[]): SelectQueryBuilder<T, TTable>;
|
|
3595
3628
|
/**
|
|
@@ -3598,6 +3631,11 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3598
3631
|
* @param alias - Alias for the derived table
|
|
3599
3632
|
* @param columnAliases - Optional column alias list
|
|
3600
3633
|
* @returns New query builder instance with updated FROM
|
|
3634
|
+
* @example
|
|
3635
|
+
* const subquery = new SelectQueryBuilder(userTable)
|
|
3636
|
+
* .select('id', 'name')
|
|
3637
|
+
* .where(gt(userTable.columns.score, 100));
|
|
3638
|
+
* qb.fromSubquery(subquery, 'high_scorers', ['userId', 'userName']);
|
|
3601
3639
|
*/
|
|
3602
3640
|
fromSubquery<TSub extends TableDef>(subquery: SelectQueryBuilder<unknown, TSub> | SelectQueryNode, alias: string, columnAliases?: string[]): SelectQueryBuilder<T, TTable>;
|
|
3603
3641
|
/**
|
|
@@ -3606,6 +3644,13 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3606
3644
|
* @param args - Optional function arguments
|
|
3607
3645
|
* @param alias - Optional alias for the function table
|
|
3608
3646
|
* @param options - Optional function-table metadata (lateral, ordinality, column aliases, schema)
|
|
3647
|
+
* @example
|
|
3648
|
+
* qb.fromFunctionTable(
|
|
3649
|
+
* 'generate_series',
|
|
3650
|
+
* [literal(1), literal(10), literal(1)],
|
|
3651
|
+
* 'series',
|
|
3652
|
+
* { columnAliases: ['value'] }
|
|
3653
|
+
* );
|
|
3609
3654
|
*/
|
|
3610
3655
|
fromFunctionTable(name: string, args?: OperandNode[], alias?: string, options?: {
|
|
3611
3656
|
lateral?: boolean;
|
|
@@ -3618,6 +3663,12 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3618
3663
|
* @param alias - Alias for the subquery column
|
|
3619
3664
|
* @param sub - Query builder or query node for the subquery
|
|
3620
3665
|
* @returns New query builder instance with the subquery selection
|
|
3666
|
+
* @example
|
|
3667
|
+
* const postCount = new SelectQueryBuilder(postTable)
|
|
3668
|
+
* .select(count(postTable.columns.id))
|
|
3669
|
+
* .where(eq(postTable.columns.userId, col('u.id')));
|
|
3670
|
+
* qb.select('id', 'name')
|
|
3671
|
+
* .selectSubquery('postCount', postCount);
|
|
3621
3672
|
*/
|
|
3622
3673
|
selectSubquery<TSub extends TableDef>(alias: string, sub: SelectQueryBuilder<unknown, TSub> | SelectQueryNode): SelectQueryBuilder<T, TTable>;
|
|
3623
3674
|
/**
|
|
@@ -3628,6 +3679,15 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3628
3679
|
* @param joinKind - Join kind (defaults to INNER)
|
|
3629
3680
|
* @param columnAliases - Optional column alias list for the derived table
|
|
3630
3681
|
* @returns New query builder instance with the derived-table join
|
|
3682
|
+
* @example
|
|
3683
|
+
* const activeUsers = new SelectQueryBuilder(userTable)
|
|
3684
|
+
* .where(eq(userTable.columns.active, true));
|
|
3685
|
+
* qb.joinSubquery(
|
|
3686
|
+
* activeUsers,
|
|
3687
|
+
* 'au',
|
|
3688
|
+
* eq(col('t.userId'), col('au.id')),
|
|
3689
|
+
* JOIN_KINDS.LEFT
|
|
3690
|
+
* );
|
|
3631
3691
|
*/
|
|
3632
3692
|
joinSubquery<TSub extends TableDef>(subquery: SelectQueryBuilder<unknown, TSub> | SelectQueryNode, alias: string, condition: BinaryExpressionNode, joinKind?: JoinKind, columnAliases?: string[]): SelectQueryBuilder<T, TTable>;
|
|
3633
3693
|
/**
|
|
@@ -3638,6 +3698,15 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3638
3698
|
* @param condition - Join condition expression
|
|
3639
3699
|
* @param joinKind - Kind of join (defaults to INNER)
|
|
3640
3700
|
* @param options - Optional metadata (lateral, ordinality, column aliases, schema)
|
|
3701
|
+
* @example
|
|
3702
|
+
* qb.joinFunctionTable(
|
|
3703
|
+
* 'generate_series',
|
|
3704
|
+
* [literal(1), literal(10)],
|
|
3705
|
+
* 'gs',
|
|
3706
|
+
* eq(col('t.value'), col('gs.value')),
|
|
3707
|
+
* JOIN_KINDS.INNER,
|
|
3708
|
+
* { columnAliases: ['value'] }
|
|
3709
|
+
* );
|
|
3641
3710
|
*/
|
|
3642
3711
|
joinFunctionTable(name: string, args: OperandNode[], alias: string, condition: BinaryExpressionNode, joinKind?: JoinKind, options?: {
|
|
3643
3712
|
lateral?: boolean;
|
|
@@ -3650,6 +3719,11 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3650
3719
|
* @param table - Table to join
|
|
3651
3720
|
* @param condition - Join condition expression
|
|
3652
3721
|
* @returns New query builder instance with the INNER JOIN
|
|
3722
|
+
* @example
|
|
3723
|
+
* qb.innerJoin(
|
|
3724
|
+
* postTable,
|
|
3725
|
+
* eq(userTable.columns.id, postTable.columns.userId)
|
|
3726
|
+
* );
|
|
3653
3727
|
*/
|
|
3654
3728
|
innerJoin(table: TableDef, condition: BinaryExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3655
3729
|
/**
|
|
@@ -3657,6 +3731,11 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3657
3731
|
* @param table - Table to join
|
|
3658
3732
|
* @param condition - Join condition expression
|
|
3659
3733
|
* @returns New query builder instance with the LEFT JOIN
|
|
3734
|
+
* @example
|
|
3735
|
+
* qb.leftJoin(
|
|
3736
|
+
* postTable,
|
|
3737
|
+
* eq(userTable.columns.id, postTable.columns.userId)
|
|
3738
|
+
* );
|
|
3660
3739
|
*/
|
|
3661
3740
|
leftJoin(table: TableDef, condition: BinaryExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3662
3741
|
/**
|
|
@@ -3664,6 +3743,11 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3664
3743
|
* @param table - Table to join
|
|
3665
3744
|
* @param condition - Join condition expression
|
|
3666
3745
|
* @returns New query builder instance with the RIGHT JOIN
|
|
3746
|
+
* @example
|
|
3747
|
+
* qb.rightJoin(
|
|
3748
|
+
* postTable,
|
|
3749
|
+
* eq(userTable.columns.id, postTable.columns.userId)
|
|
3750
|
+
* );
|
|
3667
3751
|
*/
|
|
3668
3752
|
rightJoin(table: TableDef, condition: BinaryExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3669
3753
|
/**
|
|
@@ -3671,6 +3755,8 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3671
3755
|
* @param relationName - Name of the relationship to match
|
|
3672
3756
|
* @param predicate - Optional predicate expression
|
|
3673
3757
|
* @returns New query builder instance with the relationship match
|
|
3758
|
+
* @example
|
|
3759
|
+
* qb.match('posts', eq(postTable.columns.published, true));
|
|
3674
3760
|
*/
|
|
3675
3761
|
match<K extends keyof TTable['relations'] & string>(relationName: K, predicate?: ExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3676
3762
|
/**
|
|
@@ -3679,6 +3765,10 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3679
3765
|
* @param joinKind - Type of join (defaults to INNER)
|
|
3680
3766
|
* @param extraCondition - Optional additional join condition
|
|
3681
3767
|
* @returns New query builder instance with the relationship join
|
|
3768
|
+
* @example
|
|
3769
|
+
* qb.joinRelation('posts', JOIN_KINDS.LEFT);
|
|
3770
|
+
* @example
|
|
3771
|
+
* qb.joinRelation('posts', JOIN_KINDS.INNER, eq(postTable.columns.published, true));
|
|
3682
3772
|
*/
|
|
3683
3773
|
joinRelation<K extends keyof TTable['relations'] & string>(relationName: K, joinKind?: JoinKind, extraCondition?: ExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3684
3774
|
/**
|
|
@@ -3686,6 +3776,15 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3686
3776
|
* @param relationName - Name of the relationship to include
|
|
3687
3777
|
* @param options - Optional include options
|
|
3688
3778
|
* @returns New query builder instance with the relationship inclusion
|
|
3779
|
+
* @example
|
|
3780
|
+
* qb.include('posts');
|
|
3781
|
+
* @example
|
|
3782
|
+
* qb.include('posts', { columns: ['id', 'title', 'published'] });
|
|
3783
|
+
* @example
|
|
3784
|
+
* qb.include('posts', {
|
|
3785
|
+
* columns: ['id', 'title'],
|
|
3786
|
+
* where: eq(postTable.columns.published, true)
|
|
3787
|
+
* });
|
|
3689
3788
|
*/
|
|
3690
3789
|
include<K extends keyof TTable['relations'] & string>(relationName: K, options?: TypedRelationIncludeOptions<TTable['relations'][K]>): SelectQueryBuilder<T, TTable>;
|
|
3691
3790
|
/**
|
|
@@ -3693,16 +3792,28 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3693
3792
|
* @param relationName - Name of the relation to include lazily
|
|
3694
3793
|
* @param options - Optional include options for lazy loading
|
|
3695
3794
|
* @returns New query builder instance with lazy relation inclusion
|
|
3795
|
+
* @example
|
|
3796
|
+
* const qb = new SelectQueryBuilder(userTable).includeLazy('posts');
|
|
3797
|
+
* const users = await qb.execute(session);
|
|
3798
|
+
* // Access posts later - they will be loaded on demand
|
|
3799
|
+
* const posts = await users[0].posts;
|
|
3696
3800
|
*/
|
|
3697
3801
|
includeLazy<K extends keyof RelationMap<TTable>>(relationName: K, options?: TypedRelationIncludeOptions<TTable['relations'][K]>): SelectQueryBuilder<T, TTable>;
|
|
3698
3802
|
/**
|
|
3699
3803
|
* Convenience alias for including only specific columns from a relation.
|
|
3804
|
+
* @example
|
|
3805
|
+
* qb.includePick('posts', ['id', 'title', 'createdAt']);
|
|
3700
3806
|
*/
|
|
3701
3807
|
includePick<K extends keyof TTable['relations'] & string, C extends RelationTargetColumns<TTable['relations'][K]>>(relationName: K, cols: C[]): SelectQueryBuilder<T, TTable>;
|
|
3702
3808
|
/**
|
|
3703
3809
|
* Selects columns for the root table and relations from an array of entries
|
|
3704
3810
|
* @param config - Configuration array for deep column selection
|
|
3705
3811
|
* @returns New query builder instance with deep column selections
|
|
3812
|
+
* @example
|
|
3813
|
+
* qb.selectColumnsDeep([
|
|
3814
|
+
* { type: 'root', columns: ['id', 'name'] },
|
|
3815
|
+
* { type: 'relation', relationName: 'posts', columns: ['id', 'title'] }
|
|
3816
|
+
* ]);
|
|
3706
3817
|
*/
|
|
3707
3818
|
selectColumnsDeep(config: DeepSelectConfig<TTable>): SelectQueryBuilder<T, TTable>;
|
|
3708
3819
|
/**
|
|
@@ -3721,11 +3832,49 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3721
3832
|
*/
|
|
3722
3833
|
getTable(): TTable;
|
|
3723
3834
|
/**
|
|
3724
|
-
*
|
|
3835
|
+
* Ensures that if no columns are selected, all columns from the table are selected by default.
|
|
3836
|
+
*/
|
|
3837
|
+
private ensureDefaultSelection;
|
|
3838
|
+
/**
|
|
3839
|
+
* Executes the query and returns hydrated results.
|
|
3840
|
+
* If the builder was created with an entity constructor (e.g. via selectFromEntity),
|
|
3841
|
+
* this will automatically return fully materialized entity instances.
|
|
3842
|
+
*
|
|
3725
3843
|
* @param ctx - ORM session context
|
|
3726
|
-
* @returns Promise of entity instances
|
|
3844
|
+
* @returns Promise of entity instances (or objects if generic T is not an entity)
|
|
3845
|
+
* @example
|
|
3846
|
+
* const users = await selectFromEntity(User).execute(session);
|
|
3847
|
+
* // users is User[]
|
|
3848
|
+
* users[0] instanceof User; // true
|
|
3849
|
+
*/
|
|
3850
|
+
execute(ctx: OrmSession): Promise<T[]>;
|
|
3851
|
+
/**
|
|
3852
|
+
* Executes the query and returns plain row objects (POJOs), ignoring any entity materialization.
|
|
3853
|
+
* Use this if you want raw data even when using selectFromEntity.
|
|
3854
|
+
*
|
|
3855
|
+
* @param ctx - ORM session context
|
|
3856
|
+
* @returns Promise of plain entity instances
|
|
3857
|
+
* @example
|
|
3858
|
+
* const rows = await selectFromEntity(User).executePlain(session);
|
|
3859
|
+
* // rows is EntityInstance<UserTable>[] (plain objects)
|
|
3860
|
+
* rows[0] instanceof User; // false
|
|
3727
3861
|
*/
|
|
3728
|
-
|
|
3862
|
+
executePlain(ctx: OrmSession): Promise<EntityInstance<TTable>[]>;
|
|
3863
|
+
/**
|
|
3864
|
+
* Executes the query and returns results as real class instances.
|
|
3865
|
+
* Unlike execute(), this returns actual instances of the decorated entity class
|
|
3866
|
+
* with working methods and proper instanceof checks.
|
|
3867
|
+
* @param entityClass - The entity class constructor
|
|
3868
|
+
* @param ctx - ORM session context
|
|
3869
|
+
* @returns Promise of entity class instances
|
|
3870
|
+
* @example
|
|
3871
|
+
* const users = await selectFromEntity(User)
|
|
3872
|
+
* .include('posts')
|
|
3873
|
+
* .executeAs(User, session);
|
|
3874
|
+
* users[0] instanceof User; // true!
|
|
3875
|
+
* users[0].getFullName(); // works!
|
|
3876
|
+
*/
|
|
3877
|
+
executeAs<TEntity extends object>(entityClass: EntityConstructor<TEntity>, ctx: OrmSession): Promise<TEntity[]>;
|
|
3729
3878
|
/**
|
|
3730
3879
|
* Executes a count query for the current builder without LIMIT/OFFSET clauses.
|
|
3731
3880
|
*
|
|
@@ -3743,7 +3892,7 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3743
3892
|
page: number;
|
|
3744
3893
|
pageSize: number;
|
|
3745
3894
|
}): Promise<{
|
|
3746
|
-
items:
|
|
3895
|
+
items: T[];
|
|
3747
3896
|
totalItems: number;
|
|
3748
3897
|
}>;
|
|
3749
3898
|
/**
|
|
@@ -3751,24 +3900,42 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3751
3900
|
* @param execCtx - Execution context
|
|
3752
3901
|
* @param hydCtx - Hydration context
|
|
3753
3902
|
* @returns Promise of entity instances
|
|
3903
|
+
* @example
|
|
3904
|
+
* const execCtx = new ExecutionContext(session);
|
|
3905
|
+
* const hydCtx = new HydrationContext();
|
|
3906
|
+
* const users = await qb.executeWithContexts(execCtx, hydCtx);
|
|
3754
3907
|
*/
|
|
3755
|
-
executeWithContexts(execCtx: ExecutionContext, hydCtx: HydrationContext): Promise<
|
|
3908
|
+
executeWithContexts(execCtx: ExecutionContext, hydCtx: HydrationContext): Promise<T[]>;
|
|
3756
3909
|
/**
|
|
3757
3910
|
* Adds a WHERE condition to the query
|
|
3758
3911
|
* @param expr - Expression for the WHERE clause
|
|
3759
3912
|
* @returns New query builder instance with the WHERE condition
|
|
3913
|
+
* @example
|
|
3914
|
+
* qb.where(eq(userTable.columns.id, 1));
|
|
3915
|
+
* @example
|
|
3916
|
+
* qb.where(and(
|
|
3917
|
+
* eq(userTable.columns.active, true),
|
|
3918
|
+
* gt(userTable.columns.createdAt, subDays(now(), 30))
|
|
3919
|
+
* ));
|
|
3760
3920
|
*/
|
|
3761
3921
|
where(expr: ExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3762
3922
|
/**
|
|
3763
3923
|
* Adds a GROUP BY clause to the query
|
|
3764
3924
|
* @param term - Column definition or ordering term to group by
|
|
3765
3925
|
* @returns New query builder instance with the GROUP BY clause
|
|
3926
|
+
* @example
|
|
3927
|
+
* qb.select('departmentId', count(userTable.columns.id))
|
|
3928
|
+
* .groupBy(userTable.columns.departmentId);
|
|
3766
3929
|
*/
|
|
3767
3930
|
groupBy(term: ColumnDef | OrderingTerm): SelectQueryBuilder<T, TTable>;
|
|
3768
3931
|
/**
|
|
3769
3932
|
* Adds a HAVING condition to the query
|
|
3770
3933
|
* @param expr - Expression for the HAVING clause
|
|
3771
3934
|
* @returns New query builder instance with the HAVING condition
|
|
3935
|
+
* @example
|
|
3936
|
+
* qb.select('departmentId', count(userTable.columns.id))
|
|
3937
|
+
* .groupBy(userTable.columns.departmentId)
|
|
3938
|
+
* .having(gt(count(userTable.columns.id), 5));
|
|
3772
3939
|
*/
|
|
3773
3940
|
having(expr: ExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3774
3941
|
/**
|
|
@@ -3789,54 +3956,95 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3789
3956
|
* Adds a DISTINCT clause to the query
|
|
3790
3957
|
* @param cols - Columns to make distinct
|
|
3791
3958
|
* @returns New query builder instance with the DISTINCT clause
|
|
3959
|
+
* @example
|
|
3960
|
+
* qb.distinct(userTable.columns.email);
|
|
3961
|
+
* @example
|
|
3962
|
+
* qb.distinct(userTable.columns.firstName, userTable.columns.lastName);
|
|
3792
3963
|
*/
|
|
3793
3964
|
distinct(...cols: (ColumnDef | ColumnNode)[]): SelectQueryBuilder<T, TTable>;
|
|
3794
3965
|
/**
|
|
3795
3966
|
* Adds a LIMIT clause to the query
|
|
3796
3967
|
* @param n - Maximum number of rows to return
|
|
3797
3968
|
* @returns New query builder instance with the LIMIT clause
|
|
3969
|
+
* @example
|
|
3970
|
+
* qb.limit(10);
|
|
3971
|
+
* @example
|
|
3972
|
+
* qb.limit(20).offset(40); // Pagination: page 3 with 20 items per page
|
|
3798
3973
|
*/
|
|
3799
3974
|
limit(n: number): SelectQueryBuilder<T, TTable>;
|
|
3800
3975
|
/**
|
|
3801
3976
|
* Adds an OFFSET clause to the query
|
|
3802
3977
|
* @param n - Number of rows to skip
|
|
3803
3978
|
* @returns New query builder instance with the OFFSET clause
|
|
3979
|
+
* @example
|
|
3980
|
+
* qb.offset(10);
|
|
3981
|
+
* @example
|
|
3982
|
+
* qb.limit(20).offset(40); // Pagination: page 3 with 20 items per page
|
|
3804
3983
|
*/
|
|
3805
3984
|
offset(n: number): SelectQueryBuilder<T, TTable>;
|
|
3806
3985
|
/**
|
|
3807
3986
|
* Combines this query with another using UNION
|
|
3808
3987
|
* @param query - Query to union with
|
|
3809
3988
|
* @returns New query builder instance with the set operation
|
|
3989
|
+
* @example
|
|
3990
|
+
* const activeUsers = new SelectQueryBuilder(userTable)
|
|
3991
|
+
* .where(eq(userTable.columns.active, true));
|
|
3992
|
+
* const inactiveUsers = new SelectQueryBuilder(userTable)
|
|
3993
|
+
* .where(eq(userTable.columns.active, false));
|
|
3994
|
+
* qb.union(activeUsers).union(inactiveUsers);
|
|
3810
3995
|
*/
|
|
3811
3996
|
union<TSub extends TableDef>(query: SelectQueryBuilder<unknown, TSub> | SelectQueryNode): SelectQueryBuilder<T, TTable>;
|
|
3812
3997
|
/**
|
|
3813
3998
|
* Combines this query with another using UNION ALL
|
|
3814
3999
|
* @param query - Query to union with
|
|
3815
4000
|
* @returns New query builder instance with the set operation
|
|
4001
|
+
* @example
|
|
4002
|
+
* const q1 = new SelectQueryBuilder(userTable).where(gt(userTable.columns.score, 80));
|
|
4003
|
+
* const q2 = new SelectQueryBuilder(userTable).where(lt(userTable.columns.score, 20));
|
|
4004
|
+
* qb.unionAll(q1).unionAll(q2);
|
|
3816
4005
|
*/
|
|
3817
4006
|
unionAll<TSub extends TableDef>(query: SelectQueryBuilder<unknown, TSub> | SelectQueryNode): SelectQueryBuilder<T, TTable>;
|
|
3818
4007
|
/**
|
|
3819
4008
|
* Combines this query with another using INTERSECT
|
|
3820
4009
|
* @param query - Query to intersect with
|
|
3821
4010
|
* @returns New query builder instance with the set operation
|
|
4011
|
+
* @example
|
|
4012
|
+
* const activeUsers = new SelectQueryBuilder(userTable)
|
|
4013
|
+
* .where(eq(userTable.columns.active, true));
|
|
4014
|
+
* const premiumUsers = new SelectQueryBuilder(userTable)
|
|
4015
|
+
* .where(eq(userTable.columns.premium, true));
|
|
4016
|
+
* qb.intersect(activeUsers).intersect(premiumUsers);
|
|
3822
4017
|
*/
|
|
3823
4018
|
intersect<TSub extends TableDef>(query: SelectQueryBuilder<unknown, TSub> | SelectQueryNode): SelectQueryBuilder<T, TTable>;
|
|
3824
4019
|
/**
|
|
3825
4020
|
* Combines this query with another using EXCEPT
|
|
3826
4021
|
* @param query - Query to subtract
|
|
3827
4022
|
* @returns New query builder instance with the set operation
|
|
4023
|
+
* @example
|
|
4024
|
+
* const allUsers = new SelectQueryBuilder(userTable);
|
|
4025
|
+
* const inactiveUsers = new SelectQueryBuilder(userTable)
|
|
4026
|
+
* .where(eq(userTable.columns.active, false));
|
|
4027
|
+
* qb.except(allUsers).except(inactiveUsers); // Only active users
|
|
3828
4028
|
*/
|
|
3829
4029
|
except<TSub extends TableDef>(query: SelectQueryBuilder<unknown, TSub> | SelectQueryNode): SelectQueryBuilder<T, TTable>;
|
|
3830
4030
|
/**
|
|
3831
4031
|
* Adds a WHERE EXISTS condition to the query
|
|
3832
4032
|
* @param subquery - Subquery to check for existence
|
|
3833
4033
|
* @returns New query builder instance with the WHERE EXISTS condition
|
|
4034
|
+
* @example
|
|
4035
|
+
* const postsQuery = new SelectQueryBuilder(postTable)
|
|
4036
|
+
* .where(eq(postTable.columns.userId, col('u.id')));
|
|
4037
|
+
* qb.whereExists(postsQuery);
|
|
3834
4038
|
*/
|
|
3835
4039
|
whereExists<TSub extends TableDef>(subquery: SelectQueryBuilder<unknown, TSub> | SelectQueryNode, correlate?: ExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3836
4040
|
/**
|
|
3837
4041
|
* Adds a WHERE NOT EXISTS condition to the query
|
|
3838
4042
|
* @param subquery - Subquery to check for non-existence
|
|
3839
4043
|
* @returns New query builder instance with the WHERE NOT EXISTS condition
|
|
4044
|
+
* @example
|
|
4045
|
+
* const postsQuery = new SelectQueryBuilder(postTable)
|
|
4046
|
+
* .where(eq(postTable.columns.userId, col('u.id')));
|
|
4047
|
+
* qb.whereNotExists(postsQuery); // Users without posts
|
|
3840
4048
|
*/
|
|
3841
4049
|
whereNotExists<TSub extends TableDef>(subquery: SelectQueryBuilder<unknown, TSub> | SelectQueryNode, correlate?: ExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3842
4050
|
/**
|
|
@@ -3863,22 +4071,39 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3863
4071
|
* Compiles the query to SQL for a specific dialect
|
|
3864
4072
|
* @param dialect - Database dialect to compile for
|
|
3865
4073
|
* @returns Compiled query with SQL and parameters
|
|
4074
|
+
* @example
|
|
4075
|
+
* const compiled = qb.select('id', 'name')
|
|
4076
|
+
* .where(eq(userTable.columns.active, true))
|
|
4077
|
+
* .compile('postgres');
|
|
4078
|
+
* console.log(compiled.sql); // SELECT "id", "name" FROM "users" WHERE "active" = true
|
|
3866
4079
|
*/
|
|
3867
4080
|
compile(dialect: SelectDialectInput): CompiledQuery;
|
|
3868
4081
|
/**
|
|
3869
4082
|
* Converts the query to SQL string for a specific dialect
|
|
3870
4083
|
* @param dialect - Database dialect to generate SQL for
|
|
3871
4084
|
* @returns SQL string representation of the query
|
|
4085
|
+
* @example
|
|
4086
|
+
* const sql = qb.select('id', 'name')
|
|
4087
|
+
* .where(eq(userTable.columns.active, true))
|
|
4088
|
+
* .toSql('postgres');
|
|
4089
|
+
* console.log(sql); // SELECT "id", "name" FROM "users" WHERE "active" = true
|
|
3872
4090
|
*/
|
|
3873
4091
|
toSql(dialect: SelectDialectInput): string;
|
|
3874
4092
|
/**
|
|
3875
4093
|
* Gets the hydration plan for the query
|
|
3876
4094
|
* @returns Hydration plan or undefined if none exists
|
|
4095
|
+
* @example
|
|
4096
|
+
* const plan = qb.include('posts').getHydrationPlan();
|
|
4097
|
+
* console.log(plan?.relations); // Information about included relations
|
|
3877
4098
|
*/
|
|
3878
4099
|
getHydrationPlan(): HydrationPlan | undefined;
|
|
3879
4100
|
/**
|
|
3880
4101
|
* Gets the Abstract Syntax Tree (AST) representation of the query
|
|
3881
4102
|
* @returns Query AST with hydration applied
|
|
4103
|
+
* @example
|
|
4104
|
+
* const ast = qb.select('id', 'name').getAST();
|
|
4105
|
+
* console.log(ast.columns); // Array of column nodes
|
|
4106
|
+
* console.log(ast.from); // From clause information
|
|
3882
4107
|
*/
|
|
3883
4108
|
getAST(): SelectQueryNode;
|
|
3884
4109
|
}
|
|
@@ -4277,6 +4502,68 @@ declare class DeleteQueryBuilder<T> {
|
|
|
4277
4502
|
getAST(): DeleteQueryNode;
|
|
4278
4503
|
}
|
|
4279
4504
|
|
|
4505
|
+
/**
|
|
4506
|
+
* Represents a target for query operations, which can be either a table definition
|
|
4507
|
+
* or an entity constructor. This type allows flexible targeting of database tables
|
|
4508
|
+
* through either direct table definitions or entity classes decorated with ORM metadata.
|
|
4509
|
+
*
|
|
4510
|
+
* @template TTable - The table definition type, defaults to TableDef
|
|
4511
|
+
*/
|
|
4512
|
+
type QueryTarget<TTable extends TableDef = TableDef> = TTable | EntityConstructor;
|
|
4513
|
+
|
|
4514
|
+
/**
|
|
4515
|
+
* Creates a SELECT query builder for the specified table or entity.
|
|
4516
|
+
*
|
|
4517
|
+
* @template TTable - The table definition type
|
|
4518
|
+
* @param target - The table definition or entity constructor to query from
|
|
4519
|
+
* @returns A new SelectQueryBuilder instance for building SELECT queries
|
|
4520
|
+
*
|
|
4521
|
+
* @example
|
|
4522
|
+
* ```typescript
|
|
4523
|
+
* const query = selectFrom(UserTable).select('id', 'name');
|
|
4524
|
+
* ```
|
|
4525
|
+
*/
|
|
4526
|
+
declare const selectFrom: <TTable extends TableDef>(target: QueryTarget<TTable>) => SelectQueryBuilder<unknown, TTable>;
|
|
4527
|
+
/**
|
|
4528
|
+
* Creates an INSERT query builder for the specified table or entity.
|
|
4529
|
+
*
|
|
4530
|
+
* @template TTable - The table definition type
|
|
4531
|
+
* @param target - The table definition or entity constructor to insert into
|
|
4532
|
+
* @returns A new InsertQueryBuilder instance for building INSERT queries
|
|
4533
|
+
*
|
|
4534
|
+
* @example
|
|
4535
|
+
* ```typescript
|
|
4536
|
+
* const query = insertInto(UserTable).values({ name: 'John', email: 'john@example.com' });
|
|
4537
|
+
* ```
|
|
4538
|
+
*/
|
|
4539
|
+
declare const insertInto: <TTable extends TableDef>(target: QueryTarget<TTable>) => InsertQueryBuilder<unknown>;
|
|
4540
|
+
/**
|
|
4541
|
+
* Creates an UPDATE query builder for the specified table or entity.
|
|
4542
|
+
*
|
|
4543
|
+
* @template TTable - The table definition type
|
|
4544
|
+
* @param target - The table definition or entity constructor to update
|
|
4545
|
+
* @returns A new UpdateQueryBuilder instance for building UPDATE queries
|
|
4546
|
+
*
|
|
4547
|
+
* @example
|
|
4548
|
+
* ```typescript
|
|
4549
|
+
* const query = update(UserTable).set({ name: 'Jane' }).where(eq(UserTable.id, 1));
|
|
4550
|
+
* ```
|
|
4551
|
+
*/
|
|
4552
|
+
declare const update: <TTable extends TableDef>(target: QueryTarget<TTable>) => UpdateQueryBuilder<unknown>;
|
|
4553
|
+
/**
|
|
4554
|
+
* Creates a DELETE query builder for the specified table or entity.
|
|
4555
|
+
*
|
|
4556
|
+
* @template TTable - The table definition type
|
|
4557
|
+
* @param target - The table definition or entity constructor to delete from
|
|
4558
|
+
* @returns A new DeleteQueryBuilder instance for building DELETE queries
|
|
4559
|
+
*
|
|
4560
|
+
* @example
|
|
4561
|
+
* ```typescript
|
|
4562
|
+
* const query = deleteFrom(UserTable).where(eq(UserTable.id, 1));
|
|
4563
|
+
* ```
|
|
4564
|
+
*/
|
|
4565
|
+
declare const deleteFrom: <TTable extends TableDef>(target: QueryTarget<TTable>) => DeleteQueryBuilder<unknown>;
|
|
4566
|
+
|
|
4280
4567
|
/**
|
|
4281
4568
|
* Strategy interface for compiling pagination clauses.
|
|
4282
4569
|
* Allows dialects to customize how pagination (LIMIT/OFFSET, ROWS FETCH, etc.) is generated.
|
|
@@ -5966,7 +6253,7 @@ type EntityTable<TEntity extends object> = Omit<TableDef<{
|
|
|
5966
6253
|
[K in RelationKeys<TEntity>]: NonNullable<TEntity[K]> extends HasManyCollection<infer TChild> ? HasManyRelation<EntityTable<NonNullable<TChild> & object>> : NonNullable<TEntity[K]> extends ManyToManyCollection<infer TTarget, infer TPivot> ? BelongsToManyRelation<EntityTable<NonNullable<TTarget> & object>, TPivot extends object ? EntityTable<NonNullable<TPivot> & object> : TableDef> : NonNullable<TEntity[K]> extends HasOneReference<infer TChild> ? HasOneRelation<EntityTable<NonNullable<TChild> & object>> : NonNullable<TEntity[K]> extends BelongsToReference<infer TParent> ? BelongsToRelation<EntityTable<NonNullable<TParent> & object>> : NonNullable<TEntity[K]> extends object ? BelongsToRelation<EntityTable<NonNullable<TEntity[K]> & object>> : never;
|
|
5967
6254
|
};
|
|
5968
6255
|
};
|
|
5969
|
-
declare const selectFromEntity: <TEntity extends object>(ctor: EntityConstructor<TEntity>) => SelectQueryBuilder<
|
|
6256
|
+
declare const selectFromEntity: <TEntity extends object>(ctor: EntityConstructor<TEntity>) => SelectQueryBuilder<TEntity, EntityTable<TEntity>>;
|
|
5970
6257
|
/**
|
|
5971
6258
|
* Public API: opt-in ergonomic entity reference (decorator-level).
|
|
5972
6259
|
*
|
|
@@ -5995,6 +6282,85 @@ interface DecoratorMetadataBag {
|
|
|
5995
6282
|
*/
|
|
5996
6283
|
declare const getDecoratorMetadata: (ctor: object) => DecoratorMetadataBag | undefined;
|
|
5997
6284
|
|
|
6285
|
+
/**
|
|
6286
|
+
* Strategy interface for materializing entity instances (Open/Closed Principle).
|
|
6287
|
+
*/
|
|
6288
|
+
interface EntityMaterializationStrategy {
|
|
6289
|
+
/**
|
|
6290
|
+
* Creates an instance of the entity class and populates it with data.
|
|
6291
|
+
* @param ctor - The entity constructor
|
|
6292
|
+
* @param data - The raw data to populate
|
|
6293
|
+
* @returns The materialized entity instance
|
|
6294
|
+
*/
|
|
6295
|
+
materialize<T>(ctor: EntityConstructor<T>, data: Record<string, unknown>): T;
|
|
6296
|
+
}
|
|
6297
|
+
/**
|
|
6298
|
+
* Default strategy: Uses Object.create() to create instance without calling constructor.
|
|
6299
|
+
* Safe for classes with required constructor parameters.
|
|
6300
|
+
*/
|
|
6301
|
+
declare class PrototypeMaterializationStrategy implements EntityMaterializationStrategy {
|
|
6302
|
+
materialize<T>(ctor: EntityConstructor<T>, data: Record<string, unknown>): T;
|
|
6303
|
+
}
|
|
6304
|
+
/**
|
|
6305
|
+
* Alternative strategy: Calls default constructor then assigns properties.
|
|
6306
|
+
* Use when class constructor initializes important state.
|
|
6307
|
+
*/
|
|
6308
|
+
declare class ConstructorMaterializationStrategy implements EntityMaterializationStrategy {
|
|
6309
|
+
materialize<T>(ctor: EntityConstructor<T>, data: Record<string, unknown>): T;
|
|
6310
|
+
}
|
|
6311
|
+
/**
|
|
6312
|
+
* Interface for materializing query results into real entity class instances.
|
|
6313
|
+
*/
|
|
6314
|
+
interface EntityMaterializer {
|
|
6315
|
+
/**
|
|
6316
|
+
* Materializes a single row into a real entity instance.
|
|
6317
|
+
* @param entityClass - The entity constructor
|
|
6318
|
+
* @param row - The raw data row
|
|
6319
|
+
* @returns The materialized entity instance
|
|
6320
|
+
*/
|
|
6321
|
+
materialize<T>(entityClass: EntityConstructor<T>, row: Record<string, unknown>): T;
|
|
6322
|
+
/**
|
|
6323
|
+
* Materializes multiple rows into real entity instances.
|
|
6324
|
+
* @param entityClass - The entity constructor
|
|
6325
|
+
* @param rows - The raw data rows
|
|
6326
|
+
* @returns Array of materialized entity instances
|
|
6327
|
+
*/
|
|
6328
|
+
materializeMany<T>(entityClass: EntityConstructor<T>, rows: Record<string, unknown>[]): T[];
|
|
6329
|
+
}
|
|
6330
|
+
/**
|
|
6331
|
+
* Default implementation of EntityMaterializer.
|
|
6332
|
+
* Converts query results into actual class instances with working methods.
|
|
6333
|
+
*
|
|
6334
|
+
* @example
|
|
6335
|
+
* const materializer = new DefaultEntityMaterializer();
|
|
6336
|
+
* const users = materializer.materializeMany(User, queryResults);
|
|
6337
|
+
* users[0] instanceof User; // true
|
|
6338
|
+
* users[0].getFullName(); // works!
|
|
6339
|
+
*/
|
|
6340
|
+
declare class DefaultEntityMaterializer implements EntityMaterializer {
|
|
6341
|
+
private readonly strategy;
|
|
6342
|
+
constructor(strategy?: EntityMaterializationStrategy);
|
|
6343
|
+
materialize<T>(ctor: EntityConstructor<T>, row: Record<string, unknown>): T;
|
|
6344
|
+
materializeMany<T>(ctor: EntityConstructor<T>, rows: Record<string, unknown>[]): T[];
|
|
6345
|
+
/**
|
|
6346
|
+
* Recursively materializes nested relation data.
|
|
6347
|
+
*/
|
|
6348
|
+
private materializeRelations;
|
|
6349
|
+
/**
|
|
6350
|
+
* Simple heuristic to check if an object looks like an entity.
|
|
6351
|
+
*/
|
|
6352
|
+
private isEntityLike;
|
|
6353
|
+
}
|
|
6354
|
+
/**
|
|
6355
|
+
* Convenience function to materialize query results as real class instances.
|
|
6356
|
+
*
|
|
6357
|
+
* @example
|
|
6358
|
+
* const results = await selectFromEntity(User).execute(session);
|
|
6359
|
+
* const users = materializeAs(User, results);
|
|
6360
|
+
* users[0] instanceof User; // true!
|
|
6361
|
+
*/
|
|
6362
|
+
declare const materializeAs: <TEntity extends object>(ctor: EntityConstructor<TEntity>, results: Record<string, unknown>[]) => TEntity[];
|
|
6363
|
+
|
|
5998
6364
|
type PoolOptions = {
|
|
5999
6365
|
/** Maximum number of live resources (idle + leased). */
|
|
6000
6366
|
max: number;
|
|
@@ -6158,4 +6524,4 @@ type PooledExecutorFactoryOptions<TConn> = {
|
|
|
6158
6524
|
*/
|
|
6159
6525
|
declare function createPooledExecutorFactory<TConn>(opts: PooledExecutorFactoryOptions<TConn>): DbExecutorFactory;
|
|
6160
6526
|
|
|
6161
|
-
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, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityOptions, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type 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, 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, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, age, aliasRef, and, arrayAppend, 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, denseRank, diffSchema, div, endOfMonth, entityRef, eq, esel, executeHydrated, 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, 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, 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, selectFromEntity, setRelations, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, upper, utcNow, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, windowFunction, year };
|
|
6527
|
+
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, 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, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, age, aliasRef, and, arrayAppend, 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, 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 };
|