hysteria-orm 11.0.4 → 11.0.6

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
@@ -695,7 +695,7 @@ interface SqliteDataSourceInput extends CommonDataSourceInput {
695
695
  * @description The filename of the database file for SQLite
696
696
  * @default ":memory:"
697
697
  */
698
- readonly database?: ":memory:" | (string & {});
698
+ readonly database?: ":memory:" | "file::memory:?cache=shared" | (string & {});
699
699
  }
700
700
  interface NotNullableSqliteDataSourceInput extends SqliteDataSourceInput {
701
701
  readonly type?: "sqlite";
@@ -735,6 +735,26 @@ type ConnectionPolicies = {
735
735
  * and programmatic models created via `defineModel`.
736
736
  */
737
737
  type SqlDataSourceModel = AnyModelConstructor;
738
+ /**
739
+ * @description Migration lock configuration
740
+ */
741
+ type MigrationLockConfig = {
742
+ /**
743
+ * @description Enable/disable migration locking
744
+ * @default true
745
+ */
746
+ enabled?: boolean;
747
+ /**
748
+ * @description Lock timeout in milliseconds for migration advisory lock acquisition
749
+ * @default 30000
750
+ */
751
+ timeout?: number;
752
+ /**
753
+ * @description Custom lock key value - can be string, number, or function returning string|number
754
+ * @default "hysteria_migration_lock"
755
+ */
756
+ customValue?: string | number | (() => string | number);
757
+ };
738
758
  /**
739
759
  * @description Base migration configuration options available for all databases
740
760
  */
@@ -750,12 +770,13 @@ type MigrationConfigBase = {
750
770
  */
751
771
  tsconfig?: string;
752
772
  /**
753
- * @description Acquire advisory lock before running migrations to prevent concurrent execution, can be overridden in the cli command
773
+ * @description Migration lock configuration - can be boolean to enable/disable, or an object for advanced options
754
774
  * @default true
755
775
  */
756
- lock?: boolean;
776
+ lock?: boolean | MigrationLockConfig;
757
777
  /**
758
- * @description Lock timeout in milliseconds for migration advisory lock acquisition, can be overridden in the cli command
778
+ * @deprecated Use lock.timeout instead. Kept for backward compatibility.
779
+ * @description Lock timeout in milliseconds for migration advisory lock acquisition
759
780
  * @default 30000
760
781
  */
761
782
  lockTimeout?: number;
@@ -801,6 +822,13 @@ type SqlDataSourceInputBase<T extends Record<string, SqlDataSourceModel> = {}, C
801
822
  * @default false
802
823
  */
803
824
  readonly logs?: boolean | LoggerConfig;
825
+ /**
826
+ * @description Enable AsyncLocalStorage (CLS) for automatic transaction propagation.
827
+ * When enabled, queries inside `sql.transaction(callback)` automatically use the active
828
+ * transaction without explicit passing.
829
+ * @default true
830
+ */
831
+ readonly clsEnabled?: boolean;
804
832
  /**
805
833
  * @description The connection policies to use for the sql data source that are not configured in the driverOptions
806
834
  */
@@ -1803,6 +1831,93 @@ declare class SchemaBuilder implements PromiseLike<void> {
1803
1831
  * @description Returns true if the builder execution failed
1804
1832
  */
1805
1833
  hasFailed(): boolean;
1834
+ /**
1835
+ * @description Checks if a table exists in the database
1836
+ * @param tableName - The name of the table to check
1837
+ * @returns Promise<boolean> - true if table exists, false otherwise
1838
+ */
1839
+ hasTable(tableName: string): Promise<boolean>;
1840
+ /**
1841
+ * @description Checks if a column exists in a table
1842
+ * @param tableName - The name of the table
1843
+ * @param columnName - The name of the column to check
1844
+ * @returns Promise<boolean> - true if column exists in table, false otherwise
1845
+ */
1846
+ hasColumn(tableName: string, columnName: string): Promise<boolean>;
1847
+ /**
1848
+ * @description Checks if multiple columns exist in a table
1849
+ * @param tableName - The name of the table
1850
+ * @param columnNames - Array of column names to check
1851
+ * @returns Promise<boolean> - true if all columns exist in table, false otherwise
1852
+ */
1853
+ hasColumns(tableName: string, ...columnNames: string[]): Promise<boolean>;
1854
+ /**
1855
+ * @description Checks if an index exists on a table
1856
+ * @param tableName - The name of the table
1857
+ * @param indexName - The name of the index to check
1858
+ * @returns Promise<boolean> - true if index exists on table, false otherwise
1859
+ */
1860
+ hasIndex(tableName: string, indexName: string): Promise<boolean>;
1861
+ /**
1862
+ * @description Checks if a table has a primary key
1863
+ * @param tableName - The name of the table
1864
+ * @returns Promise<boolean> - true if table has primary key, false otherwise
1865
+ */
1866
+ hasPrimaryKey(tableName: string): Promise<boolean>;
1867
+ /**
1868
+ * @description Checks if a unique constraint exists on a table for given columns
1869
+ * @param tableName - The name of the table
1870
+ * @param columns - Array of column names (or single string) that form the unique constraint
1871
+ * @returns Promise<boolean> - true if unique constraint exists, false otherwise
1872
+ */
1873
+ hasUnique(tableName: string, columns: string[] | string): Promise<boolean>;
1874
+ /**
1875
+ * @description Checks if a foreign key constraint exists on a table for given columns
1876
+ * @param tableName - The name of the table
1877
+ * @param columns - Array of column names that form the foreign key
1878
+ * @returns Promise<boolean> - true if foreign key exists, false otherwise
1879
+ */
1880
+ hasForeignKey(tableName: string, columns: string[]): Promise<boolean>;
1881
+ /**
1882
+ * @description Checks if a check constraint exists on a table
1883
+ * @param tableName - The name of the table
1884
+ * @param constraintName - The name of the check constraint to check
1885
+ * @returns Promise<boolean> - true if check constraint exists, false otherwise
1886
+ */
1887
+ hasCheckConstraint(tableName: string, constraintName: string): Promise<boolean>;
1888
+ /**
1889
+ * @description Gets all table names in the database
1890
+ * @returns Promise<string[]> - Array of table names
1891
+ */
1892
+ getTables(): Promise<string[]>;
1893
+ /**
1894
+ * @description Gets all column names for a table
1895
+ * @param tableName - The name of the table
1896
+ * @returns Promise<string[]> - Array of column names
1897
+ */
1898
+ getColumnListing(tableName: string): Promise<string[]>;
1899
+ /**
1900
+ * @description Drops a table if it exists
1901
+ * @param table - The name of the table to drop
1902
+ * @returns this for chaining
1903
+ */
1904
+ dropTableIfExists(table: string): this;
1905
+ /**
1906
+ * @description Drops an index if it exists
1907
+ * @param indexName - The name of the index
1908
+ * @param table - Table name (required for existence check)
1909
+ * @returns Promise<void> - executes immediately, not chainable
1910
+ * @mysql requires table name for existence check
1911
+ */
1912
+ dropIndexIfExists(indexName: string, table: string): Promise<void>;
1913
+ /**
1914
+ * @description Renames a column in a table
1915
+ * @param tableName - The name of the table
1916
+ * @param oldName - The current column name
1917
+ * @param newName - The new column name
1918
+ * @returns this for chaining
1919
+ */
1920
+ renameColumn(tableName: string, oldName: string, newName: string): this;
1806
1921
  }
1807
1922
 
1808
1923
  interface IntrospectedColumn {
@@ -4791,6 +4906,19 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
4791
4906
  * @description Options provided in the sql data source initialization
4792
4907
  */
4793
4908
  inputDetails: SqlDataSourceInput<D, T, C>;
4909
+ /**
4910
+ * @description Unique identifier shared across all clones of the same logical data source.
4911
+ * Used to verify ALS transactions belong to this instance.
4912
+ */
4913
+ id: string;
4914
+ /**
4915
+ * @description Whether AsyncLocalStorage (CLS) transaction auto-propagation is enabled.
4916
+ */
4917
+ private readonly clsEnabled;
4918
+ /**
4919
+ * @description Whether AsyncLocalStorage (CLS) transaction auto-propagation is enabled.
4920
+ */
4921
+ get isClsEnabled(): boolean;
4794
4922
  /**
4795
4923
  * @description Adapter for `useCache`, uses an in memory strategy by default
4796
4924
  */
@@ -4805,7 +4933,7 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
4805
4933
  migrationConfig: {
4806
4934
  path: string;
4807
4935
  tsconfig?: string;
4808
- lock: boolean;
4936
+ lock: boolean | MigrationLockConfig;
4809
4937
  transactional: boolean;
4810
4938
  lockTimeout?: number;
4811
4939
  };
@@ -4925,6 +5053,11 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
4925
5053
  * @returns A slave SqlDataSource instance or null if no slaves are available
4926
5054
  */
4927
5055
  getSlave(): SqlDataSource<D, T, C> | null;
5056
+ /**
5057
+ * @description Returns the SqlDataSource that should execute the next query,
5058
+ * respecting (in order): explicit global transaction, ALS transaction, then self.
5059
+ */
5060
+ getTransactionBoundSqlDataSource(): SqlDataSource | null;
4928
5061
  /**
4929
5062
  * @description Uses the cache adapter to get a value from the cache
4930
5063
  * @param key The key to get the value from
@@ -5027,6 +5160,9 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
5027
5160
  * @param cb if a callback is provided, it will execute the callback and commit or rollback the transaction based on the callback's success or failure
5028
5161
  * @param options.isolationLevel The isolation level to use for the transaction
5029
5162
  * @sqlite ignores the isolation level
5163
+ * @warning SQLite `:memory:` databases use `file::memory:?cache=shared`
5164
+ * to allow transaction connections to share the same in-memory database.
5165
+ * Without shared cache each connection would see an empty fresh database.
5030
5166
  */
5031
5167
  transaction(options?: StartTransactionOptions): Promise<Transaction>;
5032
5168
  transaction<T>(cb: (trx: Transaction) => Promise<T>, options?: StartTransactionOptions): Promise<T>;
@@ -5135,6 +5271,71 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
5135
5271
  * @description Introspects table columns metadata
5136
5272
  */
5137
5273
  getTableInfo(table: string): Promise<TableColumnInfo[]>;
5274
+ /**
5275
+ * @description Checks if a table exists in the database
5276
+ * @param tableName - The name of the table to check
5277
+ * @returns Promise<boolean> - true if table exists, false otherwise
5278
+ */
5279
+ hasTable(tableName: string): Promise<boolean>;
5280
+ /**
5281
+ * @description Checks if a column exists in a table
5282
+ * @param tableName - The name of the table
5283
+ * @param columnName - The name of the column to check
5284
+ * @returns Promise<boolean> - true if column exists in table, false otherwise
5285
+ */
5286
+ hasColumn(tableName: string, columnName: string): Promise<boolean>;
5287
+ /**
5288
+ * @description Checks if multiple columns exist in a table
5289
+ * @param tableName - The name of the table
5290
+ * @param columnNames - Array of column names to check
5291
+ * @returns Promise<boolean> - true if all columns exist in table, false otherwise
5292
+ */
5293
+ hasColumns(tableName: string, ...columnNames: string[]): Promise<boolean>;
5294
+ /**
5295
+ * @description Checks if an index exists on a table
5296
+ * @param tableName - The name of the table
5297
+ * @param indexName - The name of the index to check
5298
+ * @returns Promise<boolean> - true if index exists on table, false otherwise
5299
+ */
5300
+ hasIndex(tableName: string, indexName: string): Promise<boolean>;
5301
+ /**
5302
+ * @description Checks if a table has a primary key
5303
+ * @param tableName - The name of the table
5304
+ * @returns Promise<boolean> - true if table has primary key, false otherwise
5305
+ */
5306
+ hasPrimaryKey(tableName: string): Promise<boolean>;
5307
+ /**
5308
+ * @description Checks if a unique constraint exists on a table for given columns
5309
+ * @param tableName - The name of the table
5310
+ * @param columns - Array of column names (or single string) that form the unique constraint
5311
+ * @returns Promise<boolean> - true if unique constraint exists, false otherwise
5312
+ */
5313
+ hasUnique(tableName: string, columns: string[] | string): Promise<boolean>;
5314
+ /**
5315
+ * @description Checks if a foreign key constraint exists on a table for given columns
5316
+ * @param tableName - The name of the table
5317
+ * @param columns - Array of column names that form the foreign key
5318
+ * @returns Promise<boolean> - true if foreign key exists, false otherwise
5319
+ */
5320
+ hasForeignKey(tableName: string, columns: string[]): Promise<boolean>;
5321
+ /**
5322
+ * @description Checks if a check constraint exists on a table
5323
+ * @param tableName - The name of the table
5324
+ * @param constraintName - The name of the check constraint to check
5325
+ * @returns Promise<boolean> - true if check constraint exists, false otherwise
5326
+ */
5327
+ hasCheckConstraint(tableName: string, constraintName: string): Promise<boolean>;
5328
+ /**
5329
+ * @description Gets all table names in the database
5330
+ * @returns Promise<string[]> - Array of table names
5331
+ */
5332
+ getTables(): Promise<string[]>;
5333
+ /**
5334
+ * @description Gets all column names for a table
5335
+ * @param tableName - The name of the table
5336
+ * @returns Promise<string[]> - Array of column names
5337
+ */
5338
+ getColumnListing(tableName: string): Promise<string[]>;
5138
5339
  /**
5139
5340
  * @description Introspects table indexes metadata
5140
5341
  */
@@ -7814,6 +8015,88 @@ declare class ObserverChainWrapper {
7814
8015
  add(observer: QueryObserver): void;
7815
8016
  }
7816
8017
 
8018
+ /**
8019
+ * Async method type constraint for atomic decorator.
8020
+ */
8021
+ type AsyncMethod = (...args: any[]) => Promise<any>;
8022
+ /**
8023
+ * @description Options for the atomic decorator.
8024
+ */
8025
+ type AtomicOptions = {
8026
+ /**
8027
+ * @description Property name on the class instance that holds the SqlDataSource,
8028
+ * a SqlDataSource instance, or a function receiving the instance and returning the SqlDataSource.
8029
+ * @default "sql"
8030
+ */
8031
+ dataSource?: string | SqlDataSource | ((instance: any) => SqlDataSource);
8032
+ /**
8033
+ * @description Transaction isolation level.
8034
+ */
8035
+ isolationLevel?: TransactionIsolationLevel;
8036
+ };
8037
+ /**
8038
+ * @description Wraps an async method in a callback-style transaction with
8039
+ * AsyncLocalStorage (CLS) auto-propagation.
8040
+ *
8041
+ * The decorated method must be async and return a Promise.
8042
+ * The transaction is committed if the method succeeds, rolled back if it throws.
8043
+ *
8044
+ * @throws {Error} if the resolved SqlDataSource has `clsEnabled: false`.
8045
+ *
8046
+ * @example
8047
+ * ```ts
8048
+ * class UserService {
8049
+ * sql = new SqlDataSource();
8050
+ *
8051
+ * @atomic()
8052
+ * async createUser(data: UserData): Promise<User> {
8053
+ * const user = await this.sql.from(User).insert(data);
8054
+ * await this.sql.from(Profile).insert({ userId: user.id });
8055
+ * return user;
8056
+ * }
8057
+ * }
8058
+ * ```
8059
+ *
8060
+ * @example
8061
+ * ```ts
8062
+ * class UserService {
8063
+ * db = new SqlDataSource();
8064
+ *
8065
+ * @atomic({ dataSource: "db", isolationLevel: "SERIALIZABLE" })
8066
+ * async createUser(data: UserData): Promise<User> {
8067
+ * // ...
8068
+ * }
8069
+ * }
8070
+ * ```
8071
+ *
8072
+ * @example
8073
+ * ```ts
8074
+ * atomic.sqlDataSource = new SqlDataSource();
8075
+ *
8076
+ * class UserService {
8077
+ * @atomic()
8078
+ * async createUser(data: UserData): Promise<User> {
8079
+ * // Uses atomic.sqlDataSource automatically
8080
+ * }
8081
+ * }
8082
+ * ```
8083
+ */
8084
+ declare function atomic(options?: AtomicOptions): <T extends AsyncMethod>(target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
8085
+ /**
8086
+ * @description Legacy overload accepting a property name string directly.
8087
+ */
8088
+ declare function atomic(dataSourceProperty: string, isolationLevel?: TransactionIsolationLevel): <T extends AsyncMethod>(target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
8089
+ declare namespace atomic {
8090
+ /**
8091
+ * @description Global default SqlDataSource used by all @atomic decorators
8092
+ * when no per-decorator dataSource option is provided and the host class
8093
+ * does not expose a "sql" property.
8094
+ *
8095
+ * @default undefined
8096
+ */
8097
+ let sqlDataSource: SqlDataSource | undefined;
8098
+ }
8099
+
7817
8100
  declare class Schema {
7818
8101
  queryStatements: string[];
7819
8102
  sqlType: SqlDataSourceType;
@@ -8005,7 +8288,7 @@ declare abstract class BaseSeeder {
8005
8288
  abstract run(): Promise<void>;
8006
8289
  }
8007
8290
 
8008
- type HysteriaErrorCode = "VALIDATION_ERROR" | "CONNECTION_ALREADY_ESTABLISHED" | `UNSUPPORTED_ISOLATION_LEVEL_${string}` | "ROW_NOT_FOUND" | `UNSUPPORTED_DATABASE_TYPE_${string}` | `RELATION_TYPE_NOT_SUPPORTED_${string}` | `NOT_SUPPORTED_IN_${string}` | `RELATION_NOT_FOUND_IN_MODEL_${string}` | `UNKNOWN_RELATION_TYPE_${string}` | `DISTINCT_ON_NOT_SUPPORTED_IN_${string}` | `CONFLICT_COLUMNS_NOT_PRESENT_IN_DATA` | `CONFLICT_COLUMNS_NOT_PRESENT_IN_DATA_${string}` | `FOREIGN_KEY_VALUES_MISSING_FOR_HAS_ONE_RELATION_${string}` | `FOREIGN_KEY_VALUES_MISSING_FOR_BELONGS_TO_RELATION_${string}` | `PRIMARY_KEY_VALUES_MISSING_FOR_HAS_MANY_RELATION_${string}` | `MANY_TO_MANY_RELATION_NOT_FOUND_FOR_RELATED_MODEL_${string}` | `PRIMARY_KEY_VALUES_MISSING_FOR_MANY_TO_MANY_RELATION_${string}` | `RELATED_MODEL_DOES_NOT_HAVE_A_PRIMARY_KEY_${string}` | `FOR_SHARE_NOT_SUPPORTED_IN_${string}` | `SKIP_LOCKED_NOT_SUPPORTED_IN_${string}` | `LOCK_FOR_UPDATE_NOT_SUPPORTED_${string}` | `KEY_${string}_HAS_NO_HANDLER_IN_CACHE_KEYS_CONFIG` | `CACHE_ADAPTER_NOT_CONFIGURED` | `SQLITE_NOT_SUPPORTED` | `COCKROACHDB_NOT_SUPPORTED` | `RELATION_NOT_FOUND` | `POSTGRES_TABLE_REQUIRED` | `MODEL_HAS_NO_PRIMARY_KEY_VALUE` | `RELATION_NOT_MANY_TO_MANY` | "MATERIALIZED_CTE_NOT_SUPPORTED" | "DUPLICATE_MODEL_KEYS_WHILE_INSTANTIATING_MODELS" | "INVALID_ONE_PARAMETER_WHERE_CONDITION" | "INVALID_PAGINATION_PARAMETERS" | "MISSING_ALIAS_FOR_SUBQUERY" | "MODEL_HAS_NO_PRIMARY_KEY" | "PRIMARY_KEY_NOT_FOUND" | "SQLITE_ONLY_SUPPORTS_SERIALIZABLE_ISOLATION_LEVEL" | "MUST_CALL_BUILD_CTE_AT_LEAST_ONCE" | "REGEXP_NOT_SUPPORTED_IN_SQLITE" | "MANY_TO_MANY_RELATION_MUST_HAVE_A_THROUGH_MODEL" | "INSERT_FAILED" | "MULTIPLE_PRIMARY_KEYS_NOT_ALLOWED" | "FILE_NOT_A_SQL_OR_TXT_FILE" | "CONNECTION_NOT_ESTABLISHED" | "TRANSACTION_NOT_ACTIVE" | "DEVELOPMENT_ERROR" | "MIGRATION_MODULE_NOT_FOUND" | "DRIVER_NOT_FOUND" | "FILE_NOT_FOUND_OR_NOT_ACCESSIBLE" | "ENV_NOT_SET" | "REQUIRED_VALUE_NOT_SET" | "SET_FAILED" | "GET_FAILED" | "REFERENCES_OPTION_REQUIRED" | "DELETE_FAILED" | "INVALID_DEFAULT_VALUE" | "DISCONNECT_FAILED" | "FLUSH_FAILED" | "LEFT_COLUMN_NOT_PROVIDED_FOR_JOIN" | "RIGHT_COLUMN_NOT_PROVIDED_FOR_JOIN" | "MODEL_HAS_NO_PRIMARY_KEY" | "GLOBAL_TRANSACTION_ALREADY_STARTED" | "GLOBAL_TRANSACTION_NOT_STARTED" | "MYSQL_REQUIRES_TABLE_NAME_FOR_INDEX_DROP" | "INVALID_DATE_OBJECT" | "INVALID_DATE_STRING" | "FAILED_TO_PARSE_DATE" | "MIGRATION_MODULE_REQUIRES_TS_NODE" | "FAILED_TO_ENCRYPT_SYMMETRICALLY" | "FAILED_TO_DECRYPT_SYMMETRICALLY" | "FAILED_TO_ENCRYPT_ASYMMETRICALLY" | "FAILED_TO_DECRYPT_ASYMMETRICALLY" | "UNSUPPORTED_RELATION_TYPE" | "LPUSH_FAILED" | "RPUSH_FAILED" | "LPOP_FAILED" | "RPOP_FAILED" | "LRANGE_FAILED" | "LLEN_FAILED" | "HSET_FAILED" | "HMSET_FAILED" | "HGET_FAILED" | "HGETALL_FAILED" | "HMGET_FAILED" | "HDEL_FAILED" | "HEXISTS_FAILED" | "HKEYS_FAILED" | "HLEN_FAILED" | "SADD_FAILED" | "SMEMBERS_FAILED" | "SREM_FAILED" | "SISMEMBER_FAILED" | "SCARD_FAILED" | "SINTER_FAILED" | "SUNION_FAILED" | "SDIFF_FAILED" | "ZADD_FAILED" | "ZRANGE_FAILED" | "ZREVRANGE_FAILED" | "ZREM_FAILED" | "ZSCORE_FAILED" | "ZCARD_FAILED" | "SUBSCRIBE_FAILED" | "UNSUBSCRIBE_FAILED" | "PUBLISH_FAILED" | "PSUBSCRIBE_FAILED" | "PUNSUBSCRIBE_FAILED" | "EXISTS_FAILED" | "EXPIRE_FAILED" | "EXPIREAT_FAILED" | "PEXPIRE_FAILED" | "TTL_FAILED" | "PTTL_FAILED" | "PERSIST_FAILED" | "KEYS_FAILED" | "RENAME_FAILED" | "TYPE_FAILED" | "SCAN_FAILED" | "ADMINJS_NOT_ENABLED" | "ADMINJS_INITIALIZATION_FAILED" | "ADMINJS_NO_MODELS_PROVIDED" | "ZOD_ENGINE_NOT_LOADED" | `SCOPE_NOT_FOUND_${string}`;
8291
+ type HysteriaErrorCode = "VALIDATION_ERROR" | "CONNECTION_ALREADY_ESTABLISHED" | `UNSUPPORTED_ISOLATION_LEVEL_${string}` | "ROW_NOT_FOUND" | `UNSUPPORTED_DATABASE_TYPE_${string}` | `RELATION_TYPE_NOT_SUPPORTED_${string}` | `NOT_SUPPORTED_IN_${string}` | `RELATION_NOT_FOUND_IN_MODEL_${string}` | `UNKNOWN_RELATION_TYPE_${string}` | `DISTINCT_ON_NOT_SUPPORTED_IN_${string}` | `CONFLICT_COLUMNS_NOT_PRESENT_IN_DATA` | `CONFLICT_COLUMNS_NOT_PRESENT_IN_DATA_${string}` | `FOREIGN_KEY_VALUES_MISSING_FOR_HAS_ONE_RELATION_${string}` | `FOREIGN_KEY_VALUES_MISSING_FOR_BELONGS_TO_RELATION_${string}` | `PRIMARY_KEY_VALUES_MISSING_FOR_HAS_MANY_RELATION_${string}` | `MANY_TO_MANY_RELATION_NOT_FOUND_FOR_RELATED_MODEL_${string}` | `PRIMARY_KEY_VALUES_MISSING_FOR_MANY_TO_MANY_RELATION_${string}` | `RELATED_MODEL_DOES_NOT_HAVE_A_PRIMARY_KEY_${string}` | `FOR_SHARE_NOT_SUPPORTED_IN_${string}` | `SKIP_LOCKED_NOT_SUPPORTED_IN_${string}` | `LOCK_FOR_UPDATE_NOT_SUPPORTED_${string}` | `KEY_${string}_HAS_NO_HANDLER_IN_CACHE_KEYS_CONFIG` | `CACHE_ADAPTER_NOT_CONFIGURED` | `SQLITE_NOT_SUPPORTED` | `COCKROACHDB_NOT_SUPPORTED` | `RELATION_NOT_FOUND` | `POSTGRES_TABLE_REQUIRED` | `MODEL_HAS_NO_PRIMARY_KEY_VALUE` | `RELATION_NOT_MANY_TO_MANY` | "MATERIALIZED_CTE_NOT_SUPPORTED" | "DUPLICATE_MODEL_KEYS_WHILE_INSTANTIATING_MODELS" | "INVALID_ONE_PARAMETER_WHERE_CONDITION" | "INVALID_PAGINATION_PARAMETERS" | "MISSING_ALIAS_FOR_SUBQUERY" | "MODEL_HAS_NO_PRIMARY_KEY" | "PRIMARY_KEY_NOT_FOUND" | "SQLITE_ONLY_SUPPORTS_SERIALIZABLE_ISOLATION_LEVEL" | "MUST_CALL_BUILD_CTE_AT_LEAST_ONCE" | "REGEXP_NOT_SUPPORTED_IN_SQLITE" | "MANY_TO_MANY_RELATION_MUST_HAVE_A_THROUGH_MODEL" | "INSERT_FAILED" | "MULTIPLE_PRIMARY_KEYS_NOT_ALLOWED" | "FILE_NOT_A_SQL_OR_TXT_FILE" | "CONNECTION_NOT_ESTABLISHED" | "TRANSACTION_NOT_ACTIVE" | "DEVELOPMENT_ERROR" | "MIGRATION_MODULE_NOT_FOUND" | "DRIVER_NOT_FOUND" | "FILE_NOT_FOUND_OR_NOT_ACCESSIBLE" | "ENV_NOT_SET" | "REQUIRED_VALUE_NOT_SET" | "SET_FAILED" | "GET_FAILED" | "REFERENCES_OPTION_REQUIRED" | "DELETE_FAILED" | "INVALID_DEFAULT_VALUE" | "DISCONNECT_FAILED" | "FLUSH_FAILED" | "LEFT_COLUMN_NOT_PROVIDED_FOR_JOIN" | "RIGHT_COLUMN_NOT_PROVIDED_FOR_JOIN" | "MODEL_HAS_NO_PRIMARY_KEY" | "GLOBAL_TRANSACTION_ALREADY_STARTED" | "GLOBAL_TRANSACTION_NOT_STARTED" | "MYSQL_REQUIRES_TABLE_NAME_FOR_INDEX_DROP" | "INVALID_DATE_OBJECT" | "INVALID_DATE_STRING" | "FAILED_TO_PARSE_DATE" | "MIGRATION_MODULE_REQUIRES_TS_NODE" | "FAILED_TO_ENCRYPT_SYMMETRICALLY" | "FAILED_TO_DECRYPT_SYMMETRICALLY" | "FAILED_TO_ENCRYPT_ASYMMETRICALLY" | "FAILED_TO_DECRYPT_ASYMMETRICALLY" | "UNSUPPORTED_RELATION_TYPE" | "LPUSH_FAILED" | "RPUSH_FAILED" | "LPOP_FAILED" | "RPOP_FAILED" | "LRANGE_FAILED" | "LLEN_FAILED" | "HSET_FAILED" | "HMSET_FAILED" | "HGET_FAILED" | "HGETALL_FAILED" | "HMGET_FAILED" | "HDEL_FAILED" | "HEXISTS_FAILED" | "HKEYS_FAILED" | "HLEN_FAILED" | "SADD_FAILED" | "SMEMBERS_FAILED" | "SREM_FAILED" | "SISMEMBER_FAILED" | "SCARD_FAILED" | "SINTER_FAILED" | "SUNION_FAILED" | "SDIFF_FAILED" | "ZADD_FAILED" | "ZRANGE_FAILED" | "ZREVRANGE_FAILED" | "ZREM_FAILED" | "ZSCORE_FAILED" | "ZCARD_FAILED" | "SUBSCRIBE_FAILED" | "UNSUBSCRIBE_FAILED" | "PUBLISH_FAILED" | "PSUBSCRIBE_FAILED" | "PUNSUBSCRIBE_FAILED" | "EXISTS_FAILED" | "EXPIRE_FAILED" | "EXPIREAT_FAILED" | "PEXPIRE_FAILED" | "TTL_FAILED" | "PTTL_FAILED" | "PERSIST_FAILED" | "KEYS_FAILED" | "RENAME_FAILED" | "TYPE_FAILED" | "SCAN_FAILED" | "ADMINJS_NOT_ENABLED" | "ADMINJS_INITIALIZATION_FAILED" | "ADMINJS_NO_MODELS_PROVIDED" | "ZOD_ENGINE_NOT_LOADED" | "ATOMIC_DATASOURCE_RESOLUTION_FAILED" | "ATOMIC_INVALID_METHOD" | "ATOMIC_CLS_DISABLED" | `SCOPE_NOT_FOUND_${string}`;
8009
8292
 
8010
8293
  declare class HysteriaError extends Error {
8011
8294
  code: HysteriaErrorCode;
@@ -8143,4 +8426,4 @@ declare const generateOpenApiModelWithMetadata: <T extends new () => Model>(mode
8143
8426
  $id?: string;
8144
8427
  }>;
8145
8428
 
8146
- export { type AdminJsActionOptions, type AdminJsAssets, type AdminJsBranding, type AdminJsInstance, type AdminJsLocale, type AdminJsOptions, type AdminJsPage, type AdminJsPropertyOptions, type AdminJsResourceOptions, type AdminJsSettings, type AnyModelConstructor, type BaseModelMethodOptions, BaseSeeder, type BuildSelectType, type BuildSingleSelectType, type CacheAdapter, type CacheKeys, ClientMigrator, type ColCharOptions, type ColJsonbOptions, type ColMediumIntOptions, type ColSmallIntOptions, type ColTinyIntOptions, type ColVarbinaryOptions, Collection, type CollectionDefinition, type ColumnDef, type CommonDataSourceInput, type ComposeBuildSelect, type ComposeSelect, type ConnectionPolicies, type CreateSchemaResult, type CustomLogger, type DataSourceInput, type DataSourceType, type DateAutoHook, type DefinedCollection, type DefinedModel, type DefinedView, type ExcludeMethods, type ExtractColumnName, type ExtractSourceColumn, type FetchHooks, type FindReturnType, type GetColumnType, type GetConnectionReturnType, HysteriaError, InMemoryAdapter, type InferPK, type IntrospectedColumn, type IntrospectedForeignKey, type IntrospectedSchema, type IntrospectedTable, type JsonPathInput, type JsonPaths, type LoadOptions, type LoggerConfig, type ManyOptions, Migration, type MigrationConfig, type MigrationConfigBase, type ModelColumns, type ModelDataProperties, type ModelInstanceType, type ModelKey, ModelQueryBuilder, type ModelQueryResult, type ModelRelation, type ModelSelectTuple, type ModelSelectableInput, type ModelWithoutRelations, type ModelsProxy, MongoDataSource, type MongoDataSourceInput$1 as MongoDataSourceInput, type MssqlConnectionInstance, type MssqlDataSourceInput, type MssqlPoolInstance, type MutationReturningResult, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullableOracleDBDataSourceInput, type NotNullableOracleMssqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NullableColumn, type NumberModelKey, ObserverChain, ObserverChainWrapper, type OneOptions, type Operation, type OracleDBDataSourceInput, type OracleDBPoolInstance, type PgPoolClientInstance, type PingResult, type PostgresSqlDataSourceInput, type PrimaryColumnDef, type PropNamespace, type PropertyDef, QueryBuilder, type QueryContext, type QueryContextWithDuration, type QueryObserver, type RawModelKey, type RawModelOptions, RawNode, type RawQueryOptions, RedisCacheAdapter, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationDef, type RelationDefinitions, type RelationHelpers, type RelationLoadStrategy, type RelationQueryBuilderType, type ReplicationType, type ResolveColumnType, type ResolveJsonPathType, type ReturningColumns, type ReturningKey, type ReturningParam, type ReturningResult, type ReturningResultMany, type ReturningSupported, Schema, SchemaBuilder, type SchemaLookup, type SchemaRelDef, 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 StripTablePrefix, type SubQueryable, type TableFormat, Transaction, type TransactionExecutionOptions, type TypedDefault, type TypedJsonPathInput, type TypedPrepare, type TypedSerialize, type UseCacheReturnType, type UseConnectionInput, type ValidationContext, ValidationError, type ValidationResult, type Validator, type ViewDefinition, WriteOperation, type WriteReturnType, col, createSchema, defineCollection, defineMigrator, defineModel, defineModelFactory, defineRelations, defineView, deriveOperationFromQuery, email, enumValidator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, type getPoolReturnType, HysteriaLogger as logger, max, maxLength, min, minLength, pattern, prop, RedisDataSource as redis, required, url };
8429
+ export { type AdminJsActionOptions, type AdminJsAssets, type AdminJsBranding, type AdminJsInstance, type AdminJsLocale, type AdminJsOptions, type AdminJsPage, type AdminJsPropertyOptions, type AdminJsResourceOptions, type AdminJsSettings, type AnyModelConstructor, type AtomicOptions, type BaseModelMethodOptions, BaseSeeder, type BuildSelectType, type BuildSingleSelectType, type CacheAdapter, type CacheKeys, ClientMigrator, type ColCharOptions, type ColJsonbOptions, type ColMediumIntOptions, type ColSmallIntOptions, type ColTinyIntOptions, type ColVarbinaryOptions, Collection, type CollectionDefinition, type ColumnDef, type CommonDataSourceInput, type ComposeBuildSelect, type ComposeSelect, type ConnectionPolicies, type CreateSchemaResult, type CustomLogger, type DataSourceInput, type DataSourceType, type DateAutoHook, type DefinedCollection, type DefinedModel, type DefinedView, type ExcludeMethods, type ExtractColumnName, type ExtractSourceColumn, type FetchHooks, type FindReturnType, type GetColumnType, type GetConnectionReturnType, HysteriaError, type HysteriaErrorCode, InMemoryAdapter, type InferPK, type IntrospectedColumn, type IntrospectedForeignKey, type IntrospectedSchema, type IntrospectedTable, type JsonPathInput, type JsonPaths, type LoadOptions, type LoggerConfig, type ManyOptions, Migration, type MigrationConfig, type MigrationConfigBase, type MigrationLockConfig, type ModelColumns, type ModelDataProperties, type ModelInstanceType, type ModelKey, ModelQueryBuilder, type ModelQueryResult, type ModelRelation, type ModelSelectTuple, type ModelSelectableInput, type ModelWithoutRelations, type ModelsProxy, MongoDataSource, type MongoDataSourceInput$1 as MongoDataSourceInput, type MssqlConnectionInstance, type MssqlDataSourceInput, type MssqlPoolInstance, type MutationReturningResult, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullableOracleDBDataSourceInput, type NotNullableOracleMssqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NullableColumn, type NumberModelKey, ObserverChain, ObserverChainWrapper, type OneOptions, type Operation, type OracleDBDataSourceInput, type OracleDBPoolInstance, type PgPoolClientInstance, type PingResult, type PostgresSqlDataSourceInput, type PrimaryColumnDef, type PropNamespace, type PropertyDef, QueryBuilder, type QueryContext, type QueryContextWithDuration, type QueryObserver, type RawModelKey, type RawModelOptions, RawNode, type RawQueryOptions, RedisCacheAdapter, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationDef, type RelationDefinitions, type RelationHelpers, type RelationLoadStrategy, type RelationQueryBuilderType, type ReplicationType, type ResolveColumnType, type ResolveJsonPathType, type ReturningColumns, type ReturningKey, type ReturningParam, type ReturningResult, type ReturningResultMany, type ReturningSupported, Schema, SchemaBuilder, type SchemaLookup, type SchemaRelDef, 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 StripTablePrefix, type SubQueryable, type TableFormat, Transaction, type TransactionExecutionOptions, type TypedDefault, type TypedJsonPathInput, type TypedPrepare, type TypedSerialize, type UseCacheReturnType, type UseConnectionInput, type ValidationContext, ValidationError, type ValidationResult, type Validator, type ViewDefinition, WriteOperation, type WriteReturnType, atomic, col, createSchema, defineCollection, defineMigrator, defineModel, defineModelFactory, defineRelations, defineView, deriveOperationFromQuery, email, enumValidator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, type getPoolReturnType, HysteriaLogger as logger, max, maxLength, min, minLength, pattern, prop, RedisDataSource as redis, required, url };