hysteria-orm 10.5.2 → 10.5.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
@@ -5491,7 +5491,7 @@ type ModelInstanceMethods<T extends Model> = {
5491
5491
  * Refreshes the model from the database, updating all properties with current values.
5492
5492
  * @throws {HysteriaError} If the model has no primary key or primary key value
5493
5493
  */
5494
- refresh: (options?: Omit<BaseModelMethodOptions, "ignoreHooks">) => Promise<any>;
5494
+ refresh: (options?: Omit<BaseModelMethodOptions, "ignoreHooks">) => Promise<void>;
5495
5495
  };
5496
5496
  /**
5497
5497
  * Model data without relation properties.
@@ -6021,7 +6021,7 @@ declare abstract class Model extends Entity {
6021
6021
  /**
6022
6022
  * @description Refreshes a model from the database, the model must have a primary key defined
6023
6023
  */
6024
- static refresh<T extends Model>(this: new () => T | typeof Model, model: T, options?: Omit<BaseModelMethodOptions, "ignoreHooks">): Promise<ModelQueryResult<T> | null>;
6024
+ static refresh<T extends Model>(this: new () => T | typeof Model, model: T, options?: Omit<BaseModelMethodOptions, "ignoreHooks">): Promise<void>;
6025
6025
  /**
6026
6026
  * @description Saves a new record to the database
6027
6027
  * @warning If not using postgres and the model has no primary key, the model will be saved, but it won't be possible to retrieve it so at that point it will be returned as null, this is not typed as Model | null for type safety reasons
@@ -6361,23 +6361,30 @@ declare function view(statement: (query: ModelQueryBuilder<any>) => void): Class
6361
6361
  */
6362
6362
  declare function column(options?: ColumnOptions): PropertyDecorator;
