hysteria-orm 10.7.4 → 10.7.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/lib/index.d.cts CHANGED
@@ -10,8 +10,8 @@ import { PoolConfig, PoolClient, QueryResult as QueryResult$1 } from 'pg';
10
10
  import * as mysql2_promise from 'mysql2/promise';
11
11
  import { PoolOptions, PoolConnection, QueryResult } from 'mysql2/promise';
12
12
  import { RedisOptions, Redis } from 'ioredis';
13
- import express from 'express';
14
13
  import { FormatOptionsWithLanguage } from 'sql-formatter';
14
+ import express from 'express';
15
15
  import { PassThrough } from 'node:stream';
16
16
 
17
17
  type CaseConvention = "camel" | "snake" | "preserve" | RegExp | ((column: string) => string);
@@ -949,6 +949,262 @@ type OpenApiModelPropertyType = {
949
949
  nullable?: boolean;
950
950
  };
951
951
 
952
+ interface CacheAdapter {
953
+ /**
954
+ * @description Gets a value from the cache
955
+ * @param key The key to get the value from
956
+ * @returns The value from the cache
957
+ */
958
+ get<T = void>(key: string): Promise<T>;
959
+ /**
960
+ * @description Sets a value in the cache
961
+ * @param key The key to set the value to
962
+ * @param data The value to set in the cache
963
+ * @param ttl The time to live for the value in milliseconds
964
+ */
965
+ set<T = any>(key: string, data: T, ttl?: number): Promise<void>;
966
+ /**
967
+ * @description Invalidates a value from the cache
968
+ * @param key The key to invalidate the value from
969
+ */
970
+ invalidate(key: string): Promise<void>;
971
+ /**
972
+ * @description Invalidates all values from the cache starting with the given key
973
+ * @param key The key to invalidate the values from
974
+ */
975
+ invalidateAll(key: string): Promise<void>;
976
+ /**
977
+ * @description Disconnects from the cache adapter if needed when the data source disconnects
978
+ */
979
+ disconnect?(): Promise<void>;
980
+ }
981
+
982
+ type CacheKeys = Record<string, (...args: any[]) => Promise<any> | any>;
983
+ type UseCacheReturnType<C extends CacheKeys, K extends keyof C> = K extends never ? never : Awaited<ReturnType<C[K]>>;
984
+
985
+ type Sqlite3ConnectionOptions = {
986
+ mode: number;
987
+ };
988
+ type SqlDriverSpecificOptions<T extends DataSourceType> = Omit<DriverSpecificOptions<T>, "mongoOptions" | "redisOptions">;
989
+ type MysqlConnectionInstance = Awaited<ReturnType<Mysql2Import["createPool"]>>;
990
+ type PgPoolClientInstance = InstanceType<PgImport["Pool"]>;
991
+ type SqliteConnectionInstance = InstanceType<Sqlite3Import["Database"]>;
992
+ type OracleDBPoolInstance = Pool;
993
+ type MssqlPoolInstance = InstanceType<MssqlImport["ConnectionPool"]>;
994
+ type MssqlConnectionInstance = Awaited<ReturnType<MssqlPoolInstance["connect"]>>;
995
+ type SqlPoolType = OracleDBPoolInstance | MysqlConnectionInstance | PgPoolClientInstance | SqliteConnectionInstance | MssqlPoolInstance;
996
+ /**
997
+ * @description The connection policies for the sql data source
998
+ * @default the connection policies are not set, so no query will be retried
999
+ */
1000
+ type ConnectionPolicies = {
1001
+ /**
1002
+ * @description The retry policy for the sql data source, it allows to retry a query if it fails
1003
+ */
1004
+ retry?: {
1005
+ maxRetries?: number;
1006
+ delay?: number;
1007
+ };
1008
+ };
1009
+ /**
1010
+ * Accepts both decorator-based model classes (`typeof Model` subclasses)
1011
+ * and programmatic models created via `defineModel`.
1012
+ */
1013
+ type SqlDataSourceModel = AnyModelConstructor;
1014
+ /**
1015
+ * @description Base migration configuration options available for all databases
1016
+ */
1017
+ type MigrationConfigBase = {
1018
+ /**
1019
+ * @description The path to the migrations folder, can be overridden in the cli command
1020
+ * @default "database/migrations"
1021
+ */
1022
+ path?: string;
1023
+ /**
1024
+ * @description Path to the tsconfig.json file for TypeScript migration files, can be overridden in the cli command
1025
+ * @default "./tsconfig.json"
1026
+ */
1027
+ tsconfig?: string;
1028
+ /**
1029
+ * @description Acquire advisory lock before running migrations to prevent concurrent execution, can be overridden in the cli command
1030
+ * @default true
1031
+ */
1032
+ lock?: boolean;
1033
+ /**
1034
+ * @description Lock timeout in milliseconds for migration advisory lock acquisition, can be overridden in the cli command
1035
+ * @default 30000
1036
+ */
1037
+ lockTimeout?: number;
1038
+ };
1039
+ /**
1040
+ * @description Migration configuration with transactional support for PostgreSQL and CockroachDB
1041
+ */
1042
+ type MigrationConfigWithTransactional = MigrationConfigBase & {
1043
+ /**
1044
+ * @description Runs all pending migrations in a single transaction, can be overridden in the cli command
1045
+ * @default true
1046
+ * @note Only available for PostgreSQL and CockroachDB
1047
+ */
1048
+ transactional?: boolean;
1049
+ };
1050
+ /**
1051
+ * @description Migration configuration type based on database type
1052
+ * @description Adds transactional option only for PostgreSQL and CockroachDB
1053
+ */
1054
+ type MigrationConfig<D extends SqlDataSourceType = SqlDataSourceType> = D extends "postgres" | "cockroachdb" ? MigrationConfigWithTransactional : MigrationConfigBase;
1055
+ /**
1056
+ * @description Seeder configuration options
1057
+ */
1058
+ type SeederConfig = {
1059
+ /**
1060
+ * @description The path to the seeders folder
1061
+ * @default "database/seeders"
1062
+ */
1063
+ path?: string;
1064
+ /**
1065
+ * @description Path to the tsconfig.json file for TypeScript seeder files
1066
+ * @default "./tsconfig.json"
1067
+ */
1068
+ tsconfig?: string;
1069
+ };
1070
+ /**
1071
+ * @description Common input properties shared across all SqlDataSource types
1072
+ */
1073
+ type SqlDataSourceInputBase<T extends Record<string, SqlDataSourceModel> = {}, C extends CacheKeys = {}, D extends SqlDataSourceType = SqlDataSourceType> = {
1074
+ /**
1075
+ * @description Whether to log the sql queries and other debug information. Can be a boolean or a LoggerConfig object for granular control.
1076
+ * @warning Logs are synchronous by default and add overhead — do not use in production unless you override with an async custom logger.
1077
+ * @default false
1078
+ */
1079
+ readonly logs?: boolean | LoggerConfig;
1080
+ /**
1081
+ * @description The connection policies to use for the sql data source that are not configured in the driverOptions
1082
+ */
1083
+ connectionPolicies?: ConnectionPolicies;
1084
+ /**
1085
+ * @description The query format options to use for the sql data source, it tells how the sql queries should be formatted before being executed and logged
1086
+ */
1087
+ queryFormatOptions?: FormatOptionsWithLanguage;
1088
+ /**
1089
+ * @description The models to use for the sql data source, if used models will be registered in the sql data source instance and will be available for the models to use
1090
+ * @description Models can still be used as standalone entities, but they won't be available for the sql data source instance
1091
+ */
1092
+ models?: T;
1093
+ /**
1094
+ * @description Migration configuration for the sql data source
1095
+ */
1096
+ migrations?: MigrationConfig<D>;
1097
+ /**
1098
+ * @description Seeder configuration for the sql data source
1099
+ */
1100
+ seeders?: SeederConfig;
1101
+ /**
1102
+ * @description The cache strategy to use for the sql data source, it's used to configure the cache strategy for the sql data source
1103
+ */
1104
+ cacheStrategy?: {
1105
+ cacheAdapter?: CacheAdapter;
1106
+ keys: C;
1107
+ };
1108
+ /**
1109
+ * @description AdminJS configuration for the admin panel
1110
+ * @description To use AdminJS, install: `npm install adminjs`
1111
+ */
1112
+ adminJs?: AdminJsOptions;
1113
+ };
1114
+ /**
1115
+ * @description Maps a SqlDataSourceType to its corresponding input interface
1116
+ */
1117
+ 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;
1118
+ type SlaveContext = {
1119
+ type: SqlDataSourceType;
1120
+ host: string;
1121
+ port: number;
1122
+ username: string;
1123
+ password: string;
1124
+ database: string;
1125
+ };
1126
+ /**
1127
+ * @description The input type for the SqlDataSource constructor
1128
+ * @description The connectionPolicies object is used to configure the connection policies for the sql data source
1129
+ */
1130
+ type SqlDataSourceInput<D extends SqlDataSourceType = SqlDataSourceType, T extends Record<string, SqlDataSourceModel> = {}, C extends CacheKeys = {}> = SqlDataSourceInputBase<T, C, D> & {
1131
+ /**
1132
+ * @description The type of the database to connect to
1133
+ */
1134
+ readonly type: D;
1135
+ /**
1136
+ * @description The driver specific options to use for the sql data source, it's used to configure the driver specific options for the sql data source
1137
+ * @warning For usage with types, you must have driver types installed if the driver handles types in a type package like e.g. `@types/pg`
1138
+ */
1139
+ driverOptions?: SqlDriverSpecificOptions<D>;
1140
+ /**
1141
+ * @description The replication configuration for the sql data source, it's used to configure the replication for the sql data source
1142
+ */
1143
+ replication?: {
1144
+ /**
1145
+ * @description The function to call when a slave server fails, if not provided an error will be thrown
1146
+ */
1147
+ onSlaveServerFailure?: (error: Error, context: SlaveContext) => void | Promise<void>;
1148
+ /**
1149
+ * @description The slaves data sources to use for the sql data source, slaves are automatically used for read operations unless specified otherwise
1150
+ */
1151
+ slaves?: Omit<UseConnectionInput<D, T, C>, "slaves" | "models" | "cacheStrategy" | "adminJs" | "logs" | "queryFormatOptions" | "migrations">[];
1152
+ /**
1153
+ * @description The algorithm to use for selecting the slave for read operations
1154
+ * @default "roundRobin" - Distributes requests evenly across all slaves in sequence
1155
+ * @option "random" - Randomly selects a slave for each request
1156
+ */
1157
+ slaveAlgorithm?: SlaveAlgorithm;
1158
+ };
1159
+ } & Omit<MapSqlDataSourceTypeToInput<D>, "type">;
1160
+ /**
1161
+ * @description Maps a SqlDataSourceType to its corresponding non-nullable input interface
1162
+ */
1163
+ type MapSqlDataSourceTypeToNotNullableInput<D extends SqlDataSourceType> = D extends "mysql" | "mariadb" ? NotNullableMysqlSqlDataSourceInput : D extends "postgres" | "cockroachdb" ? NotNullablePostgresSqlDataSourceInput : D extends "sqlite" ? NotNullableSqliteDataSourceInput : D extends "mssql" ? NotNullableOracleMssqlDataSourceInput : D extends "oracledb" ? NotNullableOracleDBDataSourceInput : never;
1164
+ type UseConnectionInput<D extends SqlDataSourceType = SqlDataSourceType, T extends Record<string, SqlDataSourceModel> = {}, C extends CacheKeys = {}> = {
1165
+ /**
1166
+ * @description The type of the database to connect to
1167
+ */
1168
+ readonly type: D;
1169
+ readonly logs?: boolean | LoggerConfig;
1170
+ readonly models?: T;
1171
+ readonly driverOptions?: SqlDriverSpecificOptions<D>;
1172
+ connectionPolicies?: ConnectionPolicies;
1173
+ queryFormatOptions?: FormatOptionsWithLanguage;
1174
+ cacheStrategy?: {
1175
+ cacheAdapter: CacheAdapter;
1176
+ keys: C;
1177
+ };
1178
+ /**
1179
+ * @description AdminJS configuration for the admin panel
1180
+ * @description AdminJS is completely optional - dependencies are loaded at runtime via dynamic import()
1181
+ */
1182
+ adminJs?: AdminJsOptions;
1183
+ } & Omit<MapSqlDataSourceTypeToNotNullableInput<D>, "type">;
1184
+ type SqlDataSourceType = Exclude<DataSourceType, "mongo">;
1185
+ type SqlCloneOptions = {
1186
+ /**
1187
+ * @description Whether to recreate the pool of connections for the given driver, by default it's false
1188
+ * @warning If false, the pool of connections will be reused from the caller instance
1189
+ */
1190
+ shouldRecreatePool?: boolean;
1191
+ };
1192
+ type getPoolReturnType<T = SqlDataSourceType> = T extends "mysql" ? MysqlConnectionInstance : T extends "mariadb" ? MysqlConnectionInstance : T extends "postgres" ? PgPoolClientInstance : T extends "cockroachdb" ? PgPoolClientInstance : T extends "sqlite" ? SqliteConnectionInstance : T extends "mssql" ? MssqlPoolInstance : T extends "oracledb" ? OracleDBPoolInstance : never;
1193
+ type GetConnectionReturnType<T = SqlDataSourceType> = T extends "mysql" ? PoolConnection : T extends "mariadb" ? PoolConnection : T extends "postgres" ? PoolClient : T extends "cockroachdb" ? PoolClient : T extends "sqlite" ? InstanceType<Sqlite3Import["Database"]> : T extends "mssql" ? Transaction$1 : T extends "oracledb" ? Connection : never;
1194
+ /** Only accepts formats `string` e `string as string` */
1195
+ type NoSpace<S extends string> = S extends `${infer _} ${infer _}` ? never : S;
1196
+ type TableFormat<S extends string> = NoSpace<S> | (S extends `${infer L} as ${infer R}` ? `${NoSpace<L>} as ${NoSpace<R>}` : never);
1197
+ type ReplicationType = "master" | "slave";
1198
+ /**
1199
+ * @description Algorithm for selecting a slave database for read operations
1200
+ * @option "roundRobin" - Distributes requests evenly across all slaves in sequence
1201
+ * @option "random" - Randomly selects a slave for each request
1202
+ */
1203
+ type SlaveAlgorithm = "roundRobin" | "random";
1204
+ type RawQueryOptions = {
1205
+ replicationMode?: ReplicationType;
1206
+ };
1207
+
952
1208
  /**
953
1209
  * @description AdminJS plugin types - All AdminJS imports are done at runtime via dynamic import()
954
1210
  * @description This ensures the plugin is completely optional
@@ -976,7 +1232,7 @@ type AdminJsOptions = {
976
1232
  * @description Models to expose in the AdminJS panel
977
1233
  * @description If not provided, all models registered in the SqlDataSource will be used
978
1234
  */
