hysteria-orm 10.5.3 → 10.5.4

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
@@ -5946,7 +5946,7 @@ type FindReturnType<T extends Model, S extends ModelKey<T>[] = any[], R extends
5946
5946
  /**
5947
5947
  * @description Represents a Table in the Database
5948
5948
  */
5949
- declare abstract class Model extends Entity {
5949
+ declare abstract class Model<T extends Model<T> = any> extends Entity {
5950
5950
  private "*";
5951
5951
  /**
5952
5952
  * @description The column used to soft delete a record, default is deletedAt
@@ -5973,7 +5973,26 @@ declare abstract class Model extends Entity {
5973
5973
  * @description Getter for the primary key of the model
5974
5974
  */
5975
5975
  static get primaryKey(): string | undefined;
5976
- constructor();
5976
+ /**
5977
+ * @description Creates a new instance of the model
5978
+ * @description Use `${Model.from(...)}` to pass initial data to the model or pass initial data to the constructor
5979
+ * @warning For typescript limitations, in order to pass initial data to the constructor directly, you must use generic type inference to pass the model type
5980
+ * @example
5981
+ * ```typescript
5982
+ * class User extends Model<User> {
5983
+ * @column.string()
5984
+ * declare name: string;
5985
+ * }
5986
+ *
5987
+ * const user = new User({ name: "John Doe" }); // now the constructor is typed as User
5988
+ * ```
5989
+ */
5990
+ constructor(initialData?: Partial<ModelWithoutRelations<T>>);
5991
+ /**
5992
+ * @description Returns a model query result from the given initial data
5993
+ * @warning This method does not persist the data to the database, it only creates a new instance of the model with the given data
5994
+ */
5995
+ static from<T extends Model>(this: new () => T | typeof Model, data: Partial<ModelWithoutRelations<T>>): ModelQueryResult<T>;
5977
5996
  /**
5978
5997
  * @description Returns all the records for the given model
5979
5998
  */
package/lib/index.d.ts CHANGED
@@ -5946,7 +5946,7 @@ type FindReturnType<T extends Model, S extends ModelKey<T>[] = any[], R extends
5946
5946
  /**
5947
5947
  * @description Represents a Table in the Database
5948
5948
  */
5949
- declare abstract class Model extends Entity {
5949
+ declare abstract class Model<T extends Model<T> = any> extends Entity {
5950
5950
  private "*";
5951
5951
  /**
5952
5952
  * @description The column used to soft delete a record, default is deletedAt
@@ -5973,7 +5973,26 @@ declare abstract class Model extends Entity {
5973
5973
  * @description Getter for the primary key of the model
5974
5974
  */
5975
5975
  static get primaryKey(): string | undefined;
5976
- constructor();
5976
+ /**
5977
+ * @description Creates a new instance of the model
5978
+ * @description Use `${Model.from(...)}` to pass initial data to the model or pass initial data to the constructor
5979
+ * @warning For typescript limitations, in order to pass initial data to the constructor directly, you must use generic type inference to pass the model type
5980
+ * @example
5981
+ * ```typescript
5982
+ * class User extends Model<User> {
5983
+ * @column.string()
5984
+ * declare name: string;
5985
+ * }
5986
+ *
5987
+ * const user = new User({ name: "John Doe" }); // now the constructor is typed as User
5988
+ * ```
5989
+ */
5990
+ constructor(initialData?: Partial<ModelWithoutRelations<T>>);
5991
+ /**
5992
+ * @description Returns a model query result from the given initial data
5993
+ * @warning This method does not persist the data to the database, it only creates a new instance of the model with the given data
5994
+ */
5995
+ static from<T extends Model>(this: new () => T | typeof Model, data: Partial<ModelWithoutRelations<T>>): ModelQueryResult<T>;
5977
5996
  /**
5978
5997
  * @description Returns all the records for the given model
5979
5998
  */