6363
6363
  declare namespace column {
6364
- var primary: typeof primaryKeyColumn;
6365
- var date: typeof dateOnlyColumn;
6366
- var datetime: typeof datetimeColumn;
6367
- var timestamp: typeof timestampColumn;
6368
- var time: typeof timeOnlyColumn;
6369
- var boolean: typeof booleanColumn;
6370
- var json: typeof jsonColumn;
6371
- var uuid: typeof uuidColumn;
6372
- var ulid: typeof ulidColumn;
6373
- var integer: typeof integerColumn;
6374
- var float: typeof floatColumn;
6375
- var increment: typeof incrementColumn;
6376
- var bigIncrement: typeof bigIncrementColumn;
6377
- var encryption: {
6364
+ export var primary: typeof primaryKeyColumn;
6365
+ export var date: typeof dateOnlyColumn;
6366
+ export var datetime: typeof datetimeColumn;
6367
+ export var timestamp: typeof timestampColumn;
6368
+ export var time: typeof timeOnlyColumn;
6369
+ export var boolean: typeof booleanColumn;
6370
+ export var json: typeof jsonColumn;
6371
+ export var uuid: typeof uuidColumn;
6372
+ export var ulid: typeof ulidColumn;
6373
+ export var integer: typeof integerColumn;
6374
+ export var bigint: typeof bigintColumn;
6375
+ export var float: typeof floatColumn;
6376
+ export var decimal: typeof decimalColumn;
6377
+ export var increment: typeof incrementColumn;
6378
+ export var bigIncrement: typeof bigIncrementColumn;
6379
+ export var string: typeof stringColumn;
6380
+ export var text: typeof textColumn;
6381
+ export var binary: typeof binaryColumn;
6382
+ var _a: typeof enumColumn;
6383
+ export var encryption: {
6378
6384
  symmetric: typeof symmetric;
6379
6385
  asymmetric: typeof asymmetric;
6380
6386
  };
6387
+ export { _a as enum };
6381
6388
  }
6382
6389
  declare function primaryKeyColumn(options?: Omit<ColumnOptions, "primaryKey">): PropertyDecorator;
6383
6390
  declare function floatColumn(options?: Omit<ColumnOptions, "serialize">): PropertyDecorator;
@@ -6415,6 +6422,47 @@ declare function uuidColumn(options?: Omit<ColumnOptions, "prepare">): PropertyD
6415
6422
  * @description Defaults type to ulid for migration generation
6416
6423
  */
6417
6424
  declare function ulidColumn(options?: Omit<ColumnOptions, "prepare">): PropertyDecorator;
6425
+ /**
6426
+ * @description Decorator to define a string (varchar) column in the model
6427
+ * @description Defaults type to string for migration generation
6428
+ */
6429
+ declare function stringColumn(options?: Omit<ColumnOptions, "type"> & {
6430
+ length?: number;
6431
+ }): PropertyDecorator;
6432
+ /**
6433
+ * @description Decorator to define a text column in the model for longer text content
6434
+ * @description Defaults type to longtext for migration generation
6435
+ */
6436
+ declare function textColumn(options?: Omit<ColumnOptions, "type">): PropertyDecorator;
6437
+ /**
6438
+ * @description Decorator to define a bigint column in the model
6439
+ * @description Useful in databases like postgres where the bigint is returned as a string by the driver
6440
+ * @description Defaults type to bigint for migration generation
6441
+ */
6442
+ declare function bigintColumn(options?: Omit<ColumnOptions, "serialize">): PropertyDecorator;
6443
+ /**
6444
+ * @description Decorator to define a decimal column in the model for precise numeric values
6445
+ * @description Useful for financial data and other precise calculations
6446
+ * @description Defaults type to decimal for migration generation
6447
+ * @param options.precision The total number of digits (default: 10)
6448
+ * @param options.scale The number of digits after the decimal point (default: 2)
6449
+ */
6450
+ declare function decimalColumn(options?: Omit<ColumnOptions, "serialize"> & {
6451
+ precision?: number;
6452
+ scale?: number;
6453
+ }): PropertyDecorator;
6454
+ /**
6455
+ * @description Decorator to define a binary/blob column in the model
6456
+ * @description Defaults type to binary for migration generation
6457
+ */
6458
+ declare function binaryColumn(options?: Omit<ColumnOptions, "type">): PropertyDecorator;
6459
+ /**
6460
+ * @description Decorator to define an enum column in the model
6461
+ * @description Defaults type to enum for migration generation
6462
+ * @param values The allowed enum values
6463
+ * @param options Additional column options
6464
+ */
6465
+ declare function enumColumn(values: readonly string[], options?: Omit<ColumnOptions, "type">): PropertyDecorator;
6418
6466
  /**
6419
6467
  * @description Decorator to define a symmetric encrypted column in the model with a key
6420
6468
  * @description This will automatically encrypt the value before it is inserted or updated in the database and decrypt it when it is retrieved from the database
package/lib/index.d.ts CHANGED
@@ -5491,7 +5491,7 @@ type ModelInstanceMethods<T extends Model> = {
5491
5491
  * Refreshes the model from the database, updating all properties with current values.
5492
5492
  * @throws {HysteriaError} If the model has no primary key or primary key value
5493
5493
  */
5494
- refresh: (options?: Omit<BaseModelMethodOptions, "ignoreHooks">) => Promise<any>;
5494
+ refresh: (options?: Omit<BaseModelMethodOptions, "ignoreHooks">) => Promise<void>;
5495
5495
  };
5496
5496
  /**
5497
5497
  * Model data without relation properties.
@@ -6021,7 +6021,7 @@ declare abstract class Model extends Entity {
6021
6021
  /**
6022
6022
  * @description Refreshes a model from the database, the model must have a primary key defined
6023
6023
  */
6024
- static refresh<T extends Model>(this: new () => T | typeof Model, model: T, options?: Omit<BaseModelMethodOptions, "ignoreHooks">): Promise<ModelQueryResult<T> | null>;
6024
+ static refresh<T extends Model>(this: new () => T | typeof Model, model: T, options?: Omit<BaseModelMethodOptions, "ignoreHooks">): Promise<void>;
6025
6025
  /**
6026
6026
  * @description Saves a new record to the database
6027
6027
  * @warning If not using postgres and the model has no primary key, the model will be saved, but it won't be possible to retrieve it so at that point it will be returned as null, this is not typed as Model | null for type safety reasons
@@ -6361,23 +6361,30 @@ declare function view(statement: (query: ModelQueryBuilder<any>) => void): Class
6361
6361
  */
6362
6362
  declare function column(options?: ColumnOptions): PropertyDecorator;