979
- resources?: (typeof Model)[];
1235
+ resources?: SqlDataSourceModel[];
980
1236
  /**
981
1237
  * @description Custom resource options for specific models
982
1238
  */
@@ -1179,382 +1435,130 @@ type AdminJsActionOptions = {
1179
1435
  /**
1180
1436
  * @description Custom component for the action
1181
1437
  */
1182
- component?: string | false;
1183
- /**
1184
- * @description Container width for the action
1185
- */
1186
- containerWidth?: number | string;
1187
- /**
1188
- * @description Layout configuration
1189
- */
1190
- layout?: unknown[];
1191
- };
1192
- type AdminJsLocale = {
1193
- /**
1194
- * @description Language code
1195
- */
1196
- language?: string;
1197
- /**
1198
- * @description Available languages
1199
- */
1200
- availableLanguages?: string[];
1201
- /**
1202
- * @description Custom translations
1203
- */
1204
- translations?: Record<string, Record<string, unknown>>;
1205
- /**
1206
- * @description Whether to show the language selector
1207
- */
1208
- withBackend?: boolean;
1209
- };
1210
- type AdminJsAssets = {
1211
- /**
1212
- * @description Custom styles to include
1213
- */
1214
- styles?: string[];
1215
- /**
1216
- * @description Custom scripts to include
1217
- */
1218
- scripts?: string[];
1219
- };
1220
- type AdminJsSettings = {
1221
- /**
1222
- * @description Default number of items per page
1223
- */
1224
- defaultPerPage?: number;
1225
- };
1226
- type AdminJsPage = {
1227
- /**
1228
- * @description Page component path
1229
- */
1230
- component?: string;
1231
- /**
1232
- * @description Page icon
1233
- */
1234
- icon?: string;
1235
- /**
1236
- * @description Handler for the page
1237
- */
1238
- handler?: (request: unknown, response: unknown, context: unknown) => Promise<unknown>;
1239
- };
1240
- type AdminJsAdminInstance = {
1241
- options: {
1242
- rootPath: string;
1243
- [key: string]: unknown;
1244
- };
1245
- watch: () => Promise<void>;
1246
- initialize: () => Promise<void>;
1247
- resources: unknown[];
1248
- findResource: (resourceId: string) => unknown;
1249
- };
1250
- /**
1251
- * @description Return type for getAdminJs method
1252
- */
1253
- type AdminJsInstance = {
1254
- /**
1255
- * @description The AdminJS instance
1256
- */
1257
- admin: AdminJsAdminInstance;
1258
- /**
1259
- * @description Express router for AdminJS (if using express adapter)
1260
- */
1261
- router?: ReturnType<typeof express.Router>;
1262
- };
1263
-
1264
- interface CacheAdapter {
1265
- /**
1266
- * @description Gets a value from the cache
1267
- * @param key The key to get the value from
1268
- * @returns The value from the cache
1269
- */
1270
- get<T = void>(key: string): Promise<T>;
1271
- /**
1272
- * @description Sets a value in the cache
1273
- * @param key The key to set the value to
1274
- * @param data The value to set in the cache
1275
- * @param ttl The time to live for the value in milliseconds
1276
- */
1277
- set<T = any>(key: string, data: T, ttl?: number): Promise<void>;
1278
- /**
1279
- * @description Invalidates a value from the cache
1280
- * @param key The key to invalidate the value from
1281
- */
1282
- invalidate(key: string): Promise<void>;
1283
- /**
1284
- * @description Invalidates all values from the cache starting with the given key
1285
- * @param key The key to invalidate the values from
1286
- */
1287
- invalidateAll(key: string): Promise<void>;
1288
- /**
1289
- * @description Disconnects from the cache adapter if needed when the data source disconnects
1290
- */
1291
- disconnect?(): Promise<void>;
1292
- }
1293
-
1294
- type CacheKeys = Record<string, (...args: any[]) => Promise<any> | any>;
1295
- type UseCacheReturnType<C extends CacheKeys, K extends keyof C> = K extends never ? never : Awaited<ReturnType<C[K]>>;
1296
-
1297
- declare abstract class QueryNode {
1298
- /**
1299
- * Sql keyword to use for the query e.g. "select"
1300
- */
1301
- keyword: string;
1302
- /**
1303
- * The current parameter index to use for the query
1304
- */
1305
- currParamIndex: number;
1306
- /**
1307
- * Whether the query node is a raw value and should not be parsed by the interpreter
1308
- */
1309
- isRawValue: boolean;
1310
- /**
1311
- * Whether the keyword can be seen multiple times in the query, e.g. "join" can be seen multiple times in a query
1312
- */
1313
- abstract canKeywordBeSeenMultipleTimes: boolean;
1314
- /**
1315
- * The string to use to chain the keyword with the next keyword
1316
- */
1317
- abstract chainsWith: string;
1318
- /**
1319
- * The folder to use for the query node, e.g. "select" is in the "select" folder inside the interpreter map
1320
- */
1321
- abstract folder: string;
1322
- /**
1323
- * The file to use for the query node, e.g. "select" is in the "select" file inside the interpreter map
1324
- */
1325
- abstract file: string;
1326
- constructor(keyword: string, isRawValue?: boolean);
1327
- }
1328
-
1329
- declare class RawNode extends QueryNode {
1330
- rawValue: string;
1331
- canKeywordBeSeenMultipleTimes: boolean;
1332
- chainsWith: string;
1333
- currParamIndex: number;
1334
- isRawValue: boolean;
1335
- folder: string;
1336
- file: string;
1337
- constructor(value: string);
1338
- }
1339
-
1340
- type Sqlite3ConnectionOptions = {
1341
- mode: number;
1342
- };
1343
- type SqlDriverSpecificOptions<T extends DataSourceType> = Omit<DriverSpecificOptions<T>, "mongoOptions" | "redisOptions">;
1344
- type MysqlConnectionInstance = Awaited<ReturnType<Mysql2Import["createPool"]>>;
1345
- type PgPoolClientInstance = InstanceType<PgImport["Pool"]>;
1346
- type SqliteConnectionInstance = InstanceType<Sqlite3Import["Database"]>;
1347
- type OracleDBPoolInstance = Pool;
1348
- type MssqlPoolInstance = InstanceType<MssqlImport["ConnectionPool"]>;
1349
- type MssqlConnectionInstance = Awaited<ReturnType<MssqlPoolInstance["connect"]>>;
1350
- type SqlPoolType = OracleDBPoolInstance | MysqlConnectionInstance | PgPoolClientInstance | SqliteConnectionInstance | MssqlPoolInstance;
1351
- /**
1352
- * @description The connection policies for the sql data source
1353
- * @default the connection policies are not set, so no query will be retried
1354
- */
1355
- type ConnectionPolicies = {
1356
- /**
1357
- * @description The retry policy for the sql data source, it allows to retry a query if it fails
1358
- */
1359
- retry?: {
1360
- maxRetries?: number;
1361
- delay?: number;
1362
- };
1363
- };
1364
- type SqlDataSourceModel = typeof Model;
1365
- /**
1366
- * @description Base migration configuration options available for all databases
1367
- */
1368
- type MigrationConfigBase = {
1369
- /**
1370
- * @description The path to the migrations folder, can be overridden in the cli command
1371
- * @default "database/migrations"
1372
- */
1373
- path?: string;
1374
- /**
1375
- * @description Path to the tsconfig.json file for TypeScript migration files, can be overridden in the cli command
1376
- * @default "./tsconfig.json"
1377
- */
1378
- tsconfig?: string;
1379
- /**
1380
- * @description Acquire advisory lock before running migrations to prevent concurrent execution, can be overridden in the cli command
1381
- * @default true
1382
- */
1383
- lock?: boolean;
1384
- /**
1385
- * @description Lock timeout in milliseconds for migration advisory lock acquisition, can be overridden in the cli command
1386
- * @default 30000
1387
- */
1388
- lockTimeout?: number;
1389
- };
1390
- /**
1391
- * @description Migration configuration with transactional support for PostgreSQL and CockroachDB
1392
- */
1393
- type MigrationConfigWithTransactional = MigrationConfigBase & {
1394
- /**
1395
- * @description Runs all pending migrations in a single transaction, can be overridden in the cli command
1396
- * @default true
1397
- * @note Only available for PostgreSQL and CockroachDB
1398
- */
1399
- transactional?: boolean;
1400
- };
1401
- /**
1402
- * @description Migration configuration type based on database type
1403
- * @description Adds transactional option only for PostgreSQL and CockroachDB
1404
- */
1405
- type MigrationConfig<D extends SqlDataSourceType = SqlDataSourceType> = D extends "postgres" | "cockroachdb" ? MigrationConfigWithTransactional : MigrationConfigBase;
1406
- /**
1407
- * @description Seeder configuration options
1408
- */
1409
- type SeederConfig = {
1438
+ component?: string | false;
1410
1439
  /**
1411
- * @description The path to the seeders folder
1412
- * @default "database/seeders"
1440
+ * @description Container width for the action
1413
1441
  */
1414
- path?: string;
1442
+ containerWidth?: number | string;
1415
1443
  /**
1416
- * @description Path to the tsconfig.json file for TypeScript seeder files
1417
- * @default "./tsconfig.json"
1444
+ * @description Layout configuration
1418
1445
  */
1419
- tsconfig?: string;
1446
+ layout?: unknown[];
1420
1447
  };
