hysteria-orm 10.3.3 → 10.3.5
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/LICENSE +1 -1
- package/README.md +2 -2
- package/lib/cli.cjs +46 -17
- package/lib/cli.cjs.map +1 -1
- package/lib/cli.js +46 -17
- package/lib/cli.js.map +1 -1
- package/lib/index.cjs +33 -10
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +142 -17
- package/lib/index.d.ts +142 -17
- package/lib/index.js +33 -10
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.cts
CHANGED
|
@@ -1107,10 +1107,46 @@ type ConnectionPolicies = {
|
|
|
1107
1107
|
};
|
|
1108
1108
|
};
|
|
1109
1109
|
type SqlDataSourceModel = typeof Model;
|
|
1110
|
+
/**
|
|
1111
|
+
* @description Base migration configuration options available for all databases
|
|
1112
|
+
*/
|
|
1113
|
+
type MigrationConfigBase = {
|
|
1114
|
+
/**
|
|
1115
|
+
* @description The path to the migrations folder, can be overridden in the cli command
|
|
1116
|
+
* @default "database/migrations"
|
|
1117
|
+
*/
|
|
1118
|
+
path?: string;
|
|
1119
|
+
/**
|
|
1120
|
+
* @description Path to the tsconfig.json file for TypeScript migration files, can be overridden in the cli command
|
|
1121
|
+
* @default "./tsconfig.json"
|
|
1122
|
+
*/
|
|
1123
|
+
tsconfig?: string;
|
|
1124
|
+
/**
|
|
1125
|
+
* @description Acquire advisory lock before running migrations to prevent concurrent execution, can be overridden in the cli command
|
|
1126
|
+
* @default true
|
|
1127
|
+
*/
|
|
1128
|
+
lock?: boolean;
|
|
1129
|
+
};
|
|
1130
|
+
/**
|
|
1131
|
+
* @description Migration configuration with transactional support for PostgreSQL and CockroachDB
|
|
1132
|
+
*/
|
|
1133
|
+
type MigrationConfigWithTransactional = MigrationConfigBase & {
|
|
1134
|
+
/**
|
|
1135
|
+
* @description Runs all pending migrations in a single transaction, can be overridden in the cli command
|
|
1136
|
+
* @default true
|
|
1137
|
+
* @note Only available for PostgreSQL and CockroachDB
|
|
1138
|
+
*/
|
|
1139
|
+
transactional?: boolean;
|
|
1140
|
+
};
|
|
1141
|
+
/**
|
|
1142
|
+
* @description Migration configuration type based on database type
|
|
1143
|
+
* @description Adds transactional option only for PostgreSQL and CockroachDB
|
|
1144
|
+
*/
|
|
1145
|
+
type MigrationConfig<D extends SqlDataSourceType = SqlDataSourceType> = D extends "postgres" | "cockroachdb" ? MigrationConfigWithTransactional : MigrationConfigBase;
|
|
1110
1146
|
/**
|
|
1111
1147
|
* @description Common input properties shared across all SqlDataSource types
|
|
1112
1148
|
*/
|
|
1113
|
-
type SqlDataSourceInputBase<T extends Record<string, SqlDataSourceModel> = {}, C extends CacheKeys = {}> = {
|
|
1149
|
+
type SqlDataSourceInputBase<T extends Record<string, SqlDataSourceModel> = {}, C extends CacheKeys = {}, D extends SqlDataSourceType = SqlDataSourceType> = {
|
|
1114
1150
|
/**
|
|
1115
1151
|
* @description Whether to log the sql queries and other debug information
|
|
1116
1152
|
*/
|
|
@@ -1129,10 +1165,9 @@ type SqlDataSourceInputBase<T extends Record<string, SqlDataSourceModel> = {}, C
|
|
|
1129
1165
|
*/
|
|
1130
1166
|
models?: T;
|
|
1131
1167
|
/**
|
|
1132
|
-
* @description
|
|
1133
|
-
* @default "database/migrations"
|
|
1168
|
+
* @description Migration configuration for the sql data source
|
|
1134
1169
|
*/
|
|
1135
|
-
|
|
1170
|
+
migrations?: MigrationConfig<D>;
|
|
1136
1171
|
/**
|
|
1137
1172
|
* @description The cache strategy to use for the sql data source, it's used to configure the cache strategy for the sql data source
|
|
1138
1173
|
*/
|
|
@@ -1150,11 +1185,19 @@ type SqlDataSourceInputBase<T extends Record<string, SqlDataSourceModel> = {}, C
|
|
|
1150
1185
|
* @description Maps a SqlDataSourceType to its corresponding input interface
|
|
1151
1186
|
*/
|
|
1152
1187
|
type MapSqlDataSourceTypeToInput<D extends SqlDataSourceType> = D extends "mysql" | "mariadb" ? MysqlSqlDataSourceInput : D extends "postgres" | "cockroachdb" ? PostgresSqlDataSourceInput : D extends "sqlite" ? SqliteDataSourceInput : D extends "mssql" ? MssqlDataSourceInput : D extends "oracledb" ? OracleDBDataSourceInput : never;
|
|
1188
|
+
type SlaveContext = {
|
|
1189
|
+
type: SqlDataSourceType;
|
|
1190
|
+
host: string;
|
|
1191
|
+
port: number;
|
|
1192
|
+
username: string;
|
|
1193
|
+
password: string;
|
|
1194
|
+
database: string;
|
|
1195
|
+
};
|
|
1153
1196
|
/**
|
|
1154
1197
|
* @description The input type for the SqlDataSource constructor
|
|
1155
1198
|
* @description The connectionPolicies object is used to configure the connection policies for the sql data source
|
|
1156
1199
|
*/
|
|
1157
|
-
type SqlDataSourceInput<D extends SqlDataSourceType = SqlDataSourceType, T extends Record<string, SqlDataSourceModel> = {}, C extends CacheKeys = {}> = SqlDataSourceInputBase<T, C> & {
|
|
1200
|
+
type SqlDataSourceInput<D extends SqlDataSourceType = SqlDataSourceType, T extends Record<string, SqlDataSourceModel> = {}, C extends CacheKeys = {}> = SqlDataSourceInputBase<T, C, D> & {
|
|
1158
1201
|
/**
|
|
1159
1202
|
* @description The type of the database to connect to
|
|
1160
1203
|
*/
|
|
@@ -1168,10 +1211,14 @@ type SqlDataSourceInput<D extends SqlDataSourceType = SqlDataSourceType, T exten
|
|
|
1168
1211
|
* @description The replication configuration for the sql data source, it's used to configure the replication for the sql data source
|
|
1169
1212
|
*/
|
|
1170
1213
|
replication?: {
|
|
1214
|
+
/**
|
|
1215
|
+
* @description The function to call when a slave server fails, if not provided an error will be thrown
|
|
1216
|
+
*/
|
|
1217
|
+
onSlaveServerFailure?: (error: Error, context: SlaveContext) => void | Promise<void>;
|
|
1171
1218
|
/**
|
|
1172
1219
|
* @description The slaves data sources to use for the sql data source, slaves are automatically used for read operations unless specified otherwise
|
|
1173
1220
|
*/
|
|
1174
|
-
slaves?: Omit<UseConnectionInput<D, T, C>, "slaves" | "models" | "cacheStrategy" | "adminJs" | "logs" | "queryFormatOptions" | "
|
|
1221
|
+
slaves?: Omit<UseConnectionInput<D, T, C>, "slaves" | "models" | "cacheStrategy" | "adminJs" | "logs" | "queryFormatOptions" | "migrations">[];
|
|
1175
1222
|
/**
|
|
1176
1223
|
* @description The algorithm to use for selecting the slave for read operations
|
|
1177
1224
|
* @default "roundRobin" - Distributes requests evenly across all slaves in sequence
|
|
@@ -1544,6 +1591,14 @@ declare class CreateTableBuilder extends BaseBuilder {
|
|
|
1544
1591
|
private sqlType;
|
|
1545
1592
|
constructor(sqlType: SqlDataSourceType, nodes: QueryNode[], tableName?: string, context?: "alter_table" | "create_table");
|
|
1546
1593
|
private build;
|
|
1594
|
+
/**
|
|
1595
|
+
* @description Adds a raw statement to an operation that will be executed as is
|
|
1596
|
+
* @example
|
|
1597
|
+
* ```ts
|
|
1598
|
+
* table.varchar("name").default(table.rawStatement("CURRENT_TIMESTAMP"));
|
|
1599
|
+
* ```
|
|
1600
|
+
*/
|
|
1601
|
+
rawStatement(value: string): RawNode;
|
|
1547
1602
|
/**
|
|
1548
1603
|
* Fixed-length character string
|
|
1549
1604
|
* @mysql Supported as CHAR(length)
|
|
@@ -1825,6 +1880,14 @@ declare class AlterTableBuilder extends BaseBuilder {
|
|
|
1825
1880
|
private table;
|
|
1826
1881
|
private sqlType;
|
|
1827
1882
|
constructor(table: string, nodes: QueryNode[], sqlType: SqlDataSourceType);
|
|
1883
|
+
/**
|
|
1884
|
+
* @description Adds a raw statement to an operation that will be executed as is
|
|
1885
|
+
* @example
|
|
1886
|
+
* ```ts
|
|
1887
|
+
* table.varchar("name").default(table.rawStatement("CURRENT_TIMESTAMP"));
|
|
1888
|
+
* ```
|
|
1889
|
+
*/
|
|
1890
|
+
rawStatement(value: string): RawNode;
|
|
1828
1891
|
/**
|
|
1829
1892
|
* @description Adds a column to the table
|
|
1830
1893
|
* @param cb is the callback that will be used to build the column
|
|
@@ -1918,6 +1981,17 @@ declare class Schema {
|
|
|
1918
1981
|
queryStatements: string[];
|
|
1919
1982
|
sqlType: SqlDataSourceType;
|
|
1920
1983
|
constructor(sqlType?: SqlDataSourceType);
|
|
1984
|
+
/**
|
|
1985
|
+
* @description Adds a raw statement to an operation that will be executed as is
|
|
1986
|
+
* @example
|
|
1987
|
+
* ```ts
|
|
1988
|
+
* schema.rawStatement("CURRENT_TIMESTAMP");
|
|
1989
|
+
* schema.alterTable("users", (table) => {
|
|
1990
|
+
* table.timestamp("created_at").default(this.schema.rawStatement("CURRENT_TIMESTAMP"));
|
|
1991
|
+
* });
|
|
1992
|
+
* ```
|
|
1993
|
+
*/
|
|
1994
|
+
rawStatement(value: string): RawNode;
|
|
1921
1995
|
/**
|
|
1922
1996
|
* @description Add raw query to the migration
|
|
1923
1997
|
*/
|
|
@@ -2037,7 +2111,7 @@ declare class DryQueryBuilder extends QueryBuilder {
|
|
|
2037
2111
|
* @warning This method does not run model or column hooks
|
|
2038
2112
|
* @returns The query builder
|
|
2039
2113
|
*/
|
|
2040
|
-
update(data: Record<string,
|
|
2114
|
+
update(data: Record<string, WriteQueryParam>): this;
|
|
2041
2115
|
/**
|
|
2042
2116
|
* @description Builds the delete query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
2043
2117
|
* @warning This method does not run model or column hooks
|
|
@@ -3107,6 +3181,7 @@ type UpsertOptionsRawBuilder = {
|
|
|
3107
3181
|
};
|
|
3108
3182
|
type DryQueryBuilderWithoutReadOperations = Omit<DryQueryBuilder, "many" | "one" | "oneOrFail" | "first" | "firstOrFail" | "paginate" | "paginateWithCursor" | "exists" | "pluck" | "increment" | "decrement" | "getSum" | "getAvg" | "getMin" | "getMax" | "getCount" | "stream" | "chunk" | "paginate" | "paginateWithCursor" | "exists">;
|
|
3109
3183
|
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">;
|
|
3184
|
+
type WriteQueryParam$1 = string | number | boolean | Date | RawNode | object | null | undefined;
|
|
3110
3185
|
|
|
3111
3186
|
declare class SqlModelManagerUtils<T extends Model> {
|
|
3112
3187
|
protected dbType: SqlDataSourceType;
|
|
@@ -3698,9 +3773,14 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
|
|
|
3698
3773
|
*/
|
|
3699
3774
|
cacheKeys: C;
|
|
3700
3775
|
/**
|
|
3701
|
-
* @description
|
|
3776
|
+
* @description Migration configuration for the sql data source
|
|
3702
3777
|
*/
|
|
3703
|
-
|
|
3778
|
+
migrationConfig: {
|
|
3779
|
+
path: string;
|
|
3780
|
+
tsconfig?: string;
|
|
3781
|
+
lock: boolean;
|
|
3782
|
+
transactional: boolean;
|
|
3783
|
+
};
|
|
3704
3784
|
/**
|
|
3705
3785
|
* @description AdminJS configuration options
|
|
3706
3786
|
*/
|
|
@@ -3709,6 +3789,14 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
|
|
|
3709
3789
|
* @description Cached AdminJS instance
|
|
3710
3790
|
*/
|
|
3711
3791
|
private adminJsInstance?;
|
|
3792
|
+
/**
|
|
3793
|
+
* @description Callback to handle slave server failures
|
|
3794
|
+
*/
|
|
3795
|
+
private onSlaveServerFailure?;
|
|
3796
|
+
/**
|
|
3797
|
+
* @description Returns the configured slave failure callback
|
|
3798
|
+
*/
|
|
3799
|
+
getOnSlaveServerFailure(): ((error: Error, context: SlaveContext) => void | Promise<void>) | undefined;
|
|
3712
3800
|
/**
|
|
3713
3801
|
* @description Returns the primary instance of the SqlDataSource (set via connect with setPrimary: true)
|
|
3714
3802
|
* All models by default will use this instance to execute queries unless you pass a different connection/transaction in the query options
|
|
@@ -3938,10 +4026,16 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
|
|
|
3938
4026
|
*/
|
|
3939
4027
|
rawQuery<R = RawQueryResponseType<D>>(query: string, params?: any[], options?: RawQueryOptions): Promise<R>;
|
|
3940
4028
|
/**
|
|
3941
|
-
* @description Adds a raw statement to an operation
|
|
4029
|
+
* @description Adds a raw statement to an operation that will be executed as is
|
|
3942
4030
|
* @example
|
|
3943
4031
|
* ```ts
|
|
3944
|
-
* await
|
|
4032
|
+
* await sql.query("users").where("name", sql.rawStatement("LOWER(name)"));
|
|
4033
|
+
* await sql.query("users").update({
|
|
4034
|
+
* name: sql.rawStatement("LOWER(name)"),
|
|
4035
|
+
* });
|
|
4036
|
+
* await sql.query("users").insert({
|
|
4037
|
+
* name: sql.rawStatement("LOWER(name)"),
|
|
4038
|
+
* });
|
|
3945
4039
|
* ```
|
|
3946
4040
|
*/
|
|
3947
4041
|
rawStatement(value: string): RawNode;
|
|
@@ -3995,6 +4089,30 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
|
|
|
3995
4089
|
* @description Introspects table primary key from the database
|
|
3996
4090
|
*/
|
|
3997
4091
|
getPrimaryKeyInfo(table: string): Promise<TablePrimaryKeyInfo | undefined>;
|
|
4092
|
+
/**
|
|
4093
|
+
* @description Acquires an advisory lock
|
|
4094
|
+
* @description Useful for preventing concurrent operations from running simultaneously
|
|
4095
|
+
* @param lockKey - The lock identifier (defaults to 'hysteria_lock')
|
|
4096
|
+
* @param timeoutMs - Maximum time to wait for lock in milliseconds (postgres/mssql only)
|
|
4097
|
+
* @returns true if lock was acquired, false otherwise
|
|
4098
|
+
*/
|
|
4099
|
+
acquireLock(lockKey?: string, timeoutMs?: number): Promise<boolean>;
|
|
4100
|
+
/**
|
|
4101
|
+
* @description Releases an advisory lock
|
|
4102
|
+
* @param lockKey - The lock identifier (defaults to 'hysteria_lock')
|
|
4103
|
+
* @returns true if lock was released, false otherwise
|
|
4104
|
+
*/
|
|
4105
|
+
releaseLock(lockKey?: string): Promise<boolean>;
|
|
4106
|
+
/**
|
|
4107
|
+
* @description Converts a string to a numeric lock ID for databases that require it
|
|
4108
|
+
*/
|
|
4109
|
+
private hashStringToLockId;
|
|
4110
|
+
/**
|
|
4111
|
+
* @description Executes an operation on a slave, handling failures with the configured callback
|
|
4112
|
+
* @param operation The operation to execute on the slave
|
|
4113
|
+
* @returns The result of the operation, or falls back to master if slave fails
|
|
4114
|
+
*/
|
|
4115
|
+
private executeOnSlave;
|
|
3998
4116
|
/**
|
|
3999
4117
|
* @description Internal method to establish connection without setting as primary instance
|
|
4000
4118
|
* @description Used by connectToSecondarySource and useConnection
|
|
@@ -4328,18 +4446,18 @@ declare class QueryBuilder<T extends Model = any> extends JsonQueryBuilder<T> {
|
|
|
4328
4446
|
*/
|
|
4329
4447
|
withMaterialized(alias: string, cb: (qb: QueryBuilder<T>) => void): this;
|
|
4330
4448
|
/**
|
|
4331
|
-
* @description Insert record into a table
|
|
4449
|
+
* @description Insert record into a table, you can use raw statements in the data object for literal references to other columns
|
|
4332
4450
|
* @param returning - The columns to return from the query, only supported by postgres and cockroachdb - default is "*"
|
|
4333
4451
|
* @returns raw driver response
|
|
4334
4452
|
*/
|
|
4335
|
-
insert(data: Record<string,
|
|
4453
|
+
insert(data: Record<string, WriteQueryParam$1>, returning?: string[]): Promise<T>;
|
|
4336
4454
|
/**
|
|
4337
4455
|
* @description Insert multiple records into a table
|
|
4338
4456
|
* @param returning - The columns to return from the query, only supported by postgres and cockroachdb - default is "*"
|
|
4339
4457
|
* @returns raw driver response
|
|
4340
4458
|
* @oracledb may do multiple inserts with auto-generated identity columns
|
|
4341
4459
|
*/
|
|
4342
|
-
insertMany(data: Record<string,
|
|
4460
|
+
insertMany(data: Record<string, WriteQueryParam$1>[], returning?: string[]): Promise<T[]>;
|
|
4343
4461
|
/**
|
|
4344
4462
|
* @description Updates or creates a new record using upsert functionality
|
|
4345
4463
|
* @param data The data to insert or update
|
|
@@ -4361,10 +4479,10 @@ declare class QueryBuilder<T extends Model = any> extends JsonQueryBuilder<T> {
|
|
|
4361
4479
|
*/
|
|
4362
4480
|
private executeMssqlMergeRaw;
|
|
4363
4481
|
/**
|
|
4364
|
-
* @description Updates records from a table
|
|
4482
|
+
* @description Updates records from a table, you can use raw statements in the data object for literal references to other columns
|
|
4365
4483
|
* @returns the number of affected rows
|
|
4366
4484
|
*/
|
|
4367
|
-
update(data: Record<string,
|
|
4485
|
+
update(data: Record<string, WriteQueryParam$1>): Promise<number>;
|
|
4368
4486
|
/**
|
|
4369
4487
|
* @description Deletes all records from a table
|
|
4370
4488
|
* @warning This operation does not trigger any hook
|
|
@@ -4456,6 +4574,13 @@ declare class QueryBuilder<T extends Model = any> extends JsonQueryBuilder<T> {
|
|
|
4456
4574
|
*/
|
|
4457
4575
|
protected executePaginateQueries<M, C>(modelsQuery: () => Promise<M>, countQuery: () => Promise<C>): Promise<[M, C]>;
|
|
4458
4576
|
protected getSqlDataSource(mode: "read" | "write"): Promise<SqlDataSource>;
|
|
4577
|
+
/**
|
|
4578
|
+
* @description Executes SQL with slave failure handling
|
|
4579
|
+
* @param mode The operation mode (read or write)
|
|
4580
|
+
* @param operation The execSql operation to perform
|
|
4581
|
+
* @returns The result of the operation
|
|
4582
|
+
*/
|
|
4583
|
+
protected execSqlWithSlaveHandling<R>(mode: "read" | "write", operation: (dataSource: SqlDataSource) => Promise<R>): Promise<R>;
|
|
4459
4584
|
}
|
|
4460
4585
|
|
|
4461
4586
|
type UnionCallBack<T extends Model> = (queryBuilder: QueryBuilder<T>) => QueryBuilder<T>;
|
|
@@ -5934,4 +6059,4 @@ declare const generateOpenApiModelWithMetadata: <T extends new () => Model>(mode
|
|
|
5934
6059
|
$id?: string;
|
|
5935
6060
|
}>;
|
|
5936
6061
|
|
|
5937
|
-
export { type AdminJsActionOptions, type AdminJsAssets, type AdminJsBranding, type AdminJsInstance, type AdminJsLocale, type AdminJsOptions, type AdminJsPage, type AdminJsPropertyOptions, type AdminJsResourceOptions, type AdminJsSettings, type AnnotatedModel, type AsymmetricEncryptionOptions, AutogeneratedModel, type BaseModelMethodOptions, type BaseModelRelationType, type CacheAdapter, type CacheKeys, 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, InMemoryAdapter, type IndexType, type LazyRelationType, type ManyOptions, type ManyToManyOptions, type ManyToManyStringOptions, Migration, Model, type ModelInstanceType, ModelQueryBuilder, type ModelWithoutRelations, MongoDataSource, type MongoDataSourceInput$1 as MongoDataSourceInput, type MssqlConnectionInstance, type MssqlDataSourceInput, type MssqlPoolInstance, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullableOracleDBDataSourceInput, type NotNullableOracleMssqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NumberModelKey, type OneOptions, type OracleDBDataSourceInput, type OracleDBPoolInstance, type PgPoolClientInstance, type PostgresSqlDataSourceInput, QueryBuilder, type RawModelOptions, RawNode, type RawQueryOptions, RedisCacheAdapter, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationQueryBuilderType, type ReplicationType, type SlaveAlgorithm, type SqlCloneOptions, SqlDataSource, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDriverSpecificOptions, type SqlPoolType, type Sqlite3ConnectionOptions, type SqliteConnectionInstance, type SqliteDataSourceInput, type StartTransactionOptions, type SymmetricEncryptionOptions, type TableFormat, type ThroughModel, TimestampedModel, Transaction, type TransactionExecutionOptions, type UniqueType, type UseCacheReturnType, type UseConnectionInput, UserMixin, UuidModel, belongsTo, column, createModelFactory, defineMigrator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, getCollectionProperties, getIndexes, getModelColumns, type getPoolReturnType, getPrimaryKey, getRelations, getRelationsMetadata, getUniques, hasMany, hasOne, index, HysteriaLogger as logger, manyToMany, property, RedisDataSource as redis, unique, view, withPerformance };
|
|
6062
|
+
export { type AdminJsActionOptions, type AdminJsAssets, type AdminJsBranding, type AdminJsInstance, type AdminJsLocale, type AdminJsOptions, type AdminJsPage, type AdminJsPropertyOptions, type AdminJsResourceOptions, type AdminJsSettings, type AnnotatedModel, type AsymmetricEncryptionOptions, AutogeneratedModel, type BaseModelMethodOptions, type BaseModelRelationType, type CacheAdapter, type CacheKeys, 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, InMemoryAdapter, type IndexType, type LazyRelationType, type ManyOptions, type ManyToManyOptions, type ManyToManyStringOptions, Migration, type MigrationConfig, type MigrationConfigBase, Model, type ModelInstanceType, ModelQueryBuilder, type ModelWithoutRelations, MongoDataSource, type MongoDataSourceInput$1 as MongoDataSourceInput, type MssqlConnectionInstance, type MssqlDataSourceInput, type MssqlPoolInstance, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullableOracleDBDataSourceInput, type NotNullableOracleMssqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NumberModelKey, type OneOptions, type OracleDBDataSourceInput, type OracleDBPoolInstance, type PgPoolClientInstance, type PostgresSqlDataSourceInput, QueryBuilder, type RawModelOptions, RawNode, type RawQueryOptions, RedisCacheAdapter, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationQueryBuilderType, type ReplicationType, type SlaveAlgorithm, type SlaveContext, type SqlCloneOptions, SqlDataSource, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDriverSpecificOptions, type SqlPoolType, type Sqlite3ConnectionOptions, type SqliteConnectionInstance, type SqliteDataSourceInput, type StartTransactionOptions, type SymmetricEncryptionOptions, type TableFormat, type ThroughModel, TimestampedModel, Transaction, type TransactionExecutionOptions, type UniqueType, type UseCacheReturnType, type UseConnectionInput, UserMixin, UuidModel, belongsTo, column, createModelFactory, defineMigrator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, getCollectionProperties, getIndexes, getModelColumns, type getPoolReturnType, getPrimaryKey, getRelations, getRelationsMetadata, getUniques, hasMany, hasOne, index, HysteriaLogger as logger, manyToMany, property, RedisDataSource as redis, unique, view, withPerformance };
|
package/lib/index.d.ts
CHANGED
|
@@ -1107,10 +1107,46 @@ type ConnectionPolicies = {
|
|
|
1107
1107
|
};
|
|
1108
1108
|
};
|
|
1109
1109
|
type SqlDataSourceModel = typeof Model;
|
|
1110
|
+
/**
|
|
1111
|
+
* @description Base migration configuration options available for all databases
|
|
1112
|
+
*/
|
|
1113
|
+
type MigrationConfigBase = {
|
|
1114
|
+
/**
|
|
1115
|
+
* @description The path to the migrations folder, can be overridden in the cli command
|
|
1116
|
+
* @default "database/migrations"
|
|
1117
|
+
*/
|
|
1118
|
+
path?: string;
|
|
1119
|
+
/**
|
|
1120
|
+
* @description Path to the tsconfig.json file for TypeScript migration files, can be overridden in the cli command
|
|
1121
|
+
* @default "./tsconfig.json"
|
|
1122
|
+
*/
|
|
1123
|
+
tsconfig?: string;
|
|
1124
|
+
/**
|
|
1125
|
+
* @description Acquire advisory lock before running migrations to prevent concurrent execution, can be overridden in the cli command
|
|
1126
|
+
* @default true
|
|
1127
|
+
*/
|
|
1128
|
+
lock?: boolean;
|
|
1129
|
+
};
|
|
1130
|
+
/**
|
|
1131
|
+
* @description Migration configuration with transactional support for PostgreSQL and CockroachDB
|
|
1132
|
+
*/
|
|
1133
|
+
type MigrationConfigWithTransactional = MigrationConfigBase & {
|
|
1134
|
+
/**
|
|
1135
|
+
* @description Runs all pending migrations in a single transaction, can be overridden in the cli command
|
|
1136
|
+
* @default true
|
|
1137
|
+
* @note Only available for PostgreSQL and CockroachDB
|
|
1138
|
+
*/
|
|
1139
|
+
transactional?: boolean;
|
|
1140
|
+
};
|
|
1141
|
+
/**
|
|
1142
|
+
* @description Migration configuration type based on database type
|
|
1143
|
+
* @description Adds transactional option only for PostgreSQL and CockroachDB
|
|
1144
|
+
*/
|
|
1145
|
+
type MigrationConfig<D extends SqlDataSourceType = SqlDataSourceType> = D extends "postgres" | "cockroachdb" ? MigrationConfigWithTransactional : MigrationConfigBase;
|
|
1110
1146
|
/**
|
|
1111
1147
|
* @description Common input properties shared across all SqlDataSource types
|
|
1112
1148
|
*/
|
|
1113
|
-
type SqlDataSourceInputBase<T extends Record<string, SqlDataSourceModel> = {}, C extends CacheKeys = {}> = {
|
|
1149
|
+
type SqlDataSourceInputBase<T extends Record<string, SqlDataSourceModel> = {}, C extends CacheKeys = {}, D extends SqlDataSourceType = SqlDataSourceType> = {
|
|
1114
1150
|
/**
|
|
1115
1151
|
* @description Whether to log the sql queries and other debug information
|
|
1116
1152
|
*/
|
|
@@ -1129,10 +1165,9 @@ type SqlDataSourceInputBase<T extends Record<string, SqlDataSourceModel> = {}, C
|
|
|
1129
1165
|
*/
|
|
1130
1166
|
models?: T;
|
|
1131
1167
|
/**
|
|
1132
|
-
* @description
|
|
1133
|
-
* @default "database/migrations"
|
|
1168
|
+
* @description Migration configuration for the sql data source
|
|
1134
1169
|
*/
|
|
1135
|
-
|
|
1170
|
+
migrations?: MigrationConfig<D>;
|
|
1136
1171
|
/**
|
|
1137
1172
|
* @description The cache strategy to use for the sql data source, it's used to configure the cache strategy for the sql data source
|
|
1138
1173
|
*/
|
|
@@ -1150,11 +1185,19 @@ type SqlDataSourceInputBase<T extends Record<string, SqlDataSourceModel> = {}, C
|
|
|
1150
1185
|
* @description Maps a SqlDataSourceType to its corresponding input interface
|
|
1151
1186
|
*/
|
|
1152
1187
|
type MapSqlDataSourceTypeToInput<D extends SqlDataSourceType> = D extends "mysql" | "mariadb" ? MysqlSqlDataSourceInput : D extends "postgres" | "cockroachdb" ? PostgresSqlDataSourceInput : D extends "sqlite" ? SqliteDataSourceInput : D extends "mssql" ? MssqlDataSourceInput : D extends "oracledb" ? OracleDBDataSourceInput : never;
|
|
1188
|
+
type SlaveContext = {
|
|
1189
|
+
type: SqlDataSourceType;
|
|
1190
|
+
host: string;
|
|
1191
|
+
port: number;
|
|
1192
|
+
username: string;
|
|
1193
|
+
password: string;
|
|
1194
|
+
database: string;
|
|
1195
|
+
};
|
|
1153
1196
|
/**
|
|
1154
1197
|
* @description The input type for the SqlDataSource constructor
|
|
1155
1198
|
* @description The connectionPolicies object is used to configure the connection policies for the sql data source
|
|
1156
1199
|
*/
|
|
1157
|
-
type SqlDataSourceInput<D extends SqlDataSourceType = SqlDataSourceType, T extends Record<string, SqlDataSourceModel> = {}, C extends CacheKeys = {}> = SqlDataSourceInputBase<T, C> & {
|
|
1200
|
+
type SqlDataSourceInput<D extends SqlDataSourceType = SqlDataSourceType, T extends Record<string, SqlDataSourceModel> = {}, C extends CacheKeys = {}> = SqlDataSourceInputBase<T, C, D> & {
|
|
1158
1201
|
/**
|
|
1159
1202
|
* @description The type of the database to connect to
|
|
1160
1203
|
*/
|
|
@@ -1168,10 +1211,14 @@ type SqlDataSourceInput<D extends SqlDataSourceType = SqlDataSourceType, T exten
|
|
|
1168
1211
|
* @description The replication configuration for the sql data source, it's used to configure the replication for the sql data source
|
|
1169
1212
|
*/
|
|
1170
1213
|
replication?: {
|
|
1214
|
+
/**
|
|
1215
|
+
* @description The function to call when a slave server fails, if not provided an error will be thrown
|
|
1216
|
+
*/
|
|
1217
|
+
onSlaveServerFailure?: (error: Error, context: SlaveContext) => void | Promise<void>;
|
|
1171
1218
|
/**
|
|
1172
1219
|
* @description The slaves data sources to use for the sql data source, slaves are automatically used for read operations unless specified otherwise
|
|
1173
1220
|
*/
|
|
1174
|
-
slaves?: Omit<UseConnectionInput<D, T, C>, "slaves" | "models" | "cacheStrategy" | "adminJs" | "logs" | "queryFormatOptions" | "
|
|
1221
|
+
slaves?: Omit<UseConnectionInput<D, T, C>, "slaves" | "models" | "cacheStrategy" | "adminJs" | "logs" | "queryFormatOptions" | "migrations">[];
|
|
1175
1222
|
/**
|
|
1176
1223
|
* @description The algorithm to use for selecting the slave for read operations
|
|
1177
1224
|
* @default "roundRobin" - Distributes requests evenly across all slaves in sequence
|
|
@@ -1544,6 +1591,14 @@ declare class CreateTableBuilder extends BaseBuilder {
|
|
|
1544
1591
|
private sqlType;
|
|
1545
1592
|
constructor(sqlType: SqlDataSourceType, nodes: QueryNode[], tableName?: string, context?: "alter_table" | "create_table");
|
|
1546
1593
|
private build;
|
|
1594
|
+
/**
|
|
1595
|
+
* @description Adds a raw statement to an operation that will be executed as is
|
|
1596
|
+
* @example
|
|
1597
|
+
* ```ts
|
|
1598
|
+
* table.varchar("name").default(table.rawStatement("CURRENT_TIMESTAMP"));
|
|
1599
|
+
* ```
|
|
1600
|
+
*/
|
|
1601
|
+
rawStatement(value: string): RawNode;
|
|
1547
1602
|
/**
|
|
1548
1603
|
* Fixed-length character string
|
|
1549
1604
|
* @mysql Supported as CHAR(length)
|
|
@@ -1825,6 +1880,14 @@ declare class AlterTableBuilder extends BaseBuilder {
|
|
|
1825
1880
|
private table;
|
|
1826
1881
|
private sqlType;
|
|
1827
1882
|
constructor(table: string, nodes: QueryNode[], sqlType: SqlDataSourceType);
|
|
1883
|
+
/**
|
|
1884
|
+
* @description Adds a raw statement to an operation that will be executed as is
|
|
1885
|
+
* @example
|
|
1886
|
+
* ```ts
|
|
1887
|
+
* table.varchar("name").default(table.rawStatement("CURRENT_TIMESTAMP"));
|
|
1888
|
+
* ```
|
|
1889
|
+
*/
|
|
1890
|
+
rawStatement(value: string): RawNode;
|
|
1828
1891
|
/**
|
|
1829
1892
|
* @description Adds a column to the table
|
|
1830
1893
|
* @param cb is the callback that will be used to build the column
|
|
@@ -1918,6 +1981,17 @@ declare class Schema {
|
|
|
1918
1981
|
queryStatements: string[];
|
|
1919
1982
|
sqlType: SqlDataSourceType;
|
|
1920
1983
|
constructor(sqlType?: SqlDataSourceType);
|
|
1984
|
+
/**
|
|
1985
|
+
* @description Adds a raw statement to an operation that will be executed as is
|
|
1986
|
+
* @example
|
|
1987
|
+
* ```ts
|
|
1988
|
+
* schema.rawStatement("CURRENT_TIMESTAMP");
|
|
1989
|
+
* schema.alterTable("users", (table) => {
|
|
1990
|
+
* table.timestamp("created_at").default(this.schema.rawStatement("CURRENT_TIMESTAMP"));
|
|
1991
|
+
* });
|
|
1992
|
+
* ```
|
|
1993
|
+
*/
|
|
1994
|
+
rawStatement(value: string): RawNode;
|
|
1921
1995
|
/**
|
|
1922
1996
|
* @description Add raw query to the migration
|
|
1923
1997
|
*/
|
|
@@ -2037,7 +2111,7 @@ declare class DryQueryBuilder extends QueryBuilder {
|
|
|
2037
2111
|
* @warning This method does not run model or column hooks
|
|
2038
2112
|
* @returns The query builder
|
|
2039
2113
|
*/
|
|
2040
|
-
update(data: Record<string,
|
|
2114
|
+
update(data: Record<string, WriteQueryParam>): this;
|
|
2041
2115
|
/**
|
|
2042
2116
|
* @description Builds the delete query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
|
|
2043
2117
|
* @warning This method does not run model or column hooks
|
|
@@ -3107,6 +3181,7 @@ type UpsertOptionsRawBuilder = {
|
|
|
3107
3181
|
};
|
|
3108
3182
|
type DryQueryBuilderWithoutReadOperations = Omit<DryQueryBuilder, "many" | "one" | "oneOrFail" | "first" | "firstOrFail" | "paginate" | "paginateWithCursor" | "exists" | "pluck" | "increment" | "decrement" | "getSum" | "getAvg" | "getMin" | "getMax" | "getCount" | "stream" | "chunk" | "paginate" | "paginateWithCursor" | "exists">;
|
|
3109
3183
|
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">;
|
|
3184
|
+
type WriteQueryParam$1 = string | number | boolean | Date | RawNode | object | null | undefined;
|
|
3110
3185
|
|
|
3111
3186
|
declare class SqlModelManagerUtils<T extends Model> {
|
|
3112
3187
|
protected dbType: SqlDataSourceType;
|
|
@@ -3698,9 +3773,14 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
|
|
|
3698
3773
|
*/
|
|
3699
3774
|
cacheKeys: C;
|
|
3700
3775
|
/**
|
|
3701
|
-
* @description
|
|
3776
|
+
* @description Migration configuration for the sql data source
|
|
3702
3777
|
*/
|
|
3703
|
-
|
|
3778
|
+
migrationConfig: {
|
|
3779
|
+
path: string;
|
|
3780
|
+
tsconfig?: string;
|
|
3781
|
+
lock: boolean;
|
|
3782
|
+
transactional: boolean;
|
|
3783
|
+
};
|
|
3704
3784
|
/**
|
|
3705
3785
|
* @description AdminJS configuration options
|
|
3706
3786
|
*/
|
|
@@ -3709,6 +3789,14 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
|
|
|
3709
3789
|
* @description Cached AdminJS instance
|
|
3710
3790
|
*/
|
|
3711
3791
|
private adminJsInstance?;
|
|
3792
|
+
/**
|
|
3793
|
+
* @description Callback to handle slave server failures
|
|
3794
|
+
*/
|
|
3795
|
+
private onSlaveServerFailure?;
|
|
3796
|
+
/**
|
|
3797
|
+
* @description Returns the configured slave failure callback
|
|
3798
|
+
*/
|
|
3799
|
+
getOnSlaveServerFailure(): ((error: Error, context: SlaveContext) => void | Promise<void>) | undefined;
|
|
3712
3800
|
/**
|
|
3713
3801
|
* @description Returns the primary instance of the SqlDataSource (set via connect with setPrimary: true)
|
|
3714
3802
|
* All models by default will use this instance to execute queries unless you pass a different connection/transaction in the query options
|
|
@@ -3938,10 +4026,16 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
|
|
|
3938
4026
|
*/
|
|
3939
4027
|
rawQuery<R = RawQueryResponseType<D>>(query: string, params?: any[], options?: RawQueryOptions): Promise<R>;
|
|
3940
4028
|
/**
|
|
3941
|
-
* @description Adds a raw statement to an operation
|
|
4029
|
+
* @description Adds a raw statement to an operation that will be executed as is
|
|
3942
4030
|
* @example
|
|
3943
4031
|
* ```ts
|
|
3944
|
-
* await
|
|
4032
|
+
* await sql.query("users").where("name", sql.rawStatement("LOWER(name)"));
|
|
4033
|
+
* await sql.query("users").update({
|
|
4034
|
+
* name: sql.rawStatement("LOWER(name)"),
|
|
4035
|
+
* });
|
|
4036
|
+
* await sql.query("users").insert({
|
|
4037
|
+
* name: sql.rawStatement("LOWER(name)"),
|
|
4038
|
+
* });
|
|
3945
4039
|
* ```
|
|
3946
4040
|
*/
|
|
3947
4041
|
rawStatement(value: string): RawNode;
|
|
@@ -3995,6 +4089,30 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
|
|
|
3995
4089
|
* @description Introspects table primary key from the database
|
|
3996
4090
|
*/
|
|
3997
4091
|
getPrimaryKeyInfo(table: string): Promise<TablePrimaryKeyInfo | undefined>;
|
|
4092
|
+
/**
|
|
4093
|
+
* @description Acquires an advisory lock
|
|
4094
|
+
* @description Useful for preventing concurrent operations from running simultaneously
|
|
4095
|
+
* @param lockKey - The lock identifier (defaults to 'hysteria_lock')
|
|
4096
|
+
* @param timeoutMs - Maximum time to wait for lock in milliseconds (postgres/mssql only)
|
|
4097
|
+
* @returns true if lock was acquired, false otherwise
|
|
4098
|
+
*/
|
|
4099
|
+
acquireLock(lockKey?: string, timeoutMs?: number): Promise<boolean>;
|
|
4100
|
+
/**
|
|
4101
|
+
* @description Releases an advisory lock
|
|
4102
|
+
* @param lockKey - The lock identifier (defaults to 'hysteria_lock')
|
|
4103
|
+
* @returns true if lock was released, false otherwise
|
|
4104
|
+
*/
|
|
4105
|
+
releaseLock(lockKey?: string): Promise<boolean>;
|
|
4106
|
+
/**
|
|
4107
|
+
* @description Converts a string to a numeric lock ID for databases that require it
|
|
4108
|
+
*/
|
|
4109
|
+
private hashStringToLockId;
|
|
4110
|
+
/**
|
|
4111
|
+
* @description Executes an operation on a slave, handling failures with the configured callback
|
|
4112
|
+
* @param operation The operation to execute on the slave
|
|
4113
|
+
* @returns The result of the operation, or falls back to master if slave fails
|
|
4114
|
+
*/
|
|
4115
|
+
private executeOnSlave;
|
|
3998
4116
|
/**
|
|
3999
4117
|
* @description Internal method to establish connection without setting as primary instance
|
|
4000
4118
|
* @description Used by connectToSecondarySource and useConnection
|
|
@@ -4328,18 +4446,18 @@ declare class QueryBuilder<T extends Model = any> extends JsonQueryBuilder<T> {
|
|
|
4328
4446
|
*/
|
|
4329
4447
|
withMaterialized(alias: string, cb: (qb: QueryBuilder<T>) => void): this;
|
|
4330
4448
|
/**
|
|
4331
|
-
* @description Insert record into a table
|
|
4449
|
+
* @description Insert record into a table, you can use raw statements in the data object for literal references to other columns
|
|
4332
4450
|
* @param returning - The columns to return from the query, only supported by postgres and cockroachdb - default is "*"
|
|
4333
4451
|
* @returns raw driver response
|
|
4334
4452
|
*/
|
|
4335
|
-
insert(data: Record<string,
|
|
4453
|
+
insert(data: Record<string, WriteQueryParam$1>, returning?: string[]): Promise<T>;
|
|
4336
4454
|
/**
|
|
4337
4455
|
* @description Insert multiple records into a table
|
|
4338
4456
|
* @param returning - The columns to return from the query, only supported by postgres and cockroachdb - default is "*"
|
|
4339
4457
|
* @returns raw driver response
|
|
4340
4458
|
* @oracledb may do multiple inserts with auto-generated identity columns
|
|
4341
4459
|
*/
|
|
4342
|
-
insertMany(data: Record<string,
|
|
4460
|
+
insertMany(data: Record<string, WriteQueryParam$1>[], returning?: string[]): Promise<T[]>;
|
|
4343
4461
|
/**
|
|
4344
4462
|
* @description Updates or creates a new record using upsert functionality
|
|
4345
4463
|
* @param data The data to insert or update
|
|
@@ -4361,10 +4479,10 @@ declare class QueryBuilder<T extends Model = any> extends JsonQueryBuilder<T> {
|
|
|
4361
4479
|
*/
|
|
4362
4480
|
private executeMssqlMergeRaw;
|
|
4363
4481
|
/**
|
|
4364
|
-
* @description Updates records from a table
|
|
4482
|
+
* @description Updates records from a table, you can use raw statements in the data object for literal references to other columns
|
|
4365
4483
|
* @returns the number of affected rows
|
|
4366
4484
|
*/
|
|
4367
|
-
update(data: Record<string,
|
|
4485
|
+
update(data: Record<string, WriteQueryParam$1>): Promise<number>;
|
|
4368
4486
|
/**
|
|
4369
4487
|
* @description Deletes all records from a table
|
|
4370
4488
|
* @warning This operation does not trigger any hook
|
|
@@ -4456,6 +4574,13 @@ declare class QueryBuilder<T extends Model = any> extends JsonQueryBuilder<T> {
|
|
|
4456
4574
|
*/
|
|
4457
4575
|
protected executePaginateQueries<M, C>(modelsQuery: () => Promise<M>, countQuery: () => Promise<C>): Promise<[M, C]>;
|
|
4458
4576
|
protected getSqlDataSource(mode: "read" | "write"): Promise<SqlDataSource>;
|
|
4577
|
+
/**
|
|
4578
|
+
* @description Executes SQL with slave failure handling
|
|
4579
|
+
* @param mode The operation mode (read or write)
|
|
4580
|
+
* @param operation The execSql operation to perform
|
|
4581
|
+
* @returns The result of the operation
|
|
4582
|
+
*/
|
|
4583
|
+
protected execSqlWithSlaveHandling<R>(mode: "read" | "write", operation: (dataSource: SqlDataSource) => Promise<R>): Promise<R>;
|
|
4459
4584
|
}
|
|
4460
4585
|
|
|
4461
4586
|
type UnionCallBack<T extends Model> = (queryBuilder: QueryBuilder<T>) => QueryBuilder<T>;
|
|
@@ -5934,4 +6059,4 @@ declare const generateOpenApiModelWithMetadata: <T extends new () => Model>(mode
|
|
|
5934
6059
|
$id?: string;
|
|
5935
6060
|
}>;
|
|
5936
6061
|
|
|
5937
|
-
export { type AdminJsActionOptions, type AdminJsAssets, type AdminJsBranding, type AdminJsInstance, type AdminJsLocale, type AdminJsOptions, type AdminJsPage, type AdminJsPropertyOptions, type AdminJsResourceOptions, type AdminJsSettings, type AnnotatedModel, type AsymmetricEncryptionOptions, AutogeneratedModel, type BaseModelMethodOptions, type BaseModelRelationType, type CacheAdapter, type CacheKeys, 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, InMemoryAdapter, type IndexType, type LazyRelationType, type ManyOptions, type ManyToManyOptions, type ManyToManyStringOptions, Migration, Model, type ModelInstanceType, ModelQueryBuilder, type ModelWithoutRelations, MongoDataSource, type MongoDataSourceInput$1 as MongoDataSourceInput, type MssqlConnectionInstance, type MssqlDataSourceInput, type MssqlPoolInstance, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullableOracleDBDataSourceInput, type NotNullableOracleMssqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NumberModelKey, type OneOptions, type OracleDBDataSourceInput, type OracleDBPoolInstance, type PgPoolClientInstance, type PostgresSqlDataSourceInput, QueryBuilder, type RawModelOptions, RawNode, type RawQueryOptions, RedisCacheAdapter, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationQueryBuilderType, type ReplicationType, type SlaveAlgorithm, type SqlCloneOptions, SqlDataSource, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDriverSpecificOptions, type SqlPoolType, type Sqlite3ConnectionOptions, type SqliteConnectionInstance, type SqliteDataSourceInput, type StartTransactionOptions, type SymmetricEncryptionOptions, type TableFormat, type ThroughModel, TimestampedModel, Transaction, type TransactionExecutionOptions, type UniqueType, type UseCacheReturnType, type UseConnectionInput, UserMixin, UuidModel, belongsTo, column, createModelFactory, defineMigrator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, getCollectionProperties, getIndexes, getModelColumns, type getPoolReturnType, getPrimaryKey, getRelations, getRelationsMetadata, getUniques, hasMany, hasOne, index, HysteriaLogger as logger, manyToMany, property, RedisDataSource as redis, unique, view, withPerformance };
|
|
6062
|
+
export { type AdminJsActionOptions, type AdminJsAssets, type AdminJsBranding, type AdminJsInstance, type AdminJsLocale, type AdminJsOptions, type AdminJsPage, type AdminJsPropertyOptions, type AdminJsResourceOptions, type AdminJsSettings, type AnnotatedModel, type AsymmetricEncryptionOptions, AutogeneratedModel, type BaseModelMethodOptions, type BaseModelRelationType, type CacheAdapter, type CacheKeys, 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, InMemoryAdapter, type IndexType, type LazyRelationType, type ManyOptions, type ManyToManyOptions, type ManyToManyStringOptions, Migration, type MigrationConfig, type MigrationConfigBase, Model, type ModelInstanceType, ModelQueryBuilder, type ModelWithoutRelations, MongoDataSource, type MongoDataSourceInput$1 as MongoDataSourceInput, type MssqlConnectionInstance, type MssqlDataSourceInput, type MssqlPoolInstance, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullableOracleDBDataSourceInput, type NotNullableOracleMssqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NumberModelKey, type OneOptions, type OracleDBDataSourceInput, type OracleDBPoolInstance, type PgPoolClientInstance, type PostgresSqlDataSourceInput, QueryBuilder, type RawModelOptions, RawNode, type RawQueryOptions, RedisCacheAdapter, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationQueryBuilderType, type ReplicationType, type SlaveAlgorithm, type SlaveContext, type SqlCloneOptions, SqlDataSource, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDriverSpecificOptions, type SqlPoolType, type Sqlite3ConnectionOptions, type SqliteConnectionInstance, type SqliteDataSourceInput, type StartTransactionOptions, type SymmetricEncryptionOptions, type TableFormat, type ThroughModel, TimestampedModel, Transaction, type TransactionExecutionOptions, type UniqueType, type UseCacheReturnType, type UseConnectionInput, UserMixin, UuidModel, belongsTo, column, createModelFactory, defineMigrator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, getCollectionProperties, getIndexes, getModelColumns, type getPoolReturnType, getPrimaryKey, getRelations, getRelationsMetadata, getUniques, hasMany, hasOne, index, HysteriaLogger as logger, manyToMany, property, RedisDataSource as redis, unique, view, withPerformance };
|