6363
6363
  declare namespace column {
6364
- var primary: typeof primaryKeyColumn;
6365
- var date: typeof dateOnlyColumn;
6366
- var datetime: typeof datetimeColumn;
6367
- var timestamp: typeof timestampColumn;
6368
- var time: typeof timeOnlyColumn;
6369
- var boolean: typeof booleanColumn;
6370
- var json: typeof jsonColumn;
6371
- var uuid: typeof uuidColumn;
6372
- var ulid: typeof ulidColumn;
6373
- var integer: typeof integerColumn;
6374
- var float: typeof floatColumn;
6375
- var increment: typeof incrementColumn;
6376
- var bigIncrement: typeof bigIncrementColumn;
6377
- var encryption: {
6364
+ export var primary: typeof primaryKeyColumn;
6365
+ export var date: typeof dateOnlyColumn;
6366
+ export var datetime: typeof datetimeColumn;
6367
+ export var timestamp: typeof timestampColumn;
6368
+ export var time: typeof timeOnlyColumn;
6369
+ export var boolean: typeof booleanColumn;
6370
+ export var json: typeof jsonColumn;
6371
+ export var uuid: typeof uuidColumn;
6372
+ export var ulid: typeof ulidColumn;
6373
+ export var integer: typeof integerColumn;
6374
+ export var bigint: typeof bigintColumn;
6375
+ export var float: typeof floatColumn;
6376
+ export var decimal: typeof decimalColumn;
6377
+ export var increment: typeof incrementColumn;
6378
+ export var bigIncrement: typeof bigIncrementColumn;
6379
+ export var string: typeof stringColumn;
6380
+ export var text: typeof textColumn;
6381
+ export var binary: typeof binaryColumn;
6382
+ var _a: typeof enumColumn;
6383
+ export var encryption: {
6378
6384
  symmetric: typeof symmetric;
6379
6385
  asymmetric: typeof asymmetric;
6380
6386
  };
6387
+ export { _a as enum };
6381
6388
  }
6382
6389
  declare function primaryKeyColumn(options?: Omit<ColumnOptions, "primaryKey">): PropertyDecorator;
6383
6390
  declare function floatColumn(options?: Omit<ColumnOptions, "serialize">): PropertyDecorator;
@@ -6415,6 +6422,47 @@ declare function uuidColumn(options?: Omit<ColumnOptions, "prepare">): PropertyD
6415
6422
  * @description Defaults type to ulid for migration generation
6416
6423
  */
6417
6424
  declare function ulidColumn(options?: Omit<ColumnOptions, "prepare">): PropertyDecorator;
6425
+ /**
6426
+ * @description Decorator to define a string (varchar) column in the model
6427
+ * @description Defaults type to string for migration generation
6428
+ */
6429
+ declare function stringColumn(options?: Omit<ColumnOptions, "type"> & {
6430
+ length?: number;
6431
+ }): PropertyDecorator;
6432
+ /**
6433
+ * @description Decorator to define a text column in the model for longer text content
6434
+ * @description Defaults type to longtext for migration generation
6435
+ */
6436
+ declare function textColumn(options?: Omit<ColumnOptions, "type">): PropertyDecorator;
6437
+ /**
6438
+ * @description Decorator to define a bigint column in the model
6439
+ * @description Useful in databases like postgres where the bigint is returned as a string by the driver
6440
+ * @description Defaults type to bigint for migration generation
6441
+ */
6442
+ declare function bigintColumn(options?: Omit<ColumnOptions, "serialize">): PropertyDecorator;
6443
+ /**
6444
+ * @description Decorator to define a decimal column in the model for precise numeric values
6445
+ * @description Useful for financial data and other precise calculations
6446
+ * @description Defaults type to decimal for migration generation
6447
+ * @param options.precision The total number of digits (default: 10)
6448
+ * @param options.scale The number of digits after the decimal point (default: 2)
6449
+ */
6450
+ declare function decimalColumn(options?: Omit<ColumnOptions, "serialize"> & {
6451
+ precision?: number;
6452
+ scale?: number;
6453
+ }): PropertyDecorator;
6454
+ /**
6455
+ * @description Decorator to define a binary/blob column in the model
6456
+ * @description Defaults type to binary for migration generation
6457
+ */
6458
+ declare function binaryColumn(options?: Omit<ColumnOptions, "type">): PropertyDecorator;
6459
+ /**
6460
+ * @description Decorator to define an enum column in the model
6461
+ * @description Defaults type to enum for migration generation
6462
+ * @param values The allowed enum values
6463
+ * @param options Additional column options
6464
+ */
6465
+ declare function enumColumn(values: readonly string[], options?: Omit<ColumnOptions, "type">): PropertyDecorator;
6418
6466
  /**
6419
6467
  * @description Decorator to define a symmetric encrypted column in the model with a key
6420
6468
  * @description This will automatically encrypt the value before it is inserted or updated in the database and decrypt it when it is retrieved from the database