1421
- /**
1422
- * @description Common input properties shared across all SqlDataSource types
1423
- */
1424
- type SqlDataSourceInputBase<T extends Record<string, SqlDataSourceModel> = {}, C extends CacheKeys = {}, D extends SqlDataSourceType = SqlDataSourceType> = {
1448
+ type AdminJsLocale = {
1425
1449
  /**
1426
- * @description Whether to log the sql queries and other debug information. Can be a boolean or a LoggerConfig object for granular control.
1427
- * @warning Logs are synchronous by default and add overhead — do not use in production unless you override with an async custom logger.
1428
- * @default false
1450
+ * @description Language code
1429
1451
  */
1430
- readonly logs?: boolean | LoggerConfig;
1452
+ language?: string;
1431
1453
  /**
1432
- * @description The connection policies to use for the sql data source that are not configured in the driverOptions
1454
+ * @description Available languages
1433
1455
  */
1434
- connectionPolicies?: ConnectionPolicies;
1456
+ availableLanguages?: string[];
1435
1457
  /**
1436
- * @description The query format options to use for the sql data source, it tells how the sql queries should be formatted before being executed and logged
1458
+ * @description Custom translations
1437
1459
  */
1438
- queryFormatOptions?: FormatOptionsWithLanguage;
1460
+ translations?: Record<string, Record<string, unknown>>;
1439
1461
  /**
1440
- * @description The models to use for the sql data source, if used models will be registered in the sql data source instance and will be available for the models to use
1441
- * @description Models can still be used as standalone entities, but they won't be available for the sql data source instance
1462
+ * @description Whether to show the language selector
1442
1463
  */
1443
- models?: T;
1464
+ withBackend?: boolean;
1465
+ };
1466
+ type AdminJsAssets = {
1444
1467
  /**
1445
- * @description Migration configuration for the sql data source
1468
+ * @description Custom styles to include
1446
1469
  */
1447
- migrations?: MigrationConfig<D>;
1470
+ styles?: string[];
1448
1471
  /**
1449
- * @description Seeder configuration for the sql data source
1472
+ * @description Custom scripts to include
1450
1473
  */
1451
- seeders?: SeederConfig;
1474
+ scripts?: string[];
1475
+ };
1476
+ type AdminJsSettings = {
1452
1477
  /**
1453
- * @description The cache strategy to use for the sql data source, it's used to configure the cache strategy for the sql data source
1478
+ * @description Default number of items per page
1454
1479
  */
1455
- cacheStrategy?: {
1456
- cacheAdapter?: CacheAdapter;
1457
- keys: C;
1458
- };
1480
+ defaultPerPage?: number;
1481
+ };
1482
+ type AdminJsPage = {
1459
1483
  /**
1460
- * @description AdminJS configuration for the admin panel
1461
- * @description To use AdminJS, install: `npm install adminjs`
1484
+ * @description Page component path
1462
1485
  */
1463
- adminJs?: AdminJsOptions;
1486
+ component?: string;
1487
+ /**
1488
+ * @description Page icon
1489
+ */
1490
+ icon?: string;
1491
+ /**
1492
+ * @description Handler for the page
1493
+ */
1494
+ handler?: (request: unknown, response: unknown, context: unknown) => Promise<unknown>;
1464
1495
  };
1465
- /**
1466
- * @description Maps a SqlDataSourceType to its corresponding input interface
1467
- */
1468
- 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;
1469
- type SlaveContext = {
1470
- type: SqlDataSourceType;
1471
- host: string;
1472
- port: number;
1473
- username: string;
1474
- password: string;
1475
- database: string;
1496
+ type AdminJsAdminInstance = {
1497
+ options: {
1498
+ rootPath: string;
1499
+ [key: string]: unknown;
1500
+ };
1501
+ watch: () => Promise<void>;
1502
+ initialize: () => Promise<void>;
1503
+ resources: unknown[];
1504
+ findResource: (resourceId: string) => unknown;
1476
1505
  };
1477
1506
  /**
1478
- * @description The input type for the SqlDataSource constructor
1479
- * @description The connectionPolicies object is used to configure the connection policies for the sql data source
1507
+ * @description Return type for getAdminJs method
1480
1508
  */
1481
- type SqlDataSourceInput<D extends SqlDataSourceType = SqlDataSourceType, T extends Record<string, SqlDataSourceModel> = {}, C extends CacheKeys = {}> = SqlDataSourceInputBase<T, C, D> & {
1509
+ type AdminJsInstance = {
1482
1510
  /**
1483
- * @description The type of the database to connect to
1511
+ * @description The AdminJS instance
1484
1512
  */
1485
- readonly type: D;
1513
+ admin: AdminJsAdminInstance;
1486
1514
  /**
1487
- * @description The driver specific options to use for the sql data source, it's used to configure the driver specific options for the sql data source
1488
- * @warning For usage with types, you must have driver types installed if the driver handles types in a type package like e.g. `@types/pg`
1515
+ * @description Express router for AdminJS (if using express adapter)
1489
1516
  */
1490
- driverOptions?: SqlDriverSpecificOptions<D>;
1517
+ router?: ReturnType<typeof express.Router>;
1518
+ };
1519
+
1520
+ declare abstract class QueryNode {
1491
1521
  /**
1492
- * @description The replication configuration for the sql data source, it's used to configure the replication for the sql data source
1522
+ * Sql keyword to use for the query e.g. "select"
1493
1523
  */
1494
- replication?: {
1495
- /**
1496
- * @description The function to call when a slave server fails, if not provided an error will be thrown
1497
- */
1498
- onSlaveServerFailure?: (error: Error, context: SlaveContext) => void | Promise<void>;
1499
- /**
1500
- * @description The slaves data sources to use for the sql data source, slaves are automatically used for read operations unless specified otherwise
1501
- */
1502
- slaves?: Omit<UseConnectionInput<D, T, C>, "slaves" | "models" | "cacheStrategy" | "adminJs" | "logs" | "queryFormatOptions" | "migrations">[];
1503
- /**
1504
- * @description The algorithm to use for selecting the slave for read operations
1505
- * @default "roundRobin" - Distributes requests evenly across all slaves in sequence
1506
- * @option "random" - Randomly selects a slave for each request
1507
- */
1508
- slaveAlgorithm?: SlaveAlgorithm;
1509
- };
1510
- } & Omit<MapSqlDataSourceTypeToInput<D>, "type">;
1511
- /**
1512
- * @description Maps a SqlDataSourceType to its corresponding non-nullable input interface
1513
- */
1514
- type MapSqlDataSourceTypeToNotNullableInput<D extends SqlDataSourceType> = D extends "mysql" | "mariadb" ? NotNullableMysqlSqlDataSourceInput : D extends "postgres" | "cockroachdb" ? NotNullablePostgresSqlDataSourceInput : D extends "sqlite" ? NotNullableSqliteDataSourceInput : D extends "mssql" ? NotNullableOracleMssqlDataSourceInput : D extends "oracledb" ? NotNullableOracleDBDataSourceInput : never;
1515
- type UseConnectionInput<D extends SqlDataSourceType = SqlDataSourceType, T extends Record<string, SqlDataSourceModel> = {}, C extends CacheKeys = {}> = {
1524
+ keyword: string;
1516
1525
  /**
1517
- * @description The type of the database to connect to
1526
+ * The current parameter index to use for the query
1518
1527
  */
1519
- readonly type: D;
1520
- readonly logs?: boolean | LoggerConfig;
1521
- readonly models?: T;
1522
- readonly driverOptions?: SqlDriverSpecificOptions<D>;
1523
- connectionPolicies?: ConnectionPolicies;
1524
- queryFormatOptions?: FormatOptionsWithLanguage;
1525
- cacheStrategy?: {
1526
- cacheAdapter: CacheAdapter;
1527
- keys: C;
1528
- };
1528
+ currParamIndex: number;
1529
1529
  /**
1530
- * @description AdminJS configuration for the admin panel
1531
- * @description AdminJS is completely optional - dependencies are loaded at runtime via dynamic import()
1530
+ * Whether the query node is a raw value and should not be parsed by the interpreter
1532
1531
  */
1533
- adminJs?: AdminJsOptions;
1534
- } & Omit<MapSqlDataSourceTypeToNotNullableInput<D>, "type">;
1535
- type SqlDataSourceType = Exclude<DataSourceType, "mongo">;
1536
- type SqlCloneOptions = {
1532
+ isRawValue: boolean;
1537
1533
  /**
1538
- * @description Whether to recreate the pool of connections for the given driver, by default it's false
1539
- * @warning If false, the pool of connections will be reused from the caller instance
1534
+ * Whether the keyword can be seen multiple times in the query, e.g. "join" can be seen multiple times in a query
1540
1535
  */
1541
- shouldRecreatePool?: boolean;
1542
- };
1543
- type getPoolReturnType<T = SqlDataSourceType> = T extends "mysql" ? MysqlConnectionInstance : T extends "mariadb" ? MysqlConnectionInstance : T extends "postgres" ? PgPoolClientInstance : T extends "cockroachdb" ? PgPoolClientInstance : T extends "sqlite" ? SqliteConnectionInstance : T extends "mssql" ? MssqlPoolInstance : T extends "oracledb" ? OracleDBPoolInstance : never;
1544
- type GetConnectionReturnType<T = SqlDataSourceType> = T extends "mysql" ? PoolConnection : T extends "mariadb" ? PoolConnection : T extends "postgres" ? PoolClient : T extends "cockroachdb" ? PoolClient : T extends "sqlite" ? InstanceType<Sqlite3Import["Database"]> : T extends "mssql" ? Transaction$1 : T extends "oracledb" ? Connection : never;
1545
- /** Only accepts formats `string` e `string as string` */
1546
- type NoSpace<S extends string> = S extends `${infer _} ${infer _}` ? never : S;
1547
- type TableFormat<S extends string> = NoSpace<S> | (S extends `${infer L} as ${infer R}` ? `${NoSpace<L>} as ${NoSpace<R>}` : never);
1548
- type ReplicationType = "master" | "slave";
1549
- /**
1550
- * @description Algorithm for selecting a slave database for read operations
1551
- * @option "roundRobin" - Distributes requests evenly across all slaves in sequence
1552
- * @option "random" - Randomly selects a slave for each request
1553
- */
1554
- type SlaveAlgorithm = "roundRobin" | "random";
1555
- type RawQueryOptions = {
1556
- replicationMode?: ReplicationType;
1557
- };
1536
+ abstract canKeywordBeSeenMultipleTimes: boolean;
1537
+ /**
1538
+ * The string to use to chain the keyword with the next keyword
1539
+ */
1540
+ abstract chainsWith: string;
1541
+ /**
1542
+ * The folder to use for the query node, e.g. "select" is in the "select" folder inside the interpreter map
1543
+ */
1544
+ abstract folder: string;
1545
+ /**
1546
+ * The file to use for the query node, e.g. "select" is in the "select" file inside the interpreter map
1547
+ */
1548
+ abstract file: string;
1549
+ constructor(keyword: string, isRawValue?: boolean);
1550
+ }
1551
+
1552
+ declare class RawNode extends QueryNode {
1553
+ rawValue: string;
1554
+ canKeywordBeSeenMultipleTimes: boolean;
1555
+ chainsWith: string;
1556
+ currParamIndex: number;
1557
+ isRawValue: boolean;
1558
+ folder: string;
1559
+ file: string;
1560
+ constructor(value: string);
1561
+ }
1558
1562
 
1559
1563
  declare abstract class BaseBuilder {
1560
1564
  protected nodes: QueryNode[];
@@ -3163,7 +3167,7 @@ type ColumnDataTypeOption = ColumnDataTypeOptionWithLength | ColumnDataTypeOptio
3163
3167
  type LazyRelationType = {
3164
3168
  type?: RelationEnum;
3165
3169
  columnName: string;
3166
- model: () => typeof Model;
3170
+ model: () => AnyModelConstructor;
3167
3171
  foreignKey: string | (() => string);
3168
3172
  constraintName: string | (() => string);
3169
3173
  onDelete?: OnUpdateOrDelete;
@@ -3309,11 +3313,11 @@ type ColumnType = {
3309
3313
  default?: string | number | null | boolean;
3310
3314
  };
3311
3315
  };
3312
- type ThroughModelCallback<T extends typeof Model> = () => T;
3316
+ type ThroughModelCallback<T extends AnyModelConstructor> = () => T;
3313
3317
  type ThroughModelString = string;
3314
- type ThroughModel<T extends typeof Model> = ThroughModelCallback<T> | ThroughModelString;
3318
+ type ThroughModel<T extends AnyModelConstructor> = ThroughModelCallback<T> | ThroughModelString;
3315
3319
  type ExtractModelFromTM<TM extends ThroughModel<any>> = TM extends ThroughModelCallback<infer T> ? T : never;
3316
- type ManyToManyOptions<T extends typeof Model, TM extends ThroughModel<T>> = {
3320
+ type ManyToManyOptions<T extends AnyModelConstructor, TM extends ThroughModel<T>> = {
3317
3321
  /**
3318
3322
  * @description The foreign key of current model on the Pivot table
3319
3323
  * @example If the current model is User and the through model is UserAddress, the leftForeignKey will be "userId"
@@ -3659,12 +3663,12 @@ declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string
3659
3663
  */
3660
3664
  innerJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType): this;
3661
3665
  innerJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType): this;
3662
- innerJoin<R extends typeof Model>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator?: BinaryOperatorType): this;
3663
- innerJoin<R extends typeof Model>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn?: ModelKey<T>, operator?: BinaryOperatorType): this;
3666
+ innerJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator?: BinaryOperatorType): this;
3667
+ innerJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn?: ModelKey<T>, operator?: BinaryOperatorType): this;
3664
3668
  innerJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator: BinaryOperatorType, callback: JoinOnCallback): this;
