hysteria-orm 10.9.3 → 10.9.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
@@ -572,7 +572,7 @@ type CacheKeys = Record<string, (...args: any[]) => Promise<any> | any>;
572
572
  type UseCacheReturnType<C extends CacheKeys, K extends keyof C> = K extends never ? never : Awaited<ReturnType<C[K]>>;
573
573
 
574
574
  type Mysql2Import = typeof mysql2_promise;
575
- type PgImport = typeof pg;
575
+ type PgImport = (typeof pg)["default"];
576
576
  type Sqlite3Import = typeof sqlite3;
577
577
  type MongoClientImport = typeof mongodb;
578
578
  type MssqlImport = typeof mssql;
@@ -949,6 +949,7 @@ type OpenApiModelPropertyType = {
949
949
  example?: any;
950
950
  default?: any;
951
951
  nullable?: boolean;
952
+ excludeFromSwagger?: boolean;
952
953
  };
953
954
 
954
955
  declare abstract class DataSource {
@@ -1829,6 +1830,8 @@ declare class FromNode extends QueryNode {
1829
1830
  declare class InterpreterUtils {
1830
1831
  private readonly model;
1831
1832
  private readonly modelColumnsMap;
1833
+ private readonly autoInsertColumns;
1834
+ private readonly autoUpdateColumns;
1832
1835
  constructor(model: typeof Model);
1833
1836
  formatStringColumn(dbType: SqlDataSourceType, column: string): string;
1834
1837
  /**
@@ -2823,11 +2826,6 @@ type ColumnOptions = {
2823
2826
  * @warning This will not be called on massive update operations since it's not possible to know which values are being updated, so you must pass the value you want to update in the payload
2824
2827
  */
2825
2828
  prepare?: (value: any) => any;
2826
- /**
2827
- * @description Whether the column is returned in the serialization output, this column will always be undefined
2828
- * @default false
2829
- */
2830
- hidden?: boolean;
2831
2829
  /**
2832
2830
  * @description If true, the prepare function will always be called on update regardless of whether the value has been provided in the update payload
2833
2831
  * @default false
@@ -2865,7 +2863,6 @@ type ColumnType = {
2865
2863
  databaseName: string;
2866
2864
  serialize?: (value: any) => any | Promise<any>;
2867
2865
  prepare?: (value: any) => any | Promise<any>;
2868
- hidden?: boolean;
2869
2866
  autoUpdate?: boolean;
2870
2867
  isPrimary: boolean;
2871
2868
  openApi?: OpenApiModelPropertyType & {
@@ -2908,6 +2905,7 @@ declare abstract class FooterQueryBuilder<T extends Model, S extends Record<stri
2908
2905
  protected modelColumns: ColumnType[];
2909
2906
  protected modelColumnsMap: Map<string, ColumnType>;
2910
2907
  protected logs: boolean | LoggerConfig;
2908
+ private static readonly EMPTY_MAP;
2911
2909
  protected constructor(model: typeof Model, sqlDataSource: SqlDataSource);
2912
2910
  /**
2913
2911
  * @description Clears the group by query
@@ -3845,7 +3843,8 @@ declare class QueryBuilder<T extends Model = any, S extends Record<string, any>
3845
3843
  protected withNodes: WithNode[];
3846
3844
  protected lockQueryNodes: LockNode[];
3847
3845
  protected isNestedCondition: boolean;
3848
- protected interpreterUtils: InterpreterUtils;
3846
+ protected _interpreterUtils: InterpreterUtils | null;
3847
+ protected get interpreterUtils(): InterpreterUtils;
3849
3848
  protected insertNode: InsertNode | null;
3850
3849
  protected onDuplicateNode: OnDuplicateNode | null;
3851
3850
  protected updateNode: UpdateNode | null;
@@ -6303,6 +6302,16 @@ declare abstract class Model<T extends Model<T> = any> extends Entity {
6303
6302
  static beforeDelete?(queryBuilder: ModelQueryBuilder<any>): Promise<void> | void;
6304
6303
  static afterFetch?(data: any[]): Promise<any[]> | any[];
6305
6304
  static getColumns(): ColumnType[];
6305
+ /**
6306
+ * @description Returns a cached Map of model column name → ColumnType for O(1) lookup.
6307
+ * Computed once per model class and reused across all queries.
6308
+ */
6309
+ static getColumnsByName(): Map<string, ColumnType>;
6310
+ /**
6311
+ * @description Returns a cached Map of database column name → ColumnType for O(1) lookup.
6312
+ * Computed once per model class and reused across all queries.
6313
+ */
6314
+ static getColumnsByDatabaseName(): Map<string, ColumnType>;
6306
6315
  static getRelations(): LazyRelationType[];
6307
6316
  static getIndexes(): IndexType[];
6308
6317
  static getUniques(): UniqueType[];
@@ -6669,6 +6678,21 @@ interface ColNamespace {
6669
6678
  * ```
6670
6679
  */
6671
6680
  enum<const V extends readonly string[], O extends ColEnumOptions = ColEnumOptions>(values: V, options?: O & TypedSerialize<NullableColumn<V[number], O>> & TypedPrepare<NullableColumn<V[number], O>> & TypedDefault<V[number]>): ColumnDef<NullableColumn<V[number], O>>;
6681
+ /**
6682
+ * Native enum column from a TypeScript enum object.
6683
+ * Handles both string and numeric enums (numeric values are coerced to strings).
6684
+ * Type: `E[keyof E]` (nullable-aware).
6685
+ *
6686
+ * ```ts
6687
+ * enum Status { Active = "active", Inactive = "inactive" }
6688
+ * col.nativeEnum(Status) // Status | null
6689
+ * col.nativeEnum(Status, { nullable: false }) // Status
6690
+ *
6691
+ * enum Priority { Low = 0, Medium = 1, High = 2 }
6692
+ * col.nativeEnum(Priority) // Priority | null
6693
+ * ```
6694
+ */
6695
+ nativeEnum<E extends Record<string, string | number>, O extends ColEnumOptions = ColEnumOptions>(enumObj: E, options?: O & TypedSerialize<NullableColumn<E[keyof E], O>> & TypedPrepare<NullableColumn<E[keyof E], O>> & TypedDefault<E[keyof E]>): ColumnDef<NullableColumn<E[keyof E], O>>;
6672
6696
  /**
6673
6697
  * CHAR column (fixed-length string). Accepts an optional `length` option.
6674
6698
  * Type: `string` (nullable-aware).
package/lib/index.d.ts CHANGED
@@ -572,7 +572,7 @@ type CacheKeys = Record<string, (...args: any[]) => Promise<any> | any>;
572
572
  type UseCacheReturnType<C extends CacheKeys, K extends keyof C> = K extends never ? never : Awaited<ReturnType<C[K]>>;
573
573
 
574
574
  type Mysql2Import = typeof mysql2_promise;
575
- type PgImport = typeof pg;
575
+ type PgImport = (typeof pg)["default"];
576
576
  type Sqlite3Import = typeof sqlite3;
577
577
  type MongoClientImport = typeof mongodb;
578
578
  type MssqlImport = typeof mssql;
@@ -949,6 +949,7 @@ type OpenApiModelPropertyType = {
949
949
  example?: any;
950
950
  default?: any;
951
951
  nullable?: boolean;
952
+ excludeFromSwagger?: boolean;
952
953
  };
953
954
 
954
955
  declare abstract class DataSource {
@@ -1829,6 +1830,8 @@ declare class FromNode extends QueryNode {
1829
1830
  declare class InterpreterUtils {
1830
1831
  private readonly model;
1831
1832
  private readonly modelColumnsMap;
1833
+ private readonly autoInsertColumns;
1834
+ private readonly autoUpdateColumns;
1832
1835
  constructor(model: typeof Model);
1833
1836
  formatStringColumn(dbType: SqlDataSourceType, column: string): string;
1834
1837
  /**
@@ -2823,11 +2826,6 @@ type ColumnOptions = {
2823
2826
  * @warning This will not be called on massive update operations since it's not possible to know which values are being updated, so you must pass the value you want to update in the payload
2824
2827
  */
2825
2828
  prepare?: (value: any) => any;
2826
- /**
2827
- * @description Whether the column is returned in the serialization output, this column will always be undefined
2828
- * @default false
2829
- */
2830
- hidden?: boolean;
2831
2829
  /**
2832
2830
  * @description If true, the prepare function will always be called on update regardless of whether the value has been provided in the update payload
2833
2831
  * @default false
@@ -2865,7 +2863,6 @@ type ColumnType = {
2865
2863
  databaseName: string;
2866
2864
  serialize?: (value: any) => any | Promise<any>;
2867
2865
  prepare?: (value: any) => any | Promise<any>;
2868
- hidden?: boolean;
2869
2866
  autoUpdate?: boolean;
2870
2867
  isPrimary: boolean;
2871
2868
  openApi?: OpenApiModelPropertyType & {
@@ -2908,6 +2905,7 @@ declare abstract class FooterQueryBuilder<T extends Model, S extends Record<stri
2908
2905
  protected modelColumns: ColumnType[];
2909
2906
  protected modelColumnsMap: Map<string, ColumnType>;
2910
2907
  protected logs: boolean | LoggerConfig;
2908
+ private static readonly EMPTY_MAP;
2911
2909
  protected constructor(model: typeof Model, sqlDataSource: SqlDataSource);
2912
2910
  /**
2913
2911
  * @description Clears the group by query
@@ -3845,7 +3843,8 @@ declare class QueryBuilder<T extends Model = any, S extends Record<string, any>
3845
3843
  protected withNodes: WithNode[];
3846
3844
  protected lockQueryNodes: LockNode[];
3847
3845
  protected isNestedCondition: boolean;
3848
- protected interpreterUtils: InterpreterUtils;
3846
+ protected _interpreterUtils: InterpreterUtils | null;
3847
+ protected get interpreterUtils(): InterpreterUtils;
3849
3848
  protected insertNode: InsertNode | null;
3850
3849
  protected onDuplicateNode: OnDuplicateNode | null;
3851
3850
  protected updateNode: UpdateNode | null;
@@ -6303,6 +6302,16 @@ declare abstract class Model<T extends Model<T> = any> extends Entity {
6303
6302
  static beforeDelete?(queryBuilder: ModelQueryBuilder<any>): Promise<void> | void;
6304
6303
  static afterFetch?(data: any[]): Promise<any[]> | any[];
6305
6304
  static getColumns(): ColumnType[];
6305
+ /**
6306
+ * @description Returns a cached Map of model column name → ColumnType for O(1) lookup.
6307
+ * Computed once per model class and reused across all queries.
6308
+ */
6309
+ static getColumnsByName(): Map<string, ColumnType>;
6310
+ /**
6311
+ * @description Returns a cached Map of database column name → ColumnType for O(1) lookup.
6312
+ * Computed once per model class and reused across all queries.
6313
+ */
6314
+ static getColumnsByDatabaseName(): Map<string, ColumnType>;
6306
6315
  static getRelations(): LazyRelationType[];
6307
6316
  static getIndexes(): IndexType[];
6308
6317
  static getUniques(): UniqueType[];
@@ -6669,6 +6678,21 @@ interface ColNamespace {
6669
6678
  * ```
6670
6679
  */
6671
6680
  enum<const V extends readonly string[], O extends ColEnumOptions = ColEnumOptions>(values: V, options?: O & TypedSerialize<NullableColumn<V[number], O>> & TypedPrepare<NullableColumn<V[number], O>> & TypedDefault<V[number]>): ColumnDef<NullableColumn<V[number], O>>;
6681
+ /**
6682
+ * Native enum column from a TypeScript enum object.
6683
+ * Handles both string and numeric enums (numeric values are coerced to strings).
6684
+ * Type: `E[keyof E]` (nullable-aware).
6685
+ *
6686
+ * ```ts
6687
+ * enum Status { Active = "active", Inactive = "inactive" }
6688
+ * col.nativeEnum(Status) // Status | null
6689
+ * col.nativeEnum(Status, { nullable: false }) // Status
6690
+ *
6691
+ * enum Priority { Low = 0, Medium = 1, High = 2 }
6692
+ * col.nativeEnum(Priority) // Priority | null
6693
+ * ```
6694
+ */
6695
+ nativeEnum<E extends Record<string, string | number>, O extends ColEnumOptions = ColEnumOptions>(enumObj: E, options?: O & TypedSerialize<NullableColumn<E[keyof E], O>> & TypedPrepare<NullableColumn<E[keyof E], O>> & TypedDefault<E[keyof E]>): ColumnDef<NullableColumn<E[keyof E], O>>;
6672
6696
  /**
6673
6697
  * CHAR column (fixed-length string). Accepts an optional `length` option.
6674
6698
  * Type: `string` (nullable-aware).