hysteria-orm 10.0.6 → 10.0.7
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/lib/cli.cjs +19 -19
- package/lib/cli.cjs.map +1 -1
- package/lib/cli.js +19 -19
- package/lib/cli.js.map +1 -1
- package/lib/index.cjs +17 -17
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +129 -13
- package/lib/index.d.ts +129 -13
- package/lib/index.js +17 -17
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.cts
CHANGED
|
@@ -1392,6 +1392,63 @@ declare class InterpreterUtils {
|
|
|
1392
1392
|
getFromForWriteOperations(dbType: SqlDataSourceType, fromNode: FromNode): string;
|
|
1393
1393
|
}
|
|
1394
1394
|
|
|
1395
|
+
type DeleteOptions = {
|
|
1396
|
+
ignoreBeforeDeleteHook?: boolean;
|
|
1397
|
+
};
|
|
1398
|
+
type SoftDeleteOptions<T> = {
|
|
1399
|
+
column?: MongoCollectionKey<T>;
|
|
1400
|
+
value?: string | number | boolean;
|
|
1401
|
+
ignoreBeforeUpdateHook?: boolean;
|
|
1402
|
+
};
|
|
1403
|
+
|
|
1404
|
+
/**
|
|
1405
|
+
* Allows to get queries without executing them
|
|
1406
|
+
*/
|
|
1407
|
+
declare class DryQueryBuilder extends QueryBuilder {
|
|
1408
|
+
constructor(model: typeof Model, sqlDataSource: SqlDataSource);
|
|
1409
|
+
many(): this;
|
|
1410
|
+
/**
|
|
1411
|
+
* @description Builds the insert query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
1412
|
+
* @param args The arguments to pass to the insert method
|
|
1413
|
+
* @returns The query builder
|
|
1414
|
+
*/
|
|
1415
|
+
insert(...args: Parameters<typeof QueryBuilder.prototype.insert>): this;
|
|
1416
|
+
/**
|
|
1417
|
+
* @description Builds the insert many query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
1418
|
+
* @param args The arguments to pass to the insert many method
|
|
1419
|
+
* @returns The query builder
|
|
1420
|
+
*/
|
|
1421
|
+
insertMany(...args: Parameters<typeof QueryBuilder.prototype.insertMany>): this;
|
|
1422
|
+
/**
|
|
1423
|
+
* @description Builds the upsert query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
1424
|
+
* @param args The arguments to pass to the upsert method
|
|
1425
|
+
* @returns The query builder
|
|
1426
|
+
*/
|
|
1427
|
+
upsert(...args: Parameters<typeof QueryBuilder.prototype.upsert>): this;
|
|
1428
|
+
/**
|
|
1429
|
+
* @description Builds the update query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
1430
|
+
* @param data The data to update
|
|
1431
|
+
* @returns The query builder
|
|
1432
|
+
*/
|
|
1433
|
+
update(data: Record<string, any>): this;
|
|
1434
|
+
/**
|
|
1435
|
+
* @description Builds the delete query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
1436
|
+
* @returns The query builder
|
|
1437
|
+
*/
|
|
1438
|
+
delete(): this;
|
|
1439
|
+
/**
|
|
1440
|
+
* @description Builds the truncate query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
1441
|
+
* @returns The query builder
|
|
1442
|
+
*/
|
|
1443
|
+
truncate(): this;
|
|
1444
|
+
/**
|
|
1445
|
+
* @description Builds the soft delete query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
1446
|
+
* @param options Soft delete options
|
|
1447
|
+
* @returns The query builder
|
|
1448
|
+
*/
|
|
1449
|
+
softDelete(options?: Omit<SoftDeleteOptions<any>, "ignoreBeforeDeleteHook">): this;
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1395
1452
|
type BaseValues$1 = string | number | boolean | null;
|
|
1396
1453
|
type BinaryOperatorType$1 = "=" | "!=" | "<>" | ">" | "<" | ">=" | "<=" | "like" | "ilike" | "in";
|
|
1397
1454
|
declare class HavingNode extends QueryNode {
|
|
@@ -2405,6 +2462,8 @@ type UpsertOptionsRawBuilder = {
|
|
|
2405
2462
|
updateOnConflict?: boolean;
|
|
2406
2463
|
returning?: string[];
|
|
2407
2464
|
};
|
|
2465
|
+
type DryQueryBuilderWithoutReadOperations = Omit<DryQueryBuilder, "many" | "one" | "oneOrFail" | "first" | "firstOrFail" | "paginate" | "paginateWithCursor" | "exists" | "pluck" | "upsert" | "upsertMany" | "increment" | "decrement" | "getSum" | "getAvg" | "getMin" | "getMax" | "getCount" | "stream" | "chunk" | "paginate" | "paginateWithCursor" | "exists">;
|
|
2466
|
+
type DryModelQueryBuilderWithoutReadOperations<T extends Model, A extends Record<string, any> = {}, R extends Record<string, any> = {}> = Omit<DryModelQueryBuilder<T, A, R>, "many" | "one" | "oneOrFail" | "first" | "firstOrFail" | "paginate" | "paginateWithCursor" | "exists" | "pluck" | "upsert" | "upsertMany" | "increment" | "decrement" | "getSum" | "getAvg" | "getMin" | "getMax" | "getCount" | "stream" | "chunk" | "paginate" | "paginateWithCursor" | "exists">;
|
|
2408
2467
|
|
|
2409
2468
|
declare class SqlModelManagerUtils<T extends Model> {
|
|
2410
2469
|
protected dbType: SqlDataSourceType;
|
|
@@ -2440,15 +2499,6 @@ type CursorPaginatedData<T extends Model, A extends object = {}, R extends objec
|
|
|
2440
2499
|
data: AnnotatedModel<T, A, R>[];
|
|
2441
2500
|
};
|
|
2442
2501
|
|
|
2443
|
-
type DeleteOptions = {
|
|
2444
|
-
ignoreBeforeDeleteHook?: boolean;
|
|
2445
|
-
};
|
|
2446
|
-
type SoftDeleteOptions<T> = {
|
|
2447
|
-
column?: MongoCollectionKey<T>;
|
|
2448
|
-
value?: string | number | boolean;
|
|
2449
|
-
ignoreBeforeDeleteHook?: boolean;
|
|
2450
|
-
};
|
|
2451
|
-
|
|
2452
2502
|
type UpdateOptions = {
|
|
2453
2503
|
ignoreBeforeUpdateHook?: boolean;
|
|
2454
2504
|
};
|
|
@@ -2826,6 +2876,50 @@ declare class ModelQueryBuilder<T extends Model, A extends Record<string, any> =
|
|
|
2826
2876
|
private truncateWithPerformance;
|
|
2827
2877
|
}
|
|
2828
2878
|
|
|
2879
|
+
/**
|
|
2880
|
+
* Allows to get model queries without executing them
|
|
2881
|
+
*/
|
|
2882
|
+
declare class DryModelQueryBuilder<T extends Model, A extends Record<string, any> = {}, R extends Record<string, any> = {}> extends ModelQueryBuilder<T, A, R> {
|
|
2883
|
+
constructor(model: typeof Model, sqlDataSource: SqlDataSource);
|
|
2884
|
+
many(): this;
|
|
2885
|
+
/**
|
|
2886
|
+
* @description Builds the insert query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
2887
|
+
* @param args The arguments to pass to the insert method
|
|
2888
|
+
* @returns The query builder
|
|
2889
|
+
*/
|
|
2890
|
+
insert(...args: Parameters<typeof this$1.model.insert<T>>): this;
|
|
2891
|
+
/**
|
|
2892
|
+
* @description Builds the insert many query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
2893
|
+
* @param args The arguments to pass to the insert many method
|
|
2894
|
+
* @returns The query builder
|
|
2895
|
+
*/
|
|
2896
|
+
insertMany(...args: Parameters<typeof this$1.model.insertMany<T>>): this;
|
|
2897
|
+
/**
|
|
2898
|
+
* @description Builds the update query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
2899
|
+
* @param data The data to update
|
|
2900
|
+
* @param options Update options
|
|
2901
|
+
* @returns The query builder
|
|
2902
|
+
*/
|
|
2903
|
+
update(...args: Parameters<ReturnType<typeof this$1.model.query<T>>["update"]>): this;
|
|
2904
|
+
/**
|
|
2905
|
+
* @description Builds the delete query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
2906
|
+
* @param options Delete options
|
|
2907
|
+
* @returns The query builder
|
|
2908
|
+
*/
|
|
2909
|
+
delete(...args: Parameters<ReturnType<typeof this$1.model.query<T>>["delete"]>): this;
|
|
2910
|
+
/**
|
|
2911
|
+
* @description Builds the truncate query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
2912
|
+
* @returns The query builder
|
|
2913
|
+
*/
|
|
2914
|
+
truncate(): this;
|
|
2915
|
+
/**
|
|
2916
|
+
* @description Builds the soft delete query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
2917
|
+
* @param options Soft delete options
|
|
2918
|
+
* @returns The query builder
|
|
2919
|
+
*/
|
|
2920
|
+
softDelete(...args: Parameters<ReturnType<typeof this$1.model.query<T>>["softDelete"]>): this;
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2829
2923
|
declare class ModelManager<T extends Model> {
|
|
2830
2924
|
protected sqlDataSource: SqlDataSource;
|
|
2831
2925
|
protected sqlType: SqlDataSourceType;
|
|
@@ -2885,6 +2979,11 @@ declare class ModelManager<T extends Model> {
|
|
|
2885
2979
|
* @description Returns a query builder instance
|
|
2886
2980
|
*/
|
|
2887
2981
|
query(): Omit<ModelQueryBuilder<T>, "insert" | "insertMany">;
|
|
2982
|
+
/**
|
|
2983
|
+
* @description Returns a dry query builder instance
|
|
2984
|
+
* @description The dry query builder instance will not execute the query, it will return the query statement
|
|
2985
|
+
*/
|
|
2986
|
+
dryQuery(): Omit<DryModelQueryBuilder<T>, "insert" | "insertMany">;
|
|
2888
2987
|
/**
|
|
2889
2988
|
* @description Mysql does not return the inserted model, so we need to get the inserted model from the database
|
|
2890
2989
|
*/
|
|
@@ -3008,6 +3107,12 @@ declare class SqlDataSource extends DataSource {
|
|
|
3008
3107
|
* @param table The table name to query from, must be in valid sql format `table` or `table as alias`
|
|
3009
3108
|
*/
|
|
3010
3109
|
static query<S extends string>(table: TableFormat<S>, options?: RawModelOptions): QueryBuilder;
|
|
3110
|
+
/**
|
|
3111
|
+
* @description Returns a dry query builder instance
|
|
3112
|
+
* @description The dry query builder instance will not execute the query, it will return the query statement
|
|
3113
|
+
* @returns The dry query builder instance
|
|
3114
|
+
*/
|
|
3115
|
+
static dryQuery<S extends string>(table: TableFormat<S>, options?: RawModelOptions): DryQueryBuilderWithoutReadOperations;
|
|
3011
3116
|
/**
|
|
3012
3117
|
* @description Creates a table on the database, return the query to be executed to create the table
|
|
3013
3118
|
*/
|
|
@@ -3102,6 +3207,12 @@ declare class SqlDataSource extends DataSource {
|
|
|
3102
3207
|
* @param table The table name to query from, must be in valid sql format `table` or `table as alias`
|
|
3103
3208
|
*/
|
|
3104
3209
|
query<S extends string>(table: TableFormat<S>, options?: RawModelOptions): QueryBuilder;
|
|
3210
|
+
/**
|
|
3211
|
+
* @description Returns a DryQueryBuilder instance
|
|
3212
|
+
* @description The dry query builder instance will not execute the query, it will return the query statement
|
|
3213
|
+
* @returns The dry query builder instance
|
|
3214
|
+
*/
|
|
3215
|
+
dryQuery<S extends string>(table: TableFormat<S>, options?: RawModelOptions): DryQueryBuilderWithoutReadOperations;
|
|
3105
3216
|
/**
|
|
3106
3217
|
* @description Return the query to alter the given table schema
|
|
3107
3218
|
*/
|
|
@@ -3483,7 +3594,7 @@ declare class QueryBuilder<T extends Model = any> extends JsonQueryBuilder<T> {
|
|
|
3483
3594
|
* @postgres needs the pg-query-stream package in order to work
|
|
3484
3595
|
* @throws If using postgres and the `pg-query-stream` package is not installed
|
|
3485
3596
|
*/
|
|
3486
|
-
stream<M extends Model = T>(options?: StreamOptions
|
|
3597
|
+
stream<M extends Model = T>(options?: StreamOptions): Promise<PassThrough & AsyncGenerator<AnnotatedModel<M, {}, {}>>>;
|
|
3487
3598
|
/**
|
|
3488
3599
|
* @description Chunks the query into smaller queries, it returns a generator of the chunks
|
|
3489
3600
|
* @description It will continue to yield chunks until the query returns no results
|
|
@@ -3674,11 +3785,11 @@ declare class QueryBuilder<T extends Model = any> extends JsonQueryBuilder<T> {
|
|
|
3674
3785
|
/**
|
|
3675
3786
|
* @description Returns the query with the parameters bound to the query
|
|
3676
3787
|
*/
|
|
3677
|
-
toQuery(
|
|
3788
|
+
toQuery(): string;
|
|
3678
3789
|
/**
|
|
3679
3790
|
* @description Returns the query with database driver placeholders and the params
|
|
3680
3791
|
*/
|
|
3681
|
-
unWrap(
|
|
3792
|
+
unWrap(): ReturnType<typeof AstParser.prototype.parse>;
|
|
3682
3793
|
/**
|
|
3683
3794
|
* @description Returns a deep clone of the query builder instance.
|
|
3684
3795
|
*/
|
|
@@ -3911,6 +4022,11 @@ declare abstract class Model extends Entity {
|
|
|
3911
4022
|
* @description Gives a query sqlInstance for the given model
|
|
3912
4023
|
*/
|
|
3913
4024
|
static query<T extends Model>(this: new () => T | typeof Model, options?: Omit<BaseModelMethodOptions, "ignoreHooks">): ModelQueryBuilder<T>;
|
|
4025
|
+
/**
|
|
4026
|
+
* @description Returns a dry query builder instance
|
|
4027
|
+
* @description The dry query builder instance will not execute the query
|
|
4028
|
+
*/
|
|
4029
|
+
static dryQuery<T extends Model>(this: new () => T | typeof Model, options?: Omit<BaseModelMethodOptions, "ignoreHooks">): DryModelQueryBuilderWithoutReadOperations<T>;
|
|
3914
4030
|
/**
|
|
3915
4031
|
* @description Finds the first record in the database
|
|
3916
4032
|
* @deprecated Used only for debugging purposes, use findOne or query instead
|
|
@@ -5185,4 +5301,4 @@ declare const generateOpenApiModelWithMetadata: <T extends new () => Model>(mode
|
|
|
5185
5301
|
modelName: string;
|
|
5186
5302
|
}>;
|
|
5187
5303
|
|
|
5188
|
-
export { type AnnotatedModel, type AsymmetricEncryptionOptions, type AugmentedSqlDataSource, AutogeneratedModel, type BaseModelMethodOptions, type BaseModelRelationType, ClientMigrator, Collection, type ColumnDataTypeOption, type ColumnDataTypeOptionSimple, type ColumnDataTypeOptionWithBinary, type ColumnDataTypeOptionWithDatePrecision, type ColumnDataTypeOptionWithEnum, type ColumnDataTypeOptionWithLength, type ColumnDataTypeOptionWithPrecision, type ColumnDataTypeOptionWithScaleAndPrecision, type ColumnDataTypeOptionWithText, type ColumnOptions, type ColumnType, type CommonDataSourceInput, type CommonSqlMethodReturnType, type ConnectionPolicies, type DataSourceInput, type DataSourceType, type DateColumnOptions, type FetchHooks, type GetConnectionReturnType, HysteriaError, type IndexType, type LazyRelationType, type ManyOptions, type ManyToManyOptions, Migration, Model, type ModelInstanceType, ModelQueryBuilder, type ModelWithoutRelations, MongoDataSource, type MongoDataSourceInput, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NumberModelKey, type OneOptions, type PgPoolClientInstance, type PostgresSqlDataSourceInput, QueryBuilder, type RawModelOptions, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationQueryBuilderType, type SqlCloneOptions, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDataSourceWithoutTransaction, type SqlDriverSpecificOptions, type SqlPoolType, type SqliteConnectionInstance, type SqliteDataSourceInput, type StartTransactionOptions, type SymmetricEncryptionOptions, type TableFormat, type ThroughModel, TimestampedModel, Transaction, type TransactionExecutionOptions, type UniqueType, type UseConnectionInput, User, UuidModel, belongsTo, column, createModelFactory, defineMigrator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, getCollectionProperties, getIndexes, getModelColumns, type getPoolReturnType, getPrimaryKey, getRelations, getRelationsMetadata, getUniques, hasMany, hasOne, index, HysteriaLogger as logger, manyToMany, MongoDataSource as mongo, property, RedisDataSource as redis, SqlDataSource as sql, unique, view, withPerformance };
|
|
5304
|
+
export { type AnnotatedModel, type AsymmetricEncryptionOptions, type AugmentedSqlDataSource, AutogeneratedModel, type BaseModelMethodOptions, type BaseModelRelationType, ClientMigrator, Collection, type ColumnDataTypeOption, type ColumnDataTypeOptionSimple, type ColumnDataTypeOptionWithBinary, type ColumnDataTypeOptionWithDatePrecision, type ColumnDataTypeOptionWithEnum, type ColumnDataTypeOptionWithLength, type ColumnDataTypeOptionWithPrecision, type ColumnDataTypeOptionWithScaleAndPrecision, type ColumnDataTypeOptionWithText, type ColumnOptions, type ColumnType, type CommonDataSourceInput, type CommonSqlMethodReturnType, type ConnectionPolicies, type DataSourceInput, type DataSourceType, type DateColumnOptions, DryModelQueryBuilder, DryQueryBuilder, type FetchHooks, type GetConnectionReturnType, HysteriaError, type IndexType, type LazyRelationType, type ManyOptions, type ManyToManyOptions, Migration, Model, type ModelInstanceType, ModelQueryBuilder, type ModelWithoutRelations, MongoDataSource, type MongoDataSourceInput, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NumberModelKey, type OneOptions, type PgPoolClientInstance, type PostgresSqlDataSourceInput, QueryBuilder, type RawModelOptions, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationQueryBuilderType, type SqlCloneOptions, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDataSourceWithoutTransaction, type SqlDriverSpecificOptions, type SqlPoolType, type SqliteConnectionInstance, type SqliteDataSourceInput, type StartTransactionOptions, type SymmetricEncryptionOptions, type TableFormat, type ThroughModel, TimestampedModel, Transaction, type TransactionExecutionOptions, type UniqueType, type UseConnectionInput, User, UuidModel, belongsTo, column, createModelFactory, defineMigrator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, getCollectionProperties, getIndexes, getModelColumns, type getPoolReturnType, getPrimaryKey, getRelations, getRelationsMetadata, getUniques, hasMany, hasOne, index, HysteriaLogger as logger, manyToMany, MongoDataSource as mongo, property, RedisDataSource as redis, SqlDataSource as sql, unique, view, withPerformance };
|
package/lib/index.d.ts
CHANGED
|
@@ -1392,6 +1392,63 @@ declare class InterpreterUtils {
|
|
|
1392
1392
|
getFromForWriteOperations(dbType: SqlDataSourceType, fromNode: FromNode): string;
|
|
1393
1393
|
}
|
|
1394
1394
|
|
|
1395
|
+
type DeleteOptions = {
|
|
1396
|
+
ignoreBeforeDeleteHook?: boolean;
|
|
1397
|
+
};
|
|
1398
|
+
type SoftDeleteOptions<T> = {
|
|
1399
|
+
column?: MongoCollectionKey<T>;
|
|
1400
|
+
value?: string | number | boolean;
|
|
1401
|
+
ignoreBeforeUpdateHook?: boolean;
|
|
1402
|
+
};
|
|
1403
|
+
|
|
1404
|
+
/**
|
|
1405
|
+
* Allows to get queries without executing them
|
|
1406
|
+
*/
|
|
1407
|
+
declare class DryQueryBuilder extends QueryBuilder {
|
|
1408
|
+
constructor(model: typeof Model, sqlDataSource: SqlDataSource);
|
|
1409
|
+
many(): this;
|
|
1410
|
+
/**
|
|
1411
|
+
* @description Builds the insert query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
1412
|
+
* @param args The arguments to pass to the insert method
|
|
1413
|
+
* @returns The query builder
|
|
1414
|
+
*/
|
|
1415
|
+
insert(...args: Parameters<typeof QueryBuilder.prototype.insert>): this;
|
|
1416
|
+
/**
|
|
1417
|
+
* @description Builds the insert many query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
1418
|
+
* @param args The arguments to pass to the insert many method
|
|
1419
|
+
* @returns The query builder
|
|
1420
|
+
*/
|
|
1421
|
+
insertMany(...args: Parameters<typeof QueryBuilder.prototype.insertMany>): this;
|
|
1422
|
+
/**
|
|
1423
|
+
* @description Builds the upsert query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
1424
|
+
* @param args The arguments to pass to the upsert method
|
|
1425
|
+
* @returns The query builder
|
|
1426
|
+
*/
|
|
1427
|
+
upsert(...args: Parameters<typeof QueryBuilder.prototype.upsert>): this;
|
|
1428
|
+
/**
|
|
1429
|
+
* @description Builds the update query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
1430
|
+
* @param data The data to update
|
|
1431
|
+
* @returns The query builder
|
|
1432
|
+
*/
|
|
1433
|
+
update(data: Record<string, any>): this;
|
|
1434
|
+
/**
|
|
1435
|
+
* @description Builds the delete query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
1436
|
+
* @returns The query builder
|
|
1437
|
+
*/
|
|
1438
|
+
delete(): this;
|
|
1439
|
+
/**
|
|
1440
|
+
* @description Builds the truncate query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
1441
|
+
* @returns The query builder
|
|
1442
|
+
*/
|
|
1443
|
+
truncate(): this;
|
|
1444
|
+
/**
|
|
1445
|
+
* @description Builds the soft delete query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
1446
|
+
* @param options Soft delete options
|
|
1447
|
+
* @returns The query builder
|
|
1448
|
+
*/
|
|
1449
|
+
softDelete(options?: Omit<SoftDeleteOptions<any>, "ignoreBeforeDeleteHook">): this;
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1395
1452
|
type BaseValues$1 = string | number | boolean | null;
|
|
1396
1453
|
type BinaryOperatorType$1 = "=" | "!=" | "<>" | ">" | "<" | ">=" | "<=" | "like" | "ilike" | "in";
|
|
1397
1454
|
declare class HavingNode extends QueryNode {
|
|
@@ -2405,6 +2462,8 @@ type UpsertOptionsRawBuilder = {
|
|
|
2405
2462
|
updateOnConflict?: boolean;
|
|
2406
2463
|
returning?: string[];
|
|
2407
2464
|
};
|
|
2465
|
+
type DryQueryBuilderWithoutReadOperations = Omit<DryQueryBuilder, "many" | "one" | "oneOrFail" | "first" | "firstOrFail" | "paginate" | "paginateWithCursor" | "exists" | "pluck" | "upsert" | "upsertMany" | "increment" | "decrement" | "getSum" | "getAvg" | "getMin" | "getMax" | "getCount" | "stream" | "chunk" | "paginate" | "paginateWithCursor" | "exists">;
|
|
2466
|
+
type DryModelQueryBuilderWithoutReadOperations<T extends Model, A extends Record<string, any> = {}, R extends Record<string, any> = {}> = Omit<DryModelQueryBuilder<T, A, R>, "many" | "one" | "oneOrFail" | "first" | "firstOrFail" | "paginate" | "paginateWithCursor" | "exists" | "pluck" | "upsert" | "upsertMany" | "increment" | "decrement" | "getSum" | "getAvg" | "getMin" | "getMax" | "getCount" | "stream" | "chunk" | "paginate" | "paginateWithCursor" | "exists">;
|
|
2408
2467
|
|
|
2409
2468
|
declare class SqlModelManagerUtils<T extends Model> {
|
|
2410
2469
|
protected dbType: SqlDataSourceType;
|
|
@@ -2440,15 +2499,6 @@ type CursorPaginatedData<T extends Model, A extends object = {}, R extends objec
|
|
|
2440
2499
|
data: AnnotatedModel<T, A, R>[];
|
|
2441
2500
|
};
|
|
2442
2501
|
|
|
2443
|
-
type DeleteOptions = {
|
|
2444
|
-
ignoreBeforeDeleteHook?: boolean;
|
|
2445
|
-
};
|
|
2446
|
-
type SoftDeleteOptions<T> = {
|
|
2447
|
-
column?: MongoCollectionKey<T>;
|
|
2448
|
-
value?: string | number | boolean;
|
|
2449
|
-
ignoreBeforeDeleteHook?: boolean;
|
|
2450
|
-
};
|
|
2451
|
-
|
|
2452
2502
|
type UpdateOptions = {
|
|
2453
2503
|
ignoreBeforeUpdateHook?: boolean;
|
|
2454
2504
|
};
|
|
@@ -2826,6 +2876,50 @@ declare class ModelQueryBuilder<T extends Model, A extends Record<string, any> =
|
|
|
2826
2876
|
private truncateWithPerformance;
|
|
2827
2877
|
}
|
|
2828
2878
|
|
|
2879
|
+
/**
|
|
2880
|
+
* Allows to get model queries without executing them
|
|
2881
|
+
*/
|
|
2882
|
+
declare class DryModelQueryBuilder<T extends Model, A extends Record<string, any> = {}, R extends Record<string, any> = {}> extends ModelQueryBuilder<T, A, R> {
|
|
2883
|
+
constructor(model: typeof Model, sqlDataSource: SqlDataSource);
|
|
2884
|
+
many(): this;
|
|
2885
|
+
/**
|
|
2886
|
+
* @description Builds the insert query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
2887
|
+
* @param args The arguments to pass to the insert method
|
|
2888
|
+
* @returns The query builder
|
|
2889
|
+
*/
|
|
2890
|
+
insert(...args: Parameters<typeof this$1.model.insert<T>>): this;
|
|
2891
|
+
/**
|
|
2892
|
+
* @description Builds the insert many query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
2893
|
+
* @param args The arguments to pass to the insert many method
|
|
2894
|
+
* @returns The query builder
|
|
2895
|
+
*/
|
|
2896
|
+
insertMany(...args: Parameters<typeof this$1.model.insertMany<T>>): this;
|
|
2897
|
+
/**
|
|
2898
|
+
* @description Builds the update query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
2899
|
+
* @param data The data to update
|
|
2900
|
+
* @param options Update options
|
|
2901
|
+
* @returns The query builder
|
|
2902
|
+
*/
|
|
2903
|
+
update(...args: Parameters<ReturnType<typeof this$1.model.query<T>>["update"]>): this;
|
|
2904
|
+
/**
|
|
2905
|
+
* @description Builds the delete query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
2906
|
+
* @param options Delete options
|
|
2907
|
+
* @returns The query builder
|
|
2908
|
+
*/
|
|
2909
|
+
delete(...args: Parameters<ReturnType<typeof this$1.model.query<T>>["delete"]>): this;
|
|
2910
|
+
/**
|
|
2911
|
+
* @description Builds the truncate query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
2912
|
+
* @returns The query builder
|
|
2913
|
+
*/
|
|
2914
|
+
truncate(): this;
|
|
2915
|
+
/**
|
|
2916
|
+
* @description Builds the soft delete query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
2917
|
+
* @param options Soft delete options
|
|
2918
|
+
* @returns The query builder
|
|
2919
|
+
*/
|
|
2920
|
+
softDelete(...args: Parameters<ReturnType<typeof this$1.model.query<T>>["softDelete"]>): this;
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2829
2923
|
declare class ModelManager<T extends Model> {
|
|
2830
2924
|
protected sqlDataSource: SqlDataSource;
|
|
2831
2925
|
protected sqlType: SqlDataSourceType;
|
|
@@ -2885,6 +2979,11 @@ declare class ModelManager<T extends Model> {
|
|
|
2885
2979
|
* @description Returns a query builder instance
|
|
2886
2980
|
*/
|
|
2887
2981
|
query(): Omit<ModelQueryBuilder<T>, "insert" | "insertMany">;
|
|
2982
|
+
/**
|
|
2983
|
+
* @description Returns a dry query builder instance
|
|
2984
|
+
* @description The dry query builder instance will not execute the query, it will return the query statement
|
|
2985
|
+
*/
|
|
2986
|
+
dryQuery(): Omit<DryModelQueryBuilder<T>, "insert" | "insertMany">;
|
|
2888
2987
|
/**
|
|
2889
2988
|
* @description Mysql does not return the inserted model, so we need to get the inserted model from the database
|
|
2890
2989
|
*/
|
|
@@ -3008,6 +3107,12 @@ declare class SqlDataSource extends DataSource {
|
|
|
3008
3107
|
* @param table The table name to query from, must be in valid sql format `table` or `table as alias`
|
|
3009
3108
|
*/
|
|
3010
3109
|
static query<S extends string>(table: TableFormat<S>, options?: RawModelOptions): QueryBuilder;
|
|
3110
|
+
/**
|
|
3111
|
+
* @description Returns a dry query builder instance
|
|
3112
|
+
* @description The dry query builder instance will not execute the query, it will return the query statement
|
|
3113
|
+
* @returns The dry query builder instance
|
|
3114
|
+
*/
|
|
3115
|
+
static dryQuery<S extends string>(table: TableFormat<S>, options?: RawModelOptions): DryQueryBuilderWithoutReadOperations;
|
|
3011
3116
|
/**
|
|
3012
3117
|
* @description Creates a table on the database, return the query to be executed to create the table
|
|
3013
3118
|
*/
|
|
@@ -3102,6 +3207,12 @@ declare class SqlDataSource extends DataSource {
|
|
|
3102
3207
|
* @param table The table name to query from, must be in valid sql format `table` or `table as alias`
|
|
3103
3208
|
*/
|
|
3104
3209
|
query<S extends string>(table: TableFormat<S>, options?: RawModelOptions): QueryBuilder;
|
|
3210
|
+
/**
|
|
3211
|
+
* @description Returns a DryQueryBuilder instance
|
|
3212
|
+
* @description The dry query builder instance will not execute the query, it will return the query statement
|
|
3213
|
+
* @returns The dry query builder instance
|
|
3214
|
+
*/
|
|
3215
|
+
dryQuery<S extends string>(table: TableFormat<S>, options?: RawModelOptions): DryQueryBuilderWithoutReadOperations;
|
|
3105
3216
|
/**
|
|
3106
3217
|
* @description Return the query to alter the given table schema
|
|
3107
3218
|
*/
|
|
@@ -3483,7 +3594,7 @@ declare class QueryBuilder<T extends Model = any> extends JsonQueryBuilder<T> {
|
|
|
3483
3594
|
* @postgres needs the pg-query-stream package in order to work
|
|
3484
3595
|
* @throws If using postgres and the `pg-query-stream` package is not installed
|
|
3485
3596
|
*/
|
|
3486
|
-
stream<M extends Model = T>(options?: StreamOptions
|
|
3597
|
+
stream<M extends Model = T>(options?: StreamOptions): Promise<PassThrough & AsyncGenerator<AnnotatedModel<M, {}, {}>>>;
|
|
3487
3598
|
/**
|
|
3488
3599
|
* @description Chunks the query into smaller queries, it returns a generator of the chunks
|
|
3489
3600
|
* @description It will continue to yield chunks until the query returns no results
|
|
@@ -3674,11 +3785,11 @@ declare class QueryBuilder<T extends Model = any> extends JsonQueryBuilder<T> {
|
|
|
3674
3785
|
/**
|
|
3675
3786
|
* @description Returns the query with the parameters bound to the query
|
|
3676
3787
|
*/
|
|
3677
|
-
toQuery(
|
|
3788
|
+
toQuery(): string;
|
|
3678
3789
|
/**
|
|
3679
3790
|
* @description Returns the query with database driver placeholders and the params
|
|
3680
3791
|
*/
|
|
3681
|
-
unWrap(
|
|
3792
|
+
unWrap(): ReturnType<typeof AstParser.prototype.parse>;
|
|
3682
3793
|
/**
|
|
3683
3794
|
* @description Returns a deep clone of the query builder instance.
|
|
3684
3795
|
*/
|
|
@@ -3911,6 +4022,11 @@ declare abstract class Model extends Entity {
|
|
|
3911
4022
|
* @description Gives a query sqlInstance for the given model
|
|
3912
4023
|
*/
|
|
3913
4024
|
static query<T extends Model>(this: new () => T | typeof Model, options?: Omit<BaseModelMethodOptions, "ignoreHooks">): ModelQueryBuilder<T>;
|
|
4025
|
+
/**
|
|
4026
|
+
* @description Returns a dry query builder instance
|
|
4027
|
+
* @description The dry query builder instance will not execute the query
|
|
4028
|
+
*/
|
|
4029
|
+
static dryQuery<T extends Model>(this: new () => T | typeof Model, options?: Omit<BaseModelMethodOptions, "ignoreHooks">): DryModelQueryBuilderWithoutReadOperations<T>;
|
|
3914
4030
|
/**
|
|
3915
4031
|
* @description Finds the first record in the database
|
|
3916
4032
|
* @deprecated Used only for debugging purposes, use findOne or query instead
|
|
@@ -5185,4 +5301,4 @@ declare const generateOpenApiModelWithMetadata: <T extends new () => Model>(mode
|
|
|
5185
5301
|
modelName: string;
|
|
5186
5302
|
}>;
|
|
5187
5303
|
|
|
5188
|
-
export { type AnnotatedModel, type AsymmetricEncryptionOptions, type AugmentedSqlDataSource, AutogeneratedModel, type BaseModelMethodOptions, type BaseModelRelationType, ClientMigrator, Collection, type ColumnDataTypeOption, type ColumnDataTypeOptionSimple, type ColumnDataTypeOptionWithBinary, type ColumnDataTypeOptionWithDatePrecision, type ColumnDataTypeOptionWithEnum, type ColumnDataTypeOptionWithLength, type ColumnDataTypeOptionWithPrecision, type ColumnDataTypeOptionWithScaleAndPrecision, type ColumnDataTypeOptionWithText, type ColumnOptions, type ColumnType, type CommonDataSourceInput, type CommonSqlMethodReturnType, type ConnectionPolicies, type DataSourceInput, type DataSourceType, type DateColumnOptions, type FetchHooks, type GetConnectionReturnType, HysteriaError, type IndexType, type LazyRelationType, type ManyOptions, type ManyToManyOptions, Migration, Model, type ModelInstanceType, ModelQueryBuilder, type ModelWithoutRelations, MongoDataSource, type MongoDataSourceInput, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NumberModelKey, type OneOptions, type PgPoolClientInstance, type PostgresSqlDataSourceInput, QueryBuilder, type RawModelOptions, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationQueryBuilderType, type SqlCloneOptions, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDataSourceWithoutTransaction, type SqlDriverSpecificOptions, type SqlPoolType, type SqliteConnectionInstance, type SqliteDataSourceInput, type StartTransactionOptions, type SymmetricEncryptionOptions, type TableFormat, type ThroughModel, TimestampedModel, Transaction, type TransactionExecutionOptions, type UniqueType, type UseConnectionInput, User, UuidModel, belongsTo, column, createModelFactory, defineMigrator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, getCollectionProperties, getIndexes, getModelColumns, type getPoolReturnType, getPrimaryKey, getRelations, getRelationsMetadata, getUniques, hasMany, hasOne, index, HysteriaLogger as logger, manyToMany, MongoDataSource as mongo, property, RedisDataSource as redis, SqlDataSource as sql, unique, view, withPerformance };
|
|
5304
|
+
export { type AnnotatedModel, type AsymmetricEncryptionOptions, type AugmentedSqlDataSource, AutogeneratedModel, type BaseModelMethodOptions, type BaseModelRelationType, ClientMigrator, Collection, type ColumnDataTypeOption, type ColumnDataTypeOptionSimple, type ColumnDataTypeOptionWithBinary, type ColumnDataTypeOptionWithDatePrecision, type ColumnDataTypeOptionWithEnum, type ColumnDataTypeOptionWithLength, type ColumnDataTypeOptionWithPrecision, type ColumnDataTypeOptionWithScaleAndPrecision, type ColumnDataTypeOptionWithText, type ColumnOptions, type ColumnType, type CommonDataSourceInput, type CommonSqlMethodReturnType, type ConnectionPolicies, type DataSourceInput, type DataSourceType, type DateColumnOptions, DryModelQueryBuilder, DryQueryBuilder, type FetchHooks, type GetConnectionReturnType, HysteriaError, type IndexType, type LazyRelationType, type ManyOptions, type ManyToManyOptions, Migration, Model, type ModelInstanceType, ModelQueryBuilder, type ModelWithoutRelations, MongoDataSource, type MongoDataSourceInput, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NumberModelKey, type OneOptions, type PgPoolClientInstance, type PostgresSqlDataSourceInput, QueryBuilder, type RawModelOptions, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationQueryBuilderType, type SqlCloneOptions, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDataSourceWithoutTransaction, type SqlDriverSpecificOptions, type SqlPoolType, type SqliteConnectionInstance, type SqliteDataSourceInput, type StartTransactionOptions, type SymmetricEncryptionOptions, type TableFormat, type ThroughModel, TimestampedModel, Transaction, type TransactionExecutionOptions, type UniqueType, type UseConnectionInput, User, UuidModel, belongsTo, column, createModelFactory, defineMigrator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, getCollectionProperties, getIndexes, getModelColumns, type getPoolReturnType, getPrimaryKey, getRelations, getRelationsMetadata, getUniques, hasMany, hasOne, index, HysteriaLogger as logger, manyToMany, MongoDataSource as mongo, property, RedisDataSource as redis, SqlDataSource as sql, unique, view, withPerformance };
|