3665
3669
  innerJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, callback: JoinOnCallback): this;
3666
- innerJoin<R extends typeof Model>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator: BinaryOperatorType, callback: JoinOnCallback): this;
3667
- innerJoin<R extends typeof Model>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, callback: JoinOnCallback): this;
3670
+ innerJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator: BinaryOperatorType, callback: JoinOnCallback): this;
3671
+ innerJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, callback: JoinOnCallback): this;
3668
3672
  /**
3669
3673
  * @description Join a table with the current model
3670
3674
  * @param relationTable - The table to join
@@ -3674,12 +3678,12 @@ declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string
3674
3678
  */
3675
3679
  join(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType): this;
3676
3680
  join(relationTable: string, referencingColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType): this;
3677
- join<R extends typeof Model>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator?: BinaryOperatorType): this;
3678
- join<R extends typeof Model>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn?: ModelKey<T>, operator?: BinaryOperatorType): this;
3681
+ join<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator?: BinaryOperatorType): this;
3682
+ join<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn?: ModelKey<T>, operator?: BinaryOperatorType): this;
3679
3683
  join(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator: BinaryOperatorType, callback: JoinOnCallback): this;
3680
3684
  join(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, callback: JoinOnCallback): this;
3681
- join<R extends typeof Model>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator: BinaryOperatorType, callback: JoinOnCallback): this;
3682
- join<R extends typeof Model>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, callback: JoinOnCallback): this;
3685
+ join<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator: BinaryOperatorType, callback: JoinOnCallback): this;
3686
+ join<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, callback: JoinOnCallback): this;
3683
3687
  /**
3684
3688
  * @description Join a table with the current model
3685
3689
  * @param relationTable - The table to join
@@ -3689,12 +3693,12 @@ declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string
3689
3693
  */
