hysteria-orm 10.2.1 → 10.2.3

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
@@ -1,3 +1,5 @@
1
+ import * as mssql from 'mssql';
2
+ import { config, Transaction as Transaction$1 } from 'mssql';
1
3
  import * as mongodb from 'mongodb';
2
4
  import { Collection as Collection$1 } from 'mongodb';
3
5
  import * as sqlite3 from 'sqlite3';
@@ -32,7 +34,15 @@ declare abstract class Entity {
32
34
  /**
33
35
  * @description Creates a datasource for the selected database type with the provided credentials
34
36
  */
35
- type DataSourceType = "cockroachdb" | "mysql" | "postgres" | "mariadb" | "sqlite" | "mongo";
37
+ type DataSourceType = "cockroachdb" | "mysql" | "postgres" | "mariadb" | "sqlite" | "mssql" | "mongo";
38
+ interface MssqlDataSourceInput extends CommonDataSourceInput {
39
+ readonly type: "mssql";
40
+ readonly host?: string;
41
+ readonly port?: number;
42
+ readonly username?: string;
43
+ readonly password?: string;
44
+ readonly database?: string;
45
+ }
36
46
  interface CommonDataSourceInput {
37
47
  readonly type?: DataSourceType;
38
48
  readonly logs?: boolean;
@@ -85,16 +95,20 @@ interface NotNullableSqliteDataSourceInput extends SqliteDataSourceInput {
85
95
  /**
86
96
  * @description By default the connection details can be provided in the .env file, you can still override each prop with your actual connection details in the input
87
97
  */
88
- type DataSourceInput = MysqlSqlDataSourceInput | SqliteDataSourceInput | PostgresSqlDataSourceInput | MongoDataSourceInput;
98
+ type DataSourceInput = MssqlDataSourceInput | MysqlSqlDataSourceInput | SqliteDataSourceInput | PostgresSqlDataSourceInput | MongoDataSourceInput;
89
99
 
90
100
  type Mysql2Import = typeof mysql2_promise;
91
101
  type PgImport = typeof pg;
92
102
  type Sqlite3Import = typeof sqlite3;
93
103
  type MongoClientImport = typeof mongodb;
104
+ type MssqlImport = typeof mssql;
94
105
  type MysqlCreateConnectionOptions = PoolOptions;
95
106
  type PgClientOptions = ClientConfig;
107
+ type MssqlConnectionOptions = Omit<config, "options"> & {
108
+ options?: Omit<NonNullable<config["options"]>, "abortTransactionOnError" | "enableImplicitTransactions">;
109
+ };
96
110
  type MongoConnectionOptions = NonNullable<ConstructorParameters<MongoClientImport["MongoClient"]>[1]>;
97
- type DriverSpecificOptions<T extends DataSourceType> = T extends "mongo" ? MongoConnectionOptions : T extends "cockroachdb" | "postgres" ? PgClientOptions : T extends "redis" ? RedisOptions : T extends "mysql" | "mariadb" ? MysqlCreateConnectionOptions : never;
111
+ type DriverSpecificOptions<T extends DataSourceType> = T extends "mongo" ? MongoConnectionOptions : T extends "cockroachdb" | "postgres" ? PgClientOptions : T extends "redis" ? RedisOptions : T extends "mysql" | "mariadb" ? MysqlCreateConnectionOptions : T extends "mssql" ? MssqlConnectionOptions : never;
98
112
 
99
113
  type MongoCollectionKey<T> = T extends Collection ? T : never;
100
114
  type BaseModelMethodOptions$1 = {
@@ -436,6 +450,7 @@ declare abstract class DataSource {
436
450
  protected handleMysqlSource(input?: MysqlSqlDataSourceInput): void;
437
451
  protected handleSqliteSource(input?: SqliteDataSourceInput): void;
438
452
  protected handleMongoSource(input?: MongoDataSourceInput): void;
453
+ protected handleMssqlSource(input?: MssqlDataSourceInput): void;
439
454
  }
440
455
 
441
456
  type MongoFindOneOptions<T extends Collection> = {
@@ -707,6 +722,318 @@ type ForeignKeyOptions = CommonConstraintOptions & {
707
722
  };
708
723
  type CreateTableContext = "alter_table" | "create_table";
709
724
 
725
+ /**
726
+ * @description AdminJS plugin types - All AdminJS imports are done at runtime via dynamic import()
727
+ * @description This ensures the plugin is completely optional
728
+ */
729
+
730
+ /**
731
+ * @description Configuration options for AdminJS integration
732
+ */
733
+ type AdminJsOptions = {
734
+ /**
735
+ * @description Whether to enable AdminJS admin panel
736
+ * @default false
737
+ */
738
+ enabled?: boolean;
739
+ /**
740
+ * @description The root path for the AdminJS panel
741
+ * @default '/admin'
742
+ */
743
+ rootPath?: string;
744
+ /**
745
+ * @description Custom branding options for AdminJS
746
+ */
747
+ branding?: AdminJsBranding;
748
+ /**
749
+ * @description Models to expose in the AdminJS panel
750
+ * @description If not provided, all models registered in the SqlDataSource will be used
751
+ */
752
+ resources?: (typeof Model)[];
753
+ /**
754
+ * @description Custom resource options for specific models
755
+ */
756
+ resourceOptions?: Record<string, AdminJsResourceOptions>;
757
+ /**
758
+ * @description Locale settings for AdminJS
759
+ */
760
+ locale?: AdminJsLocale;
761
+ /**
762
+ * @description Assets configuration
763
+ */
764
+ assets?: AdminJsAssets;
765
+ /**
766
+ * @description Settings configuration
767
+ */
768
+ settings?: AdminJsSettings;
769
+ /**
770
+ * @description Custom pages to add to AdminJS
771
+ */
772
+ pages?: Record<string, AdminJsPage>;
773
+ };
774
+ type AdminJsBranding = {
775
+ /**
776
+ * @description Company name displayed in the admin panel
777
+ */
778
+ companyName?: string;
779
+ /**
780
+ * @description URL to the company logo
781
+ */
782
+ logo?: string;
783
+ /**
784
+ * @description URL to the favicon
785
+ */
786
+ favicon?: string;
787
+ /**
788
+ * @description Whether to display the "Made with AdminJS" notice
789
+ * @default true
790
+ */
791
+ withMadeWithLove?: boolean;
792
+ /**
793
+ * @description Theme settings
794
+ */
795
+ theme?: Record<string, unknown>;
796
+ /**
797
+ * @description Software brothers branding override
798
+ */
799
+ softwareBrothers?: boolean;
800
+ };
801
+ type AdminJsResourceOptions = {
802
+ /**
803
+ * @description Navigation settings for this resource
804
+ */
805
+ navigation?: {
806
+ name?: string;
807
+ icon?: string;
808
+ } | null;
809
+ /**
810
+ * @description Custom name for the resource
811
+ */
812
+ name?: string;
813
+ /**
814
+ * @description Properties configuration
815
+ */
816
+ properties?: Record<string, AdminJsPropertyOptions>;
817
+ /**
818
+ * @description Actions configuration
819
+ */
820
+ actions?: Record<string, AdminJsActionOptions>;
821
+ /**
822
+ * @description Sort configuration
823
+ */
824
+ sort?: {
825
+ sortBy?: string;
826
+ direction?: "asc" | "desc";
827
+ };
828
+ /**
829
+ * @description List of properties to display in list view
830
+ */
831
+ listProperties?: string[];
832
+ /**
833
+ * @description List of properties to display in show view
834
+ */
835
+ showProperties?: string[];
836
+ /**
837
+ * @description List of properties to display in edit view
838
+ */
839
+ editProperties?: string[];
840
+ /**
841
+ * @description List of properties to display in filter view
842
+ */
843
+ filterProperties?: string[];
844
+ /**
845
+ * @description Parent resource for navigation grouping
846
+ */
847
+ parent?: {
848
+ name?: string;
849
+ icon?: string;
850
+ } | null;
851
+ };
852
+ type AdminJsPropertyOptions = {
853
+ /**
854
+ * @description Whether the property is visible in the list view
855
+ */
856
+ isVisible?: boolean | {
857
+ list?: boolean;
858
+ edit?: boolean;
859
+ filter?: boolean;
860
+ show?: boolean;
861
+ };
862
+ /**
863
+ * @description Position of the property in forms
864
+ */
865
+ position?: number;
866
+ /**
867
+ * @description Whether the property is required
868
+ */
869
+ isRequired?: boolean;
870
+ /**
871
+ * @description Whether the property is an ID
872
+ */
873
+ isId?: boolean;
874
+ /**
875
+ * @description Whether the property is a title
876
+ */
877
+ isTitle?: boolean;
878
+ /**
879
+ * @description Whether the property is disabled in edit forms
880
+ */
881
+ isDisabled?: boolean;
882
+ /**
883
+ * @description Whether the property is an array
884
+ */
885
+ isArray?: boolean;
886
+ /**
887
+ * @description Whether the property is sortable
888
+ */
889
+ isSortable?: boolean;
890
+ /**
891
+ * @description Property type override
892
+ */
893
+ type?: string;
894
+ /**
895
+ * @description Available values for select/enum properties
896
+ */
897
+ availableValues?: Array<{
898
+ value: string | number;
899
+ label: string;
900
+ }>;
901
+ /**
902
+ * @description Custom components for rendering
903
+ */
904
+ components?: {
905
+ list?: string;
906
+ show?: string;
907
+ edit?: string;
908
+ filter?: string;
909
+ };
910
+ /**
911
+ * @description Custom props to pass to components
912
+ */
913
+ props?: Record<string, unknown>;
914
+ /**
915
+ * @description Description shown in the UI
916
+ */
917
+ description?: string;
918
+ };
919
+ type AdminJsActionOptions = {
920
+ /**
921
+ * @description Action type
922
+ */
923
+ actionType?: "record" | "resource" | "bulk";
924
+ /**
925
+ * @description Whether the action is visible
926
+ */
927
+ isVisible?: boolean;
928
+ /**
929
+ * @description Whether the action is accessible
930
+ */
931
+ isAccessible?: boolean;
932
+ /**
933
+ * @description Icon for the action
934
+ */
935
+ icon?: string;
936
+ /**
937
+ * @description Label for the action
938
+ */
939
+ label?: string;
940
+ /**
941
+ * @description Guard message shown before action execution
942
+ */
943
+ guard?: string;
944
+ /**
945
+ * @description Whether to show the action in the drawer
946
+ */
947
+ showInDrawer?: boolean;
948
+ /**
949
+ * @description Whether to hide the action button
950
+ */
951
+ hideActionHeader?: boolean;
952
+ /**
953
+ * @description Custom component for the action
954
+ */
955
+ component?: string | false;
956
+ /**
957
+ * @description Container width for the action
958
+ */
959
+ containerWidth?: number | string;
960
+ /**
961
+ * @description Layout configuration
962
+ */
963
+ layout?: unknown[];
964
+ };
965
+ type AdminJsLocale = {
966
+ /**
967
+ * @description Language code
968
+ */
969
+ language?: string;
970
+ /**
971
+ * @description Available languages
972
+ */
973
+ availableLanguages?: string[];
974
+ /**
975
+ * @description Custom translations
976
+ */
977
+ translations?: Record<string, Record<string, unknown>>;
978
+ /**
979
+ * @description Whether to show the language selector
980
+ */
981
+ withBackend?: boolean;
982
+ };
983
+ type AdminJsAssets = {
984
+ /**
985
+ * @description Custom styles to include
986
+ */
987
+ styles?: string[];
988
+ /**
989
+ * @description Custom scripts to include
990
+ */
991
+ scripts?: string[];
992
+ };
993
+ type AdminJsSettings = {
994
+ /**
995
+ * @description Default number of items per page
996
+ */
997
+ defaultPerPage?: number;
998
+ };
999
+ type AdminJsPage = {
1000
+ /**
1001
+ * @description Page component path
1002
+ */
1003
+ component?: string;
1004
+ /**
1005
+ * @description Page icon
1006
+ */
1007
+ icon?: string;
1008
+ /**
1009
+ * @description Handler for the page
1010
+ */
1011
+ handler?: (request: unknown, response: unknown, context: unknown) => Promise<unknown>;
1012
+ };
1013
+ type AdminJsAdminInstance = {
1014
+ options: {
1015
+ rootPath: string;
1016
+ [key: string]: unknown;
1017
+ };
1018
+ watch: () => Promise<void>;
1019
+ initialize: () => Promise<void>;
1020
+ resources: unknown[];
1021
+ findResource: (resourceId: string) => unknown;
1022
+ };
1023
+ /**
1024
+ * @description Return type for getAdminJs method
1025
+ */
1026
+ type AdminJsInstance = {
1027
+ /**
1028
+ * @description The AdminJS instance
1029
+ */
1030
+ admin: AdminJsAdminInstance;
1031
+ /**
1032
+ * @description Express router for AdminJS (if using express adapter)
1033
+ */
1034
+ router?: unknown;
1035
+ };
1036
+
710
1037
  interface CacheAdapter {
711
1038
  get<T = void>(key: string): Promise<T>;
712
1039
  set<T = any>(key: string, data: T, ttl?: number): Promise<void>;
@@ -787,7 +1114,7 @@ declare class ConstraintNode extends QueryNode {
787
1114
  constraintName?: string;
788
1115
  onDelete?: "cascade" | "restrict" | "set null" | "no action";
789
1116
  onUpdate?: "cascade" | "restrict" | "set null" | "no action";
790
- defaultValue?: string;
1117
+ defaultValue?: string | RawNode | undefined;
791
1118
  checkExpression?: string;
792
1119
  chainsWith: string;
793
1120
  canKeywordBeSeenMultipleTimes: boolean;
@@ -802,7 +1129,7 @@ declare class ConstraintNode extends QueryNode {
802
1129
  constraintName?: string;
803
1130
  onDelete?: "cascade" | "restrict" | "set null" | "no action";
804
1131
  onUpdate?: "cascade" | "restrict" | "set null" | "no action";
805
- defaultValue?: string;
1132
+ defaultValue?: string | RawNode | undefined;
806
1133
  checkExpression?: string;
807
1134
  }, isRawValue?: boolean);
808
1135
  }
@@ -905,7 +1232,7 @@ declare class ConstraintBuilder extends BaseBuilder {
905
1232
  * @description Sets the default value for the column
906
1233
  * @param value is the default value for the column
907
1234
  */
908
- default(value: string | number | boolean | null): this;
1235
+ default(value: string | number | boolean | null | RawNode): this;
909
1236
  /**
910
1237
  * @description Sets the column to unique
911
1238
  * @param options is the options for the unique constraint
@@ -1211,35 +1538,42 @@ declare class AlterTableBuilder extends BaseBuilder {
1211
1538
  /**
1212
1539
  * @description Adds a column to the table
1213
1540
  * @param cb is the callback that will be used to build the column
1541
+ * @mssql Auto-generates default constraint names (DF__table__col__xxxxx) which are hard to drop later
1214
1542
  */
1215
1543
  addColumn(cb: (col: CreateTableBuilder) => ConstraintBuilder): void;
1216
1544
  /**
1217
1545
  * @description Alters a column, can generate multiple sql statements depending on the constraints
1218
1546
  * @throws HysteriaError if sqlite database
1547
+ * @mssql Cannot alter columns with DEFAULT/CHECK constraints or indexes - drop them first
1219
1548
  */
1220
1549
  alterColumn(columnBuilder: (col: CreateTableBuilder) => ConstraintBuilder): void;
1221
1550
  /**
1222
1551
  * @description Drops a column
1552
+ * @mssql Must drop all dependent constraints and indexes before dropping the column
1223
1553
  */
1224
1554
  dropColumn(name: string): void;
1225
1555
  /**
1226
1556
  * @description Renames a column
1557
+ * @mssql Uses sp_rename procedure; does not update references in views/procedures/triggers
1227
1558
  */
1228
1559
  renameColumn(oldName: string, newName: string): void;
1229
1560
  /**
1230
1561
  * @description Drops a default value from a column
1231
1562
  * @sqlite not supported and will throw error
1563
+ * @mssql Requires constraint name; use dropConstraint() with name from sys.default_constraints
1232
1564
  */
1233
1565
  dropDefault(columnName: string): void;
1234
1566
  /**
1235
1567
  * @description Adds a primary key constraint to a column
1236
1568
  * @param columnName is the column name to add the primary key to
1237
1569
  * @sqlite not supported and will throw error
1570
+ * @mssql Column must be NOT NULL before adding primary key
1238
1571
  */
1239
1572
  addPrimaryKey(columnName: string): void;
1240
1573
  /**
1241
1574
  * @description Raw non type safe way builder to add a constraint
1242
1575
  * @sqlite not supported and will throw error
1576
+ * @mssql UNIQUE does not allow multiple NULLs (unlike PostgreSQL)
1243
1577
  */
1244
1578
  addConstraint(...options: ConstructorParameters<typeof ConstraintNode>): void;
1245
1579
  /**
@@ -1285,6 +1619,7 @@ declare class AlterTableBuilder extends BaseBuilder {
1285
1619
  * @postgres not supported, use `dropConstraint` instead with the pk constraint name
1286
1620
  * @sqlite not supported and will throw error
1287
1621
  * @throws HysteriaError if postgres and table is not provided
1622
+ * @mssql Foreign keys referencing this primary key must be dropped first
1288
1623
  */
1289
1624
  dropPrimaryKey(table?: string): void;
1290
1625
  }
@@ -1304,12 +1639,14 @@ declare class Schema {
1304
1639
  runFile(filePath: string): void;
1305
1640
  /**
1306
1641
  * @description Create table constructor
1642
+ * @mssql Does not support ifNotExists option
1307
1643
  */
1308
1644
  createTable(table: string, cb: (table: CreateTableBuilder) => void, options?: {
1309
1645
  ifNotExists?: boolean;
1310
1646
  }): void;
1311
1647
  /**
1312
1648
  * @description Alter table constructor
1649
+ * @mssql Limited support - cannot modify columns with constraints; see AlterTableBuilder methods for details
1313
1650
  */
1314
1651
  alterTable(table: string, cb: (t: AlterTableBuilder) => void): void;
1315
1652
  /**
@@ -1318,6 +1655,7 @@ declare class Schema {
1318
1655
  dropTable(table: string, ifExists?: boolean): void;
1319
1656
  /**
1320
1657
  * @description Rename table in the database
1658
+ * @mssql Uses sp_rename procedure; does not update references in views/procedures/triggers
1321
1659
  */
1322
1660
  renameTable(oldTable: string, newTable: string): void;
1323
1661
  /**
@@ -1623,7 +1961,7 @@ declare abstract class Relation {
1623
1961
 
1624
1962
  type ColumnDataType = Exclude<keyof CreateTableBuilder, "enum" | "rawColumn" | "custom"> | readonly string[];
1625
1963
  type ColumnDataTypeOptionWithLength = {
1626
- type?: "char" | "varchar" | "string" | "uuid" | "ulid" | "varbinary" | "integer" | "tinyint" | "smallint" | "mediumint" | "bigint";
1964
+ type?: "char" | "varchar" | "string" | "uuid" | "ulid" | "varbinary" | "integer" | "tinyint" | "smallint" | "mediumint" | "bigint" | "increment" | "bigIncrement";
1627
1965
  length?: number;
1628
1966
  };
1629
1967
  type ColumnDataTypeOptionWithEnum = {
@@ -2270,23 +2608,44 @@ declare abstract class WhereQueryBuilder<T extends Model> extends SelectQueryBui
2270
2608
  orWhereNotNull<S extends string>(column: SelectableColumn<S>): this;
2271
2609
  /**
2272
2610
  * @description Adds a WHERE REGEXP condition to the query.
2611
+ * @mssql doesn't support REGEXP syntax
2612
+ * @sqlite doesn't support REGEXP syntax
2273
2613
  */
2274
2614
  whereRegexp(column: ModelKey<T>, regexp: RegExp): this;
2275
2615
  whereRegexp<S extends string>(column: SelectableColumn<S>, regexp: RegExp): this;
2276
2616
  /**
2277
2617
  * @description Adds an AND WHERE REGEXP condition to the query.
2618
+ * @mssql doesn't support REGEXP syntax
2619
+ * @sqlite doesn't support REGEXP syntax
2278
2620
  */
2279
2621
  andWhereRegexp(column: ModelKey<T>, regexp: RegExp): this;
2280
2622
  andWhereRegexp<S extends string>(column: SelectableColumn<S>, regexp: RegExp): this;
2281
2623
  /**
2282
2624
  * @description Adds an OR WHERE REGEXP condition to the query.
2625
+ * @mssql doesn't support REGEXP syntax
2626
+ * @sqlite doesn't support REGEXP syntax
2283
2627
  */
2284
2628
  orWhereRegexp(column: ModelKey<T>, regexp: RegExp): this;
2285
2629
  orWhereRegexp<S extends string>(column: SelectableColumn<S>, regexp: RegExp): this;
2630
+ /**
2631
+ * @description Adds a WHERE NOT REGEXP condition to the query.
2632
+ * @mssql doesn't support REGEXP syntax
2633
+ * @sqlite doesn't support REGEXP syntax
2634
+ */
2286
2635
  whereNotRegexp(column: ModelKey<T>, regexp: RegExp): this;
2287
2636
  whereNotRegexp<S extends string>(column: SelectableColumn<S>, regexp: RegExp): this;
2637
+ /**
2638
+ * @description Adds an AND WHERE NOT REGEXP condition to the query.
2639
+ * @mssql doesn't support REGEXP syntax
2640
+ * @sqlite doesn't support REGEXP syntax
2641
+ */
2288
2642
  andWhereNotRegexp(column: ModelKey<T>, regexp: RegExp): this;
2289
2643
  andWhereNotRegexp<S extends string>(column: SelectableColumn<S>, regexp: RegExp): this;
2644
+ /**
2645
+ * @description Adds an OR WHERE NOT REGEXP condition to the query.
2646
+ * @mssql doesn't support REGEXP syntax
2647
+ * @sqlite doesn't support REGEXP syntax
2648
+ */
2290
2649
  orWhereNotRegexp(column: ModelKey<T>, regexp: RegExp): this;
2291
2650
  orWhereNotRegexp<S extends string>(column: SelectableColumn<S>, regexp: RegExp): this;
2292
2651
  /**
@@ -2368,47 +2727,55 @@ declare class JsonQueryBuilder<T extends Model> extends WhereQueryBuilder<T> {
2368
2727
  whereJson(column: string, value: JsonParam): this;
2369
2728
  /**
2370
2729
  * @description Filters records matching the given JSON value.
2730
+ * @mssql Partial JSON matching not supported - only exact matches work
2371
2731
  */
2372
2732
  andWhereJson(column: ModelKey<T>, value: JsonParam): this;
2373
2733
  andWhereJson(column: string, value: JsonParam): this;
2374
2734
  /**
2375
2735
  * @description Filters records matching the given JSON value.
2736
+ * @mssql Partial JSON matching not supported - only exact matches work
2376
2737
  */
2377
2738
  orWhereJson(column: ModelKey<T>, value: JsonParam): this;
2378
2739
  orWhereJson(column: string, value: JsonParam): this;
2379
2740
  /**
2380
2741
  * @description Filters records where JSON column does NOT contain the given value.
2381
2742
  * @sqlite might not work for all cases, suggest using the whereJsonRaw method instead
2743
+ * @mssql not supported - CHARINDEX cannot do partial JSON containment
2382
2744
  */
2383
2745
  whereJsonNotContains(column: ModelKey<T>, value: JsonParam): this;
2384
2746
  whereJsonNotContains(column: string, value: JsonParam): this;
2385
2747
  /**
2386
2748
  * @description Filters records where JSON column does NOT contain the given value (AND).
2387
2749
  * @sqlite might not work for all cases, suggest using the whereJsonRaw method instead
2750
+ * @mssql not supported - CHARINDEX cannot do partial JSON containment
2388
2751
  */
2389
2752
  andWhereJsonNotContains(column: ModelKey<T>, value: JsonParam): this;
2390
2753
  andWhereJsonNotContains(column: string, value: JsonParam): this;
2391
2754
  /**
2392
2755
  * @description Filters records where JSON column does NOT contain the given value (OR).
2393
2756
  * @sqlite might not work for all cases, suggest using the whereJsonRaw method instead
2757
+ * @mssql not supported - CHARINDEX cannot do partial JSON containment
2394
2758
  */
2395
2759
  orWhereJsonNotContains(column: ModelKey<T>, value: JsonParam): this;
2396
2760
  orWhereJsonNotContains(column: string, value: JsonParam): this;
2397
2761
  /**
2398
2762
  * @description Filters records where JSON column contains the given value.
2399
2763
  * @sqlite might not work for all cases, suggest using the whereJsonRaw method instead
2764
+ * @mssql not supported - CHARINDEX cannot do partial JSON containment
2400
2765
  */
2401
2766
  whereJsonContains(column: ModelKey<T>, value: JsonParam): this;
2402
2767
  whereJsonContains(column: string, value: JsonParam): this;
2403
2768
  /**
2404
2769
  * @description Filters records where JSON column contains the given value (AND).
2405
2770
  * @sqlite might not work for all cases, suggest using the whereJsonRaw method instead
2771
+ * @mssql not supported - CHARINDEX cannot do partial JSON containment
2406
2772
  */
2407
2773
  andWhereJsonContains(column: ModelKey<T>, value: JsonParam): this;
2408
2774
  andWhereJsonContains(column: string, value: JsonParam): this;
2409
2775
  /**
2410
2776
  * @description Filters records where JSON column contains the given value (OR).
2411
2777
  * @sqlite might not work for all cases, suggest using the whereJsonRaw method instead
2778
+ * @mssql not supported - CHARINDEX cannot do partial JSON containment
2412
2779
  */
2413
2780
  orWhereJsonContains(column: ModelKey<T>, value: JsonParam): this;
2414
2781
  orWhereJsonContains(column: string, value: JsonParam): this;
@@ -2601,6 +2968,7 @@ declare class Transaction {
2601
2968
  private releaseConnection;
2602
2969
  private getIsolationLevelQuery;
2603
2970
  private getSavePointName;
2971
+ private getMssqlTransactionLevel;
2604
2972
  }
2605
2973
 
2606
2974
  type ModelWithoutRelations<T extends Model> = Pick<T, ExcludeRelations<Omit<T, "*">>>;
@@ -2815,6 +3183,8 @@ declare class ModelQueryBuilder<T extends Model, A extends Record<string, any> =
2815
3183
  * @warning Many to many relations have special behavior, since they require a join, a join clause will always be added to the query.
2816
3184
  * @warning Many to many relations uses the model foreign key for mapping in the `$annotations` property, this property will be removed from the model after the relation is filled.
2817
3185
  * @warning Foreign keys should always be selected in the relation query builder, otherwise the relation will not be filled.
3186
+ * @mssql HasMany relations with limit/offset and orderByRaw may fail with "Ambiguous column name" error - use fully qualified column names (e.g., `table.column`) in orderByRaw
3187
+ * @cockroachdb HasMany relations with limit/offset and orderByRaw may fail with "Ambiguous column name" error - use fully qualified column names (e.g., `table.column`) in orderByRaw
2818
3188
  */
2819
3189
  load<RelationKey extends ModelRelation<T>, IA extends Record<string, any> = {}, IR extends Record<string, any> = {}>(relation: RelationKey, cb: (queryBuilder: RelationQueryBuilderType<RelatedInstance<T, RelationKey>>) => RelationQueryBuilderType<RelatedInstance<T, RelationKey>, IA, IR>): ModelQueryBuilder<T, A, R & {
2820
3190
  [K in RelationKey]: Awaited<ReturnType<ModelQueryBuilder<RelatedInstance<T, K>, IA, IR>[RelationRetrieveMethod<T[K]>]>>;
@@ -2980,6 +3350,10 @@ declare class ModelManager<T extends Model> {
2980
3350
  */
2981
3351
  insertMany(models: Partial<T>[], options?: InsertOptions<T>): Promise<AnnotatedModel<T, {}>[]>;
2982
3352
  upsertMany(conflictColumns: string[], columnsToUpdate: string[], data: ModelWithoutRelations<T>[], options?: UpsertOptions<T>): Promise<AnnotatedModel<T, {}>[]>;
3353
+ /**
3354
+ * @description Executes a MERGE statement for MSSQL upsert operations
3355
+ */
3356
+ private executeMssqlMerge;
2983
3357
  /**
2984
3358
  * @description Updates a record, returns the updated record
2985
3359
  * @description Model is retrieved from the database using the primary key regardless of any model hooks
@@ -3072,6 +3446,18 @@ declare class SqlDataSource extends DataSource {
3072
3446
  * @description Maps global keys to specific handlers for cache handling
3073
3447
  */
3074
3448
  cacheKeys: CacheKeys;
3449
+ /**
3450
+ * @description The path to the migrations folder for the sql data source, it's used to configure the migrations path for the sql data source
3451
+ */
3452
+ migrationsPath: string;
3453
+ /**
3454
+ * @description AdminJS configuration options
3455
+ */
3456
+ private adminJsOptions?;
3457
+ /**
3458
+ * @description Cached AdminJS instance
3459
+ */
3460
+ private adminJsInstance?;
3075
3461
  /**
3076
3462
  * @description Establishes the default singleton connection used by default by all the Models, if not configuration is passed, env variables will be used instead
3077
3463
  * @description You can continue to use the global sql class exported by hysteria after the connection without having to rely on the return of this function
@@ -3208,6 +3594,32 @@ declare class SqlDataSource extends DataSource {
3208
3594
  * ```
3209
3595
  */
3210
3596
  static rawStatement(value: string): RawNode;
3597
+ /**
3598
+ * @description Initializes AdminJS with the configured options
3599
+ * @description All AdminJS dependencies are loaded at runtime via dynamic import() to keep the plugin optional
3600
+ * @description To use AdminJS, install: npm install adminjs
3601
+ * @throws {HysteriaError} If AdminJS is not enabled or connection not established
3602
+ * @returns The AdminJS instance
3603
+ */
3604
+ static initializeAdminJs(): Promise<AdminJsAdminInstance>;
3605
+ /**
3606
+ * @description Initializes AdminJS with Express router
3607
+ * @description All AdminJS dependencies are loaded at runtime via dynamic import() to keep the plugin optional
3608
+ * @description To use AdminJS with Express, install: npm install adminjs @adminjs/express express express-formidable --save-dev
3609
+ * @throws {HysteriaError} If AdminJS is not enabled or connection not established
3610
+ * @returns The AdminJS instance with Express router
3611
+ */
3612
+ static initializeAdminJsExpress(): Promise<AdminJsInstance>;
3613
+ /**
3614
+ * @description Returns the AdminJS instance if initialized
3615
+ * @returns The AdminJS instance or undefined if not initialized
3616
+ */
3617
+ static getAdminJs(): AdminJsInstance | undefined;
3618
+ /**
3619
+ * @description Checks if AdminJS is enabled
3620
+ * @returns True if AdminJS is enabled
3621
+ */
3622
+ static isAdminJsEnabled(): boolean;
3211
3623
  private constructor();
3212
3624
  /**
3213
3625
  * @description Uses the cache adapter to get a value from the cache
@@ -3371,6 +3783,37 @@ declare class SqlDataSource extends DataSource {
3371
3783
  modelName: string;
3372
3784
  $id?: string;
3373
3785
  })[];
3786
+ /**
3787
+ * @description Initializes AdminJS with the configured options
3788
+ * @description All AdminJS dependencies are loaded at runtime via dynamic import() to keep the plugin optional
3789
+ * @description To use AdminJS, install: npm install adminjs
3790
+ * @throws {HysteriaError} If AdminJS is not enabled in the configuration
3791
+ * @returns The AdminJS instance
3792
+ */
3793
+ initializeAdminJs(): Promise<AdminJsAdminInstance>;
3794
+ /**
3795
+ * @description Initializes AdminJS with Express router
3796
+ * @description All AdminJS dependencies are loaded at runtime via dynamic import() to keep the plugin optional
3797
+ * @description To use AdminJS with Express, install: npm install adminjs @adminjs/express express express-formidable --save-dev
3798
+ * @throws {HysteriaError} If AdminJS is not enabled in the configuration
3799
+ * @returns The AdminJS instance with Express router
3800
+ */
3801
+ initializeAdminJsExpress(): Promise<AdminJsInstance>;
3802
+ /**
3803
+ * @description Returns the AdminJS instance if initialized
3804
+ * @returns The AdminJS instance or undefined if not initialized
3805
+ */
3806
+ getAdminJs(): AdminJsInstance | undefined;
3807
+ /**
3808
+ * @description Returns the AdminJS configuration options
3809
+ * @returns The AdminJS configuration options or undefined if not configured
3810
+ */
3811
+ getAdminJsOptions(): AdminJsOptions | undefined;
3812
+ /**
3813
+ * @description Checks if AdminJS is enabled
3814
+ * @returns True if AdminJS is enabled
3815
+ */
3816
+ isAdminJsEnabled(): boolean;
3374
3817
  /**
3375
3818
  * @description Introspects table columns metadata
3376
3819
  */
@@ -3401,7 +3844,9 @@ type SqlDriverSpecificOptions<T extends DataSourceType> = Omit<DriverSpecificOpt
3401
3844
  type MysqlConnectionInstance = Awaited<ReturnType<Mysql2Import["createPool"]>>;
3402
3845
  type PgPoolClientInstance = InstanceType<PgImport["Pool"]>;
3403
3846
  type SqliteConnectionInstance = InstanceType<Sqlite3Import["Database"]>;
3404
- type SqlPoolType = MysqlConnectionInstance | PgPoolClientInstance | SqliteConnectionInstance;
3847
+ type MssqlPoolInstance = InstanceType<MssqlImport["ConnectionPool"]>;
3848
+ type MssqlConnectionInstance = Awaited<ReturnType<MssqlPoolInstance["connect"]>>;
3849
+ type SqlPoolType = MysqlConnectionInstance | PgPoolClientInstance | SqliteConnectionInstance | MssqlPoolInstance;
3405
3850
  /**
3406
3851
  * @description The connection policies for the sql data source
3407
3852
  * @default By default, the connection policies are not set, so no query will be retried
@@ -3441,8 +3886,14 @@ type SqlDataSourceInput<D extends SqlDataSourceType, T extends Record<string, Sq
3441
3886
  models?: T;
3442
3887
  /**
3443
3888
  * @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
3889
+ * @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`
3444
3890
  */
3445
3891
  driverOptions?: SqlDriverSpecificOptions<D>;
3892
+ /**
3893
+ * @description The path to the migrations folder for the sql data source, it's used to configure the migrations path for the sql data source
3894
+ * @default "database/migrations"
3895
+ */
3896
+ migrationsPath?: string;
3446
3897
  /**
3447
3898
  * @description The cache strategy to use for the sql data source, it's used to configure the cache strategy for the sql data source
3448
3899
  */
@@ -3450,7 +3901,12 @@ type SqlDataSourceInput<D extends SqlDataSourceType, T extends Record<string, Sq
3450
3901
  cacheAdapter?: CacheAdapter;
3451
3902
  keys: C;
3452
3903
  };
3453
- } & (MysqlSqlDataSourceInput | PostgresSqlDataSourceInput | SqliteDataSourceInput);
3904
+ /**
3905
+ * @description AdminJS configuration for the admin panel
3906
+ * @description To use AdminJS, install: `npm install adminjs`
3907
+ */
3908
+ adminJs?: AdminJsOptions;
3909
+ } & (MysqlSqlDataSourceInput | MssqlDataSourceInput | PostgresSqlDataSourceInput | SqliteDataSourceInput);
3454
3910
  type UseConnectionInput<D extends SqlDataSourceType, T extends Record<string, SqlDataSourceModel> = {}, C extends CacheKeys = {}> = {
3455
3911
  readonly type: Exclude<DataSourceType, "mongo">;
3456
3912
  readonly logs?: boolean;
@@ -3462,6 +3918,11 @@ type UseConnectionInput<D extends SqlDataSourceType, T extends Record<string, Sq
3462
3918
  cacheAdapter: CacheAdapter;
3463
3919
  keys: C;
3464
3920
  };
3921
+ /**
3922
+ * @description AdminJS configuration for the admin panel
3923
+ * @description AdminJS is completely optional - dependencies are loaded at runtime via dynamic import()
3924
+ */
3925
+ adminJs?: AdminJsOptions;
3465
3926
  } & (NotNullableMysqlSqlDataSourceInput | NotNullablePostgresSqlDataSourceInput | NotNullableSqliteDataSourceInput);
3466
3927
  type SqlDataSourceType = Exclude<DataSourceType, "mongo">;
3467
3928
  type SqlCloneOptions = {
@@ -3471,8 +3932,8 @@ type SqlCloneOptions = {
3471
3932
  */
3472
3933
  shouldRecreatePool?: boolean;
3473
3934
  };
3474
- type getPoolReturnType<T = SqlDataSourceType> = T extends "mysql" ? MysqlConnectionInstance : T extends "mariadb" ? MysqlConnectionInstance : T extends "postgres" ? PgPoolClientInstance : T extends "cockroachdb" ? PgPoolClientInstance : T extends "sqlite" ? SqliteConnectionInstance : never;
3475
- 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"]> : never;
3935
+ 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 : never;
3936
+ 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 : never;
3476
3937
  type UseCacheOverloads<C extends CacheKeys> = {
3477
3938
  <K extends keyof C>(key: K, ...args: Parameters<C[K]>): Promise<UseCacheReturnType<C, K>>;
3478
3939
  <K extends keyof C>(key: K, ttl: number, ...args: Parameters<C[K]>): Promise<UseCacheReturnType<C, K>>;
@@ -3507,6 +3968,12 @@ declare class AstParser {
3507
3968
  * Map the database type to a common type if shares the same driver (e.g. mysql and mariadb)
3508
3969
  */
3509
3970
  private mapCommonDbType;
3971
+ /**
3972
+ * @description Generates MSSQL table hints from lock node
3973
+ * MSSQL uses WITH (UPDLOCK), WITH (HOLDLOCK), etc. as table hints
3974
+ * READPAST is the MSSQL equivalent of SKIP LOCKED
3975
+ */
3976
+ private getMssqlTableHints;
3510
3977
  }
3511
3978
 
3512
3979
  declare class DeleteNode extends QueryNode {
@@ -3808,6 +4275,7 @@ declare class QueryBuilder<T extends Model = any> extends JsonQueryBuilder<T> {
3808
4275
  with(alias: string, cb: (qb: QueryBuilder<T>) => void): this;
3809
4276
  /**
3810
4277
  * @description Adds a recursive CTE to the query using a callback to build the subquery.
4278
+ * @mssql not supported
3811
4279
  */
3812
4280
  withRecursive(alias: string, cb: (qb: QueryBuilder<T>) => void): this;
3813
4281
  /**
@@ -3844,6 +4312,10 @@ declare class QueryBuilder<T extends Model = any> extends JsonQueryBuilder<T> {
3844
4312
  * @param options Upsert options including updateOnConflict and returning columns
3845
4313
  */
3846
4314
  upsertMany<O extends Record<string, any>>(conflictColumns: string[], columnsToUpdate: string[], data: O[], options?: UpsertOptionsRawBuilder): Promise<T[]>;
4315
+ /**
4316
+ * @description Executes a MERGE statement for MSSQL upsert operations (raw query builder)
4317
+ */
4318
+ private executeMssqlMergeRaw;
3847
4319
  /**
3848
4320
  * @description Updates records from a table
3849
4321
  * @returns the number of affected rows
@@ -3930,6 +4402,15 @@ declare class QueryBuilder<T extends Model = any> extends JsonQueryBuilder<T> {
3930
4402
  private softDeleteWithPerformance;
3931
4403
  private deleteWithPerformance;
3932
4404
  private truncateWithPerformance;
4405
+ /**
4406
+ * @description Checks if the current context is an MSSQL transaction
4407
+ * @description MSSQL transactions can only handle one request at a time
4408
+ */
4409
+ protected isMssqlTransaction(): boolean;
4410
+ /**
4411
+ * @description Executes pagination queries, serializing them for MSSQL transactions
4412
+ */
4413
+ protected executePaginateQueries<M, C>(modelsQuery: () => Promise<M>, countQuery: () => Promise<C>): Promise<[M, C]>;
3933
4414
  }
3934
4415
 
3935
4416
  type UnionCallBack<T extends Model> = (queryBuilder: QueryBuilder<T>) => QueryBuilder<T>;
@@ -4372,6 +4853,8 @@ declare namespace column {
4372
4853
  var ulid: typeof ulidColumn;
4373
4854
  var integer: typeof integerColumn;
4374
4855
  var float: typeof floatColumn;
4856
+ var increment: typeof incrementColumn;
4857
+ var bigIncrement: typeof bigIncrementColumn;
4375
4858
  var encryption: {
4376
4859
  symmetric: typeof symmetric;
4377
4860
  asymmetric: typeof asymmetric;
@@ -4385,6 +4868,22 @@ declare function floatColumn(options?: Omit<ColumnOptions, "serialize">): Proper
4385
4868
  * @description Defaults type to integer for migration generation
4386
4869
  */
4387
4870
  declare function integerColumn(options?: Omit<ColumnOptions, "serialize">): PropertyDecorator;
4871
+ /**
4872
+ * @description Decorator to define an auto-incrementing integer primary key column
4873
+ * @description Automatically sets primaryKey: true and nullable: false
4874
+ * @mysql INTEGER with AUTO_INCREMENT
4875
+ * @postgres SERIAL (INTEGER with auto-increment sequence)
4876
+ * @sqlite INTEGER PRIMARY KEY AUTOINCREMENT
4877
+ */
4878
+ declare function incrementColumn(options?: Omit<ColumnOptions, "serialize" | "primaryKey" | "nullable">): PropertyDecorator;
4879
+ /**
4880
+ * @description Decorator to define an auto-incrementing bigint primary key column
4881
+ * @description Automatically sets primaryKey: true and nullable: false
4882
+ * @mysql BIGINT with AUTO_INCREMENT
4883
+ * @postgres BIGSERIAL (BIGINT with auto-increment sequence)
4884
+ * @sqlite INTEGER PRIMARY KEY AUTOINCREMENT
4885
+ */
4886
+ declare function bigIncrementColumn(options?: Omit<ColumnOptions, "serialize" | "primaryKey" | "nullable">): PropertyDecorator;
4388
4887
  /**
4389
4888
  * @description Decorator to define a uuid column in the model
4390
4889
  * @description This will automatically generate a uuid if no value is provided
@@ -5364,7 +5863,7 @@ type WithPerformanceResult<R = any> = [string, R];
5364
5863
  */
5365
5864
  declare const withPerformance: <A extends any[], R>(fn: (...args: A) => Promise<R>, returnType?: "millis" | "seconds", fix?: number) => (...args: A) => Promise<WithPerformanceResult<R>>;
5366
5865
 
5367
- type HysteriaErrorCode = "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";
5866
+ type HysteriaErrorCode = `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";
5368
5867
 
5369
5868
  declare class HysteriaError extends Error {
5370
5869
  code: HysteriaErrorCode;
@@ -5389,4 +5888,4 @@ declare const generateOpenApiModelWithMetadata: <T extends new () => Model>(mode
5389
5888
  $id?: string;
5390
5889
  }>;
5391
5890
 
5392
- export { type AnnotatedModel, type AsymmetricEncryptionOptions, type AugmentedSqlDataSource, AutogeneratedModel, type BaseModelMethodOptions, type BaseModelRelationType, type CacheAdapter, type CacheKeys, ClientMigrator, Collection, type ColumnDataTypeOption, type ColumnDataTypeOptionSimple, type ColumnDataTypeOptionWithBinary, type ColumnDataTypeOptionWithDatePrecision, type ColumnDataTypeOptionWithEnum, type ColumnDataTypeOptionWithLength, type ColumnDataTypeOptionWithPrecision, type ColumnDataTypeOptionWithScaleAndPrecision, type ColumnDataTypeOptionWithText, type ColumnOptions, type ColumnType, type CommonDataSourceInput, type CommonSqlMethodReturnType, type ConnectionPolicies, type DataSourceInput, type DataSourceType, type DateColumnOptions, DryModelQueryBuilder, DryQueryBuilder, type FetchHooks, type GetConnectionReturnType, HysteriaError, InMemoryAdapter, type IndexType, type LazyRelationType, type ManyOptions, type ManyToManyOptions, type ManyToManyStringOptions, Migration, Model, type ModelInstanceType, ModelQueryBuilder, type ModelWithoutRelations, MongoDataSource, type MongoDataSourceInput, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NumberModelKey, type OneOptions, type PgPoolClientInstance, type PostgresSqlDataSourceInput, QueryBuilder, type RawModelOptions, RedisCacheAdapter, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationQueryBuilderType, type SqlCloneOptions, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDataSourceWithoutTransaction, type SqlDriverSpecificOptions, type SqlPoolType, type Sqlite3ConnectionOptions, type SqliteConnectionInstance, type SqliteDataSourceInput, type StartTransactionOptions, type SymmetricEncryptionOptions, type TableFormat, type ThroughModel, TimestampedModel, Transaction, type TransactionExecutionOptions, type UniqueType, type UseCacheReturnType, type UseConnectionInput, UserMixin, UuidModel, belongsTo, column, createModelFactory, defineMigrator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, getCollectionProperties, getIndexes, getModelColumns, type getPoolReturnType, getPrimaryKey, getRelations, getRelationsMetadata, getUniques, hasMany, hasOne, index, HysteriaLogger as logger, manyToMany, MongoDataSource as mongo, property, RedisDataSource as redis, SqlDataSource as sql, unique, view, withPerformance };
5891
+ export { type AdminJsActionOptions, type AdminJsAssets, type AdminJsBranding, type AdminJsInstance, type AdminJsLocale, type AdminJsOptions, type AdminJsPage, type AdminJsPropertyOptions, type AdminJsResourceOptions, type AdminJsSettings, type AnnotatedModel, type AsymmetricEncryptionOptions, type AugmentedSqlDataSource, AutogeneratedModel, type BaseModelMethodOptions, type BaseModelRelationType, type CacheAdapter, type CacheKeys, ClientMigrator, Collection, type ColumnDataTypeOption, type ColumnDataTypeOptionSimple, type ColumnDataTypeOptionWithBinary, type ColumnDataTypeOptionWithDatePrecision, type ColumnDataTypeOptionWithEnum, type ColumnDataTypeOptionWithLength, type ColumnDataTypeOptionWithPrecision, type ColumnDataTypeOptionWithScaleAndPrecision, type ColumnDataTypeOptionWithText, type ColumnOptions, type ColumnType, type CommonDataSourceInput, type CommonSqlMethodReturnType, type ConnectionPolicies, type DataSourceInput, type DataSourceType, type DateColumnOptions, DryModelQueryBuilder, DryQueryBuilder, type FetchHooks, type GetConnectionReturnType, HysteriaError, InMemoryAdapter, type IndexType, type LazyRelationType, type ManyOptions, type ManyToManyOptions, type ManyToManyStringOptions, Migration, Model, type ModelInstanceType, ModelQueryBuilder, type ModelWithoutRelations, MongoDataSource, type MongoDataSourceInput, type MssqlConnectionInstance, type MssqlDataSourceInput, type MssqlPoolInstance, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NumberModelKey, type OneOptions, type PgPoolClientInstance, type PostgresSqlDataSourceInput, QueryBuilder, type RawModelOptions, RawNode, RedisCacheAdapter, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationQueryBuilderType, type SqlCloneOptions, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDataSourceWithoutTransaction, type SqlDriverSpecificOptions, type SqlPoolType, type Sqlite3ConnectionOptions, type SqliteConnectionInstance, type SqliteDataSourceInput, type StartTransactionOptions, type SymmetricEncryptionOptions, type TableFormat, type ThroughModel, TimestampedModel, Transaction, type TransactionExecutionOptions, type UniqueType, type UseCacheReturnType, type UseConnectionInput, UserMixin, UuidModel, belongsTo, column, createModelFactory, defineMigrator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, getCollectionProperties, getIndexes, getModelColumns, type getPoolReturnType, getPrimaryKey, getRelations, getRelationsMetadata, getUniques, hasMany, hasOne, index, HysteriaLogger as logger, manyToMany, MongoDataSource as mongo, property, RedisDataSource as redis, SqlDataSource as sql, unique, view, withPerformance };