3690
3694
  leftJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType): this;
3691
3695
  leftJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType): this;
3692
- leftJoin<R extends typeof Model>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator?: BinaryOperatorType): this;
3693
- leftJoin<R extends typeof Model>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn?: ModelKey<T>, operator?: BinaryOperatorType): this;
3696
+ leftJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator?: BinaryOperatorType): this;
3697
+ leftJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn?: ModelKey<T>, operator?: BinaryOperatorType): this;
3694
3698
  leftJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator: BinaryOperatorType, callback: JoinOnCallback): this;
3695
3699
  leftJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, callback: JoinOnCallback): this;
3696
- leftJoin<R extends typeof Model>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator: BinaryOperatorType, callback: JoinOnCallback): this;
3697
- leftJoin<R extends typeof Model>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, callback: JoinOnCallback): this;
3700
+ leftJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator: BinaryOperatorType, callback: JoinOnCallback): this;
3701
+ leftJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, callback: JoinOnCallback): this;
3698
3702
  /**
3699
3703
  * @description Join a table with the current model
3700
3704
  * @param relationTable - The table to join
@@ -3704,7 +3708,7 @@ declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string
3704
3708
  */
3705
3709
  rightJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType): this;
3706
3710
  rightJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType): this;
3707
- rightJoin<R extends typeof Model>(relationTable: string | R, referencingColumnOrPrimaryColumn: ModelKey<InstanceType<R>> | JoinableColumn | ModelKey<T>, primaryColumn?: JoinableColumn | ModelKey<T>, operator?: BinaryOperatorType): this;
3711
+ rightJoin<R extends AnyModelConstructor>(relationTable: string | R, referencingColumnOrPrimaryColumn: ModelKey<InstanceType<R>> | JoinableColumn | ModelKey<T>, primaryColumn?: JoinableColumn | ModelKey<T>, operator?: BinaryOperatorType): this;
3708
3712
  rightJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, operator: BinaryOperatorType, callback: JoinOnCallback): this;
3709
3713
  rightJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, callback: JoinOnCallback): this;
3710
3714
  /**
@@ -3716,7 +3720,7 @@ declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string
3716
3720
  */
3717
3721
  fullJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType): this;
3718
3722
  fullJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType): this;
3719
- fullJoin<R extends typeof Model>(relationTable: string | R, referencingColumnOrPrimaryColumn: ModelKey<InstanceType<R>> | JoinableColumn | ModelKey<T>, primaryColumn?: JoinableColumn | ModelKey<T>, operator?: BinaryOperatorType): this;
3723
+ fullJoin<R extends AnyModelConstructor>(relationTable: string | R, referencingColumnOrPrimaryColumn: ModelKey<InstanceType<R>> | JoinableColumn | ModelKey<T>, primaryColumn?: JoinableColumn | ModelKey<T>, operator?: BinaryOperatorType): this;
3720
3724
  fullJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, operator: BinaryOperatorType, callback: JoinOnCallback): this;
3721
3725
  fullJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, callback: JoinOnCallback): this;
3722
3726
  }
@@ -4623,7 +4627,7 @@ declare class ModelQueryBuilder<T extends Model, S extends Record<string, any> =
4623
4627
  finally(onfinally?: (() => void) | null | undefined): Promise<SelectedModel<T, S, R>[]>;
4624
4628
  chunk(chunkSize: number, options?: ManyOptions): AsyncGenerator<SelectedModel<T, S, R>[] | T[]>;
4625
4629
  stream(options?: ManyOptions & StreamOptions): Promise<PassThrough & AsyncGenerator<SelectedModel<T, S, R> | T>>;
4626
- paginateWithCursor<K extends ModelKey<T>>(page: number, options?: PaginateWithCursorOptions<T, K>, cursor?: Cursor<T, K>): Promise<[CursorPaginatedData<T, S, R>, Cursor<T, K>]>;
4630
+ paginateWithCursor<K extends ModelKey<T>>(limit: number, options?: PaginateWithCursorOptions<T, K>, cursor?: Cursor<T, K>): Promise<[CursorPaginatedData<T, S, R>, Cursor<T, K>]>;
4627
4631
  /**
4628
4632
  * @description Inserts a new record into the database, it is not advised to use this method directly from the query builder if using a ModelQueryBuilder (`Model.query()`), use the `Model.insert` method instead.
4629
4633
  */
@@ -5466,7 +5470,7 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
5466
5470
  * @description Returns a ModelQueryBuilder instance for the given model
5467
5471
  * @param Model The model to create the query builder from
5468
5472
  */
5469
- from<T extends typeof Model>(Model: T): ModelQueryBuilder<InstanceType<T>>;
5473
+ from<T extends AnyModelConstructor>(model: T): ModelQueryBuilder<InstanceType<T>>;
5470
5474
  /**
5471
5475
  * @description Returns a SchemaBuilder instance for DDL operations
5472
5476
  * @description The builder will execute queries when awaited or when .execute() is called
@@ -5768,7 +5772,7 @@ type RawModelOptions = {
5768
5772
  * @example
5769
5773
  * type UserInstance = ModelInstanceType<typeof User>; // User
5770
5774
  */
5771
- type ModelInstanceType<O> = O extends typeof Model ? InstanceType<O> : never;
5775
+ type ModelInstanceType<O> = O extends AnyModelConstructor ? InstanceType<O> : never;
5772
5776
  /**
5773
5777
  * Available fetch hook combinations for query execution.
5774
5778
  * Hooks can be selectively ignored when fetching data.
@@ -6522,6 +6526,155 @@ declare abstract class Model<T extends Model<T> = any> extends Entity {
6522
6526
  private static dispatchModelManager;
6523
6527
  }
6524
6528
 
6529
+ /**
6530
+ * Phantom-typed descriptor for a model column.
6531
+ * `T` carries the TypeScript type the column resolves to at the instance level.
6532
+ */
6533
+ interface ColumnDef<T = any> {
6534
+ readonly _phantom: T;
6535
+ readonly _apply: (target: Object, propertyKey: string) => void;
6536
+ }
6537
+ /**
6538
+ * Phantom-typed descriptor for a model relation.
6539
+ * `T` carries the TypeScript type the relation resolves to at the instance level.
6540
+ */
6541
+ interface RelationDef<T = any> {
6542
+ readonly _phantom: T;
6543
+ readonly _apply: (target: Object, propertyKey: string) => void;
6544
+ }
6545
+ type ColPrimaryOptions = Omit<ColumnOptions, "primaryKey">;
6546
+ type ColStringOptions = Omit<ColumnOptions, "type"> & {
6547
+ length?: number;
6548
+ };
6549
+ type ColTextOptions = Omit<ColumnOptions, "type">;
6550
+ type ColIntegerOptions = Omit<ColumnOptions, "serialize">;
6551
+ type ColBigIntegerOptions = Omit<ColumnOptions, "serialize">;
6552
+ type ColFloatOptions = Omit<ColumnOptions, "serialize">;
6553
+ type ColDecimalOptions = Omit<ColumnOptions, "serialize"> & {
6554
+ precision?: number;
6555
+ scale?: number;
6556
+ };
6557
+ type ColIncrementOptions = Omit<ColumnOptions, "serialize" | "primaryKey" | "nullable">;
6558
+ type ColBigIncrementOptions = Omit<ColumnOptions, "serialize" | "primaryKey" | "nullable">;
6559
+ type ColBooleanOptions = Omit<ColumnOptions, "prepare" | "serialize">;
6560
+ type ColDateOptions = Omit<DateColumnOptions, "format">;
6561
+ type ColDatetimeOptions = DatetimeColumnOptions;
6562
+ type ColTimestampOptions = DatetimeColumnOptions;
6563
+ type ColTimeOptions = Omit<DateColumnOptions, "format">;
6564
+ type ColJsonOptions = Omit<ColumnOptions, "prepare" | "serialize">;
6565
+ type ColUuidOptions = Omit<ColumnOptions, "prepare">;
6566
+ type ColUlidOptions = Omit<ColumnOptions, "prepare">;
6567
+ type ColBinaryOptions = Omit<ColumnOptions, "type">;
6568
+ type ColSymmetricOptions = Omit<SymmetricEncryptionOptions, "prepare" | "serialize">;
6569
+ type ColAsymmetricOptions = Omit<AsymmetricEncryptionOptions, "prepare" | "serialize">;
6570
+ type RelationConstraintOptions = {
6571
+ onDelete?: OnUpdateOrDelete;
6572
+ onUpdate?: OnUpdateOrDelete;
6573
+ constraintName?: string;
6574
+ };
6575
+ interface ColNamespace {
6576
+ (options?: ColumnOptions): ColumnDef<any>;
6577
+ primary(options?: ColPrimaryOptions): ColumnDef<any>;
6578
+ string(options?: ColStringOptions): ColumnDef<string | null | undefined>;
6579
+ text(options?: ColTextOptions): ColumnDef<string | null | undefined>;
6580
+ integer(options?: ColIntegerOptions): ColumnDef<number | null | undefined>;
6581
+ bigInteger(options?: ColBigIntegerOptions): ColumnDef<number | bigint | null | undefined>;
6582
+ float(options?: ColFloatOptions): ColumnDef<number | null | undefined>;
6583
+ decimal(options?: ColDecimalOptions): ColumnDef<number | null | undefined>;
6584
+ increment(options?: ColIncrementOptions): ColumnDef<number | null | undefined>;
6585
+ bigIncrement(options?: ColBigIncrementOptions): ColumnDef<number | null | undefined>;
6586
+ boolean(options?: ColBooleanOptions): ColumnDef<boolean | null | undefined>;
6587
+ date(options?: ColDateOptions): ColumnDef<Date | string | null | undefined>;
6588
+ datetime(options?: ColDatetimeOptions): ColumnDef<Date | string | null | undefined>;
6589
+ timestamp(options?: ColTimestampOptions): ColumnDef<Date | string | null | undefined>;
6590
+ time(options?: ColTimeOptions): ColumnDef<Date | string | null | undefined>;
6591
+ json(options?: ColJsonOptions): ColumnDef<unknown>;
6592
+ uuid(options?: ColUuidOptions): ColumnDef<string | null | undefined>;
6593
+ ulid(options?: ColUlidOptions): ColumnDef<string | null | undefined>;
6594
+ binary(options?: ColBinaryOptions): ColumnDef<Buffer | Uint8Array | string | null | undefined>;
6595
+ enum<const V extends readonly string[]>(values: V, options?: Omit<ColumnOptions, "type">): ColumnDef<V[number] | null | undefined>;
6596
+ encryption: {
6597
+ symmetric(options: ColSymmetricOptions): ColumnDef<string | null | undefined>;
6598
+ asymmetric(options: ColAsymmetricOptions): ColumnDef<string | null | undefined>;
6599
+ };
6600
+ }
6601
+ type AnyModelClass = abstract new (...args: any[]) => Model;
6602
+ interface RelNamespace {
6603
+ hasOne<M extends AnyModelClass>(model: () => M, foreignKey?: string): RelationDef<InstanceType<M> | null | undefined>;
6604
+ hasMany<M extends AnyModelClass>(model: () => M, foreignKey?: string): RelationDef<InstanceType<M>[] | null | undefined>;
6605
+ belongsTo<M extends AnyModelClass>(model: () => M, foreignKey?: string, options?: RelationConstraintOptions): RelationDef<InstanceType<M> | null | undefined>;
6606
+ manyToMany<M extends AnyModelClass, T extends typeof Model = typeof Model, TM extends ThroughModel<T> = ThroughModel<T>>(model: () => M, throughModel: TM, throughModelKeys?: TM extends string ? ManyToManyStringOptions : ManyToManyOptions<T, TM>, options?: RelationConstraintOptions): RelationDef<InstanceType<M>[] | null | undefined>;
6607
+ }
6608
+ type IndexDefinition = string[] | {
6609
+ columns: string[];
6610
+ name?: string;
6611
+ };
6612
+ type UniqueDefinition = string[] | {
6613
+ columns: string[];
6614
+ name?: string;
6615
+ };
6616
+ type CheckDefinition = string | {
6617
+ expression: string;
6618
+ name?: string;
6619
+ };
6620
+ type HooksDefinition = {
6621
+ beforeFetch?: (queryBuilder: ModelQueryBuilder<any>) => Promise<void> | void;
6622
+ afterFetch?: (data: any[]) => Promise<any[]> | any[];
6623
+ beforeInsert?: (data: any) => Promise<void> | void;
6624
+ beforeInsertMany?: (data: any[]) => Promise<void> | void;
6625
+ beforeUpdate?: (queryBuilder: ModelQueryBuilder<any>) => Promise<void> | void;
6626
+ beforeDelete?: (queryBuilder: ModelQueryBuilder<any>) => Promise<void> | void;
6627
+ };
6628
+ type DefineModelOptions = {
6629
+ modelCaseConvention?: CaseConvention;
6630
+ databaseCaseConvention?: CaseConvention;
6631
+ softDeleteColumn?: string;
6632
+ softDeleteValue?: boolean | string;
6633
+ };
6634
+ type ModelDefinition<C extends Record<string, ColumnDef> = Record<string, ColumnDef>, R extends Record<string, RelationDef> = Record<string, RelationDef>> = {
6635
+ columns: C;
6636
+ relations?: R;
6637
+ indexes?: IndexDefinition[];
6638
+ uniques?: UniqueDefinition[];
6639
+ checks?: CheckDefinition[];
6640
+ hooks?: HooksDefinition;
6641
+ options?: DefineModelOptions;
6642
+ };
6643
+ type InferColumns<C extends Record<string, ColumnDef>> = {
6644
+ [K in keyof C]: C[K] extends ColumnDef<infer T> ? T : never;
6645
+ };
6646
+ type InferRelations<R extends Record<string, RelationDef>> = {
6647
+ [K in keyof R]: R[K] extends RelationDef<infer T> ? T : never;
6648
+ };
6649
+ /**
6650
+ * Infers the instance type of a model defined with `defineModel`.
6651
+ */
6652
+ type InferModel<C extends Record<string, ColumnDef>, R extends Record<string, RelationDef>> = InferColumns<C> & InferRelations<R>;
6653
+ /**
6654
+ * Public statics of `typeof Model` without the abstract constructor flag.
6655
+ */
6656
+ type ConcreteModelStatics = {
6657
+ [K in keyof typeof Model]: (typeof Model)[K];
6658
+ };
6659
+ /**
6660
+ * Union type that accepts both decorator-based model classes (`typeof Model`
6661
+ * subclasses) and programmatic models created via `defineModel`.
6662
+ *
6663
+ * Use this instead of `typeof Model` in any user-facing API that should
6664
+ * accept either kind of model.
6665
+ */
6666
+ type AnyModelConstructor = typeof Model | (ConcreteModelStatics & (new (...args: any[]) => Model));
6667
+ /**
6668
+ * The return type of `defineModel` – a concrete Model constructor whose
6669
+ * instances carry the inferred column + relation properties.
6670
+ *
6671
+ * Uses a mapped type over `typeof Model` so the abstract flag is stripped,
6672
+ * making the result instantiable while keeping all public static members.
6673
+ */
6674
+ type DefinedModel<C extends Record<string, ColumnDef>, R extends Record<string, RelationDef>> = ConcreteModelStatics & {
6675
+ new (): InferModel<C, R> & Model;
6676
+ };
6677
+
6525
6678
  type BaseModelRelationType = {
6526
6679
  onDelete?: OnUpdateOrDelete;
6527
6680
  onUpdate?: OnUpdateOrDelete;
@@ -6768,7 +6921,7 @@ declare function timeOnlyColumn(options?: Omit<DateColumnOptions, "format">): Ty
6768
6921
  * @description Defaults type to jsonb for migration generation
6769
6922
  */
6770
6923
  declare function jsonColumn(options?: Omit<ColumnOptions, "prepare" | "serialize">): TypedPropertyDecorator<unknown>;
6771
- declare function getModelColumns(target: typeof Model): ColumnType[];
6924
+ declare function getModelColumns(target: AnyModelConstructor): ColumnType[];
6772
6925
  /**
6773
6926
  * relations
6774
6927
  */
@@ -6780,22 +6933,22 @@ declare function getModelColumns(target: typeof Model): ColumnType[];
6780
6933
  * belongsTo<typeof Post>(() => User, 'userId')
6781
6934
  * ```
6782
6935
  */
6783
- declare function belongsTo<M extends typeof Model = any, R extends typeof Model = any>(model: () => R, foreignKey?: ModelKey<InstanceType<M>>, options?: BaseModelRelationType): TypedPropertyDecorator<InstanceType<R> | null | undefined>;
6784
- declare function belongsTo<R extends typeof Model = any>(model: () => R, foreignKey?: string, options?: BaseModelRelationType): TypedPropertyDecorator<InstanceType<R> | null | undefined>;
6936
+ declare function belongsTo<M extends AnyModelConstructor = any, R extends AnyModelConstructor = any>(model: () => R, foreignKey?: ModelKey<InstanceType<M>>, options?: BaseModelRelationType): TypedPropertyDecorator<InstanceType<R> | null | undefined>;
6937
+ declare function belongsTo<R extends AnyModelConstructor = any>(model: () => R, foreignKey?: string, options?: BaseModelRelationType): TypedPropertyDecorator<InstanceType<R> | null | undefined>;
6785
6938
  /**
6786
6939
  * @description Establishes a has one relation with the given model
6787
6940
  * @default foreignKey by default will be the singular of the model name plus "_id"
6788
6941
  * @example User will have foreignKey "user_id" on the Post model
6789
6942
  */
6790
- declare function hasOne<T extends typeof Model>(model: () => T, foreignKey?: ModelKey<InstanceType<T>>): TypedPropertyDecorator<InstanceType<T> | null | undefined>;
6791
- declare function hasOne<T extends typeof Model>(model: () => T, foreignKey?: string): TypedPropertyDecorator<InstanceType<T> | null | undefined>;
6943
+ declare function hasOne<T extends AnyModelConstructor>(model: () => T, foreignKey?: ModelKey<InstanceType<T>>): TypedPropertyDecorator<InstanceType<T> | null | undefined>;
6944
+ declare function hasOne<T extends AnyModelConstructor>(model: () => T, foreignKey?: string): TypedPropertyDecorator<InstanceType<T> | null | undefined>;
6792
6945
  /**
6793
6946
  * @description Establishes a has many relation with the given model
6794
6947
  * @default foreignKey by default will be the singular of the model name plus "_id"
6795
6948
  * @example User will have foreignKey "user_id" on the Post model
6796
6949
  */
6797
- declare function hasMany<T extends typeof Model>(model: () => T, foreignKey?: ModelKey<InstanceType<T>>): TypedPropertyDecorator<InstanceType<T>[] | null | undefined>;
6798
- declare function hasMany<T extends typeof Model>(model: () => T, foreignKey?: string): TypedPropertyDecorator<InstanceType<T>[] | null | undefined>;
6950
+ declare function hasMany<T extends AnyModelConstructor>(model: () => T, foreignKey?: ModelKey<InstanceType<T>>): TypedPropertyDecorator<InstanceType<T>[] | null | undefined>;
6951
+ declare function hasMany<T extends AnyModelConstructor>(model: () => T, foreignKey?: string): TypedPropertyDecorator<InstanceType<T>[] | null | undefined>;
6799
6952
  /**
6800
6953
  * @description Establishes a many to many relation with the given model
6801
6954
  * @default foreignKey by default will be the singular of the model that establishes the relation name plus "_id"
@@ -6806,20 +6959,56 @@ declare function hasMany<T extends typeof Model>(model: () => T, foreignKey?: st
6806
6959
  * @param throughModelKeys.rightForeignKey The foreign key of the through model from the related model (the model you are joining to)
6807
6960
  * @example User will have foreignKey "user_id" on the Join table by default
6808
6961
  */
6809
- declare function manyToMany<R extends typeof Model, T extends typeof Model, TM extends ThroughModel<T>>(model: () => R, throughModel: TM, throughModelKeys?: ManyToManyOptions<T, TM>, options?: BaseModelRelationType): TypedPropertyDecorator<InstanceType<R>[] | null | undefined>;
6810
- declare function manyToMany<R extends typeof Model>(model: () => R, throughModel: string | (() => typeof Model), throughModelKeys?: ManyToManyStringOptions, options?: BaseModelRelationType): TypedPropertyDecorator<InstanceType<R>[] | null | undefined>;
6811
- declare function getRelationsMetadata(target: typeof Model): LazyRelationType[];
6962
+ declare function manyToMany<R extends AnyModelConstructor, T extends AnyModelConstructor, TM extends ThroughModel<T>>(model: () => R, throughModel: TM, throughModelKeys?: ManyToManyOptions<T, TM>, options?: BaseModelRelationType): TypedPropertyDecorator<InstanceType<R>[] | null | undefined>;
6963
+ declare function manyToMany<R extends AnyModelConstructor>(model: () => R, throughModel: string | (() => AnyModelConstructor), throughModelKeys?: ManyToManyStringOptions, options?: BaseModelRelationType): TypedPropertyDecorator<InstanceType<R>[] | null | undefined>;
6964
+ declare function getRelationsMetadata(target: AnyModelConstructor): LazyRelationType[];
6812
6965
  /**
6813
6966
  * @description Returns the relations of the model
6814
6967
  */
6815
- declare function getRelations(target: typeof Model): Relation[];
6968
+ declare function getRelations(target: AnyModelConstructor): Relation[];
6816
6969
  /**
6817
6970
  * @description Returns the primary key of the model
6818
6971
  */
6819
- declare function getPrimaryKey(target: typeof Model): string | undefined;
6820
- declare function getIndexes(target: typeof Model): IndexType[];
6821
- declare function getUniques(target: typeof Model): UniqueType[];
6822
- declare function getChecks(target: typeof Model): CheckType[];
6972
+ declare function getPrimaryKey(target: AnyModelConstructor): string | undefined;
6973
+ declare function getIndexes(target: AnyModelConstructor): IndexType[];
6974
+ declare function getUniques(target: AnyModelConstructor): UniqueType[];
6975
+ declare function getChecks(target: AnyModelConstructor): CheckType[];
6976
+
6977
+ declare const col: ColNamespace;
6978
+ declare const rel: RelNamespace;
6979
+ /**
6980
+ * Creates a fully-typed Model subclass programmatically without decorators.
6981
+ *
6982
+ * The returned class is a real `typeof Model` subclass that works with all
6983
+ * existing infrastructure: `SqlDataSource`, `ModelManager`, `ModelQueryBuilder`,
6984
+ * `SchemaDiff` (automatic migrations), hooks, etc.
6985
+ *
6986
+ * @example
6987
+ * ```typescript
6988
+ * import { defineModel, col, rel } from "hysteria-orm";
6989
+ *
6990
+ * const User = defineModel("users", {
6991
+ * columns: {
6992
+ * id: col.increment(),
6993
+ * name: col.string(),
6994
+ * email: col.string({ nullable: false }),
6995
+ * isActive: col.boolean(),
6996
+ * createdAt: col.datetime({ autoCreate: true }),
6997
+ * updatedAt: col.datetime({ autoCreate: true, autoUpdate: true }),
6998
+ * },
6999
+ * relations: {
7000
+ * posts: rel.hasMany(() => Post, "userId"),
7001
+ * profile: rel.hasOne(() => Profile),
7002
+ * },
7003
+ * indexes: [["email"]],
7004
+ * uniques: [["email"]],
7005
+ * hooks: {
7006
+ * beforeFetch(qb) { qb.whereNull("deleted_at"); },
7007
+ * },
7008
+ * });
7009
+ * ```
7010
+ */
7011
+ declare function defineModel<C extends Record<string, ColumnDef>, R extends Record<string, RelationDef> = {}>(table: string, definition: ModelDefinition<C, R>): DefinedModel<C, R>;
6823
7012
 
6824
7013
  type FactoryReturnType<T extends number, O extends Model> = T extends 1 ? O : O[];
6825
7014
 
@@ -6829,7 +7018,7 @@ declare class ModelFactory<M extends Model> {
6829
7018
  /**
6830
7019
  * @description Constructor for the model factory
6831
7020
  */
6832
- constructor(typeofModel: typeof Model, modelData: Partial<M>);
7021
+ constructor(typeofModel: AnyModelConstructor, modelData: Partial<M>);
6833
7022
  /**
6834
7023
  * @description Merges the provided data with the model data
6835
7024
  */
@@ -6841,7 +7030,7 @@ declare class ModelFactory<M extends Model> {
6841
7030
  */
6842
7031
  create<T extends number>(howMany: T): Promise<FactoryReturnType<T, M>>;
6843
7032
  }
6844
- declare const createModelFactory: <M extends Model>(typeofModel: typeof Model, modelData: Partial<ModelWithoutRelations<M>>) => ModelFactory<M>;
7033
+ declare const createModelFactory: <M extends Model>(typeofModel: AnyModelConstructor, modelData: Partial<ModelWithoutRelations<M>>) => ModelFactory<M>;
6845
7034
 
6846
7035
  type Constructor<T = Model> = new (...args: any[]) => T;
6847
7036
  type AbstractConstructor<T = Model> = abstract new (...args: any[]) => T;
@@ -7982,4 +8171,4 @@ declare const generateOpenApiModelWithMetadata: <T extends new () => Model>(mode
7982
8171
  $id?: string;
7983
8172
  }>;
7984
8173
 
7985
- export { type AbstractConstructor, type AdminJsActionOptions, type AdminJsAssets, type AdminJsBranding, type AdminJsInstance, type AdminJsLocale, type AdminJsOptions, type AdminJsPage, type AdminJsPropertyOptions, type AdminJsResourceOptions, type AdminJsSettings, type AnyConstructor, type AsymmetricEncryptionOptions, type BaseModelMethodOptions, type BaseModelRelationType, BaseSeeder, type BigIntFields, type BuildSelectType, type BuildSingleSelectType, type CacheAdapter, type CacheKeys, type CheckType, 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 ComposeBuildSelect, type ComposeSelect, type ConnectionPolicies, type Constructor, type CustomLogger, type DataSourceInput, type DataSourceType, type DateColumnOptions, type DatetimeColumnOptions, type ExcludeMethods, type ExtractColumnName, type ExtractSourceColumn, type FetchHooks, type FindReturnType, type GetColumnType, type GetConnectionReturnType, HysteriaError, InMemoryAdapter, type IncrementFields, type IndexType, type LazyRelationType, type LoggerConfig, type ManyOptions, type ManyToManyOptions, type ManyToManyStringOptions, Migration, type MigrationConfig, type MigrationConfigBase, type MixinColumns, MixinFactory, Model, type ModelDataProperties, type ModelInstanceType, type ModelKey, ModelQueryBuilder, type ModelQueryResult, type ModelRelation, type ModelSelectTuple, type ModelSelectableInput, 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 ReturningColumns, type ReturningKey, Schema, SchemaBuilder, type SeederConfig, type SelectBrand, type SelectableColumn, type SelectedModel, 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, type TimestampFields, Transaction, type TransactionExecutionOptions, type TypedPropertyDecorator, type UlidFields, UlidMixin, type UniqueType, type UseCacheReturnType, type UseConnectionInput, type UuidFields, UuidMixin, WriteOperation, type WriteReturnType, belongsTo, bigIntMixin, check, column, createMixin, createModelFactory, defineMigrator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, getChecks, getCollectionProperties, getIndexes, getModelColumns, type getPoolReturnType, getPrimaryKey, getRelations, getRelationsMetadata, getUniques, hasMany, hasOne, incrementMixin, index, HysteriaLogger as logger, manyToMany, property, RedisDataSource as redis, timestampMixin, ulidMixin, unique, uuidMixin, view, withPerformance };
8174
+ export { type AbstractConstructor, type AdminJsActionOptions, type AdminJsAssets, type AdminJsBranding, type AdminJsInstance, type AdminJsLocale, type AdminJsOptions, type AdminJsPage, type AdminJsPropertyOptions, type AdminJsResourceOptions, type AdminJsSettings, type AnyConstructor, type AnyModelConstructor, type AsymmetricEncryptionOptions, type BaseModelMethodOptions, type BaseModelRelationType, BaseSeeder, type BigIntFields, type BuildSelectType, type BuildSingleSelectType, type CacheAdapter, type CacheKeys, type CheckType, ClientMigrator, Collection, type ColumnDataTypeOption, type ColumnDataTypeOptionSimple, type ColumnDataTypeOptionWithBinary, type ColumnDataTypeOptionWithDatePrecision, type ColumnDataTypeOptionWithEnum, type ColumnDataTypeOptionWithLength, type ColumnDataTypeOptionWithPrecision, type ColumnDataTypeOptionWithScaleAndPrecision, type ColumnDataTypeOptionWithText, type ColumnDef, type ColumnOptions, type ColumnType, type CommonDataSourceInput, type ComposeBuildSelect, type ComposeSelect, type ConnectionPolicies, type Constructor, type CustomLogger, type DataSourceInput, type DataSourceType, type DateColumnOptions, type DatetimeColumnOptions, type DefinedModel, type ExcludeMethods, type ExtractColumnName, type ExtractSourceColumn, type FetchHooks, type FindReturnType, type GetColumnType, type GetConnectionReturnType, HysteriaError, InMemoryAdapter, type IncrementFields, type IndexType, type LazyRelationType, type LoggerConfig, type ManyOptions, type ManyToManyOptions, type ManyToManyStringOptions, Migration, type MigrationConfig, type MigrationConfigBase, type MixinColumns, MixinFactory, Model, type ModelDataProperties, type ModelInstanceType, type ModelKey, ModelQueryBuilder, type ModelQueryResult, type ModelRelation, type ModelSelectTuple, type ModelSelectableInput, 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 RelationDef, type RelationQueryBuilderType, type ReplicationType, type ReturningColumns, type ReturningKey, Schema, SchemaBuilder, type SeederConfig, type SelectBrand, type SelectableColumn, type SelectedModel, 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, type TimestampFields, Transaction, type TransactionExecutionOptions, type TypedPropertyDecorator, type UlidFields, UlidMixin, type UniqueType, type UseCacheReturnType, type UseConnectionInput, type UuidFields, UuidMixin, WriteOperation, type WriteReturnType, belongsTo, bigIntMixin, check, col, column, createMixin, createModelFactory, defineMigrator, defineModel, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, getChecks, getCollectionProperties, getIndexes, getModelColumns, type getPoolReturnType, getPrimaryKey, getRelations, getRelationsMetadata, getUniques, hasMany, hasOne, incrementMixin, index, HysteriaLogger as logger, manyToMany, property, RedisDataSource as redis, rel, timestampMixin, ulidMixin, unique, uuidMixin, view, withPerformance };