hysteria-orm 10.4.3 → 10.4.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
@@ -2279,6 +2279,8 @@ declare class WhereGroupNode extends QueryNode {
2279
2279
  constructor(nodes: (WhereNode | WhereGroupNode | WhereSubqueryNode)[], chainsWith?: "and" | "or");
2280
2280
  }
2281
2281
 
2282
+ type JsonPathInput = string | (string | number)[];
2283
+
2282
2284
  declare class DistinctNode extends QueryNode {
2283
2285
  chainsWith: string;
2284
2286
  canKeywordBeSeenMultipleTimes: boolean;
@@ -2786,9 +2788,9 @@ declare class SelectQueryBuilder<T extends Model> extends JoinQueryBuilder<T> {
2786
2788
  * const user = await User.query().annotate("id", "superId").first(); // id as superId
2787
2789
  * ```
2788
2790
  */
2789
- annotate(column: string, alias: string): this;
2790
- annotate(sqlMethod: SqlMethod, column: string, alias: string): this;
2791
- annotate(sqlMethod: string, column: string, alias: string): this;
2791
+ annotate<A extends string>(column: string, alias: A): this;
2792
+ annotate<A extends string>(sqlMethod: SqlMethod, column: string, alias: A): this;
2793
+ annotate<A extends string>(sqlMethod: string, column: string, alias: A): this;
2792
2794
  /**
2793
2795
  * @description Sets the table to select from, by default is the table defined in the Model
2794
2796
  * @description Can be used on non select queries too, it will only specify the table name (es. INSERT INTO $table)
@@ -2812,6 +2814,99 @@ declare class SelectQueryBuilder<T extends Model> extends JoinQueryBuilder<T> {
2812
2814
  */
2813
2815
  distinctOn(...columns: ModelKey<T>[]): this;
2814
2816
  distinctOn<S extends string>(...columns: SelectableColumn<S>[]): this;
2817
+ /**
2818
+ * @description Selects a JSON value at the specified path and returns it as JSON
2819
+ * @param column The column containing JSON data
2820
+ * @param path The JSON path to extract (standardized format: "$.user.name", "user.name", or ["user", "name"])
2821
+ * @param alias The alias for the selected value
2822
+ * @description Path format is standardized across all databases - ORM converts to DB-specific syntax
2823
+ * @description Result will be available in model.$annotations[alias]
2824
+ * @example
2825
+ * ```ts
2826
+ * // All databases accept the same path format:
2827
+ * const user = await User.query().selectJson("data", "$.user.name", "userName").first();
2828
+ * console.log(user?.$annotations?.userName); // Typed!
2829
+ *
2830
+ * await User.query().selectJson("data", "user.name", "userName").first(); // $ is optional
2831
+ * await User.query().selectJson("data", ["user", "name"], "userName").first();
2832
+ *
2833
+ * // Array indices:
2834
+ * await User.query().selectJson("data", "items.0.name", "firstItemName").first();
2835
+ * await User.query().selectJson("data", ["items", 0, "name"], "firstItemName").first();
2836
+ * ```
2837
+ */
2838
+ selectJson<A extends string>(column: ModelKey<T>, path: JsonPathInput, alias: A): this;
2839
+ selectJson<A extends string>(column: string, path: JsonPathInput, alias: A): this;
2840
+ /**
2841
+ * @description Selects a JSON value at the specified path and returns it as text
2842
+ * @param column The column containing JSON data
2843
+ * @param path The JSON path to extract (standardized format)
2844
+ * @param alias The alias for the selected value
2845
+ * @description Path format is standardized across all databases - ORM converts to DB-specific syntax
2846
+ * @description Result will be available in model.$annotations[alias]
2847
+ * @example
2848
+ * ```ts
2849
+ * // All databases accept the same path format:
2850
+ * const user = await User.query().selectJsonText("data", "$.user.name", "userName").first();
2851
+ * console.log(user?.$annotations?.userName); // Typed!
2852
+ *
2853
+ * await User.query().selectJsonText("data", ["user", "name"], "userName").first();
2854
+ * ```
2855
+ */
2856
+ selectJsonText<A extends string>(column: ModelKey<T>, path: JsonPathInput, alias: A): this;
2857
+ selectJsonText<A extends string>(column: string, path: JsonPathInput, alias: A): this;
2858
+ /**
2859
+ * @description Selects the length of a JSON array
2860
+ * @param column The column containing JSON array data
2861
+ * @param path The JSON path to the array (standardized format, use "$" or "" for root)
2862
+ * @param alias The alias for the length value
2863
+ * @description Path format is standardized across all databases - ORM converts to DB-specific syntax
2864
+ * @description Result will be available in model.$annotations[alias]
2865
+ * @example
2866
+ * ```ts
2867
+ * // All databases accept the same path format:
2868
+ * const user = await User.query().selectJsonArrayLength("data", "$.items", "itemCount").first();
2869
+ * console.log(user?.$annotations?.itemCount); // Typed!
2870
+ *
2871
+ * await User.query().selectJsonArrayLength("data", "items", "itemCount").first();
2872
+ * await User.query().selectJsonArrayLength("data", "$", "totalCount").first(); // root array
2873
+ * ```
2874
+ */
2875
+ selectJsonArrayLength<A extends string>(column: ModelKey<T>, path: JsonPathInput, alias: A): this;
2876
+ selectJsonArrayLength<A extends string>(column: string, path: JsonPathInput, alias: A): this;
2877
+ /**
2878
+ * @description Selects the keys of a JSON object
2879
+ * @param column The column containing JSON object data
2880
+ * @param path The JSON path to the object (standardized format, use "$" or "" for root)
2881
+ * @param alias The alias for the keys
2882
+ * @description Path format is standardized across all databases - ORM converts to DB-specific syntax
2883
+ * @description Result will be available in model.$annotations[alias]
2884
+ * @postgres Returns an array of keys
2885
+ * @mysql Returns a JSON array of keys
2886
+ * @example
2887
+ * ```ts
2888
+ * // All databases accept the same path format:
2889
+ * const user = await User.query().selectJsonKeys("data", "$.user", "userKeys").first();
2890
+ * console.log(user?.$annotations?.userKeys); // Typed!
2891
+ *
2892
+ * await User.query().selectJsonKeys("data", "user", "userKeys").first();
2893
+ * await User.query().selectJsonKeys("data", "$", "rootKeys").first(); // root object
2894
+ * ```
2895
+ */
2896
+ selectJsonKeys<A extends string>(column: ModelKey<T>, path: JsonPathInput, alias: A): this;
2897
+ selectJsonKeys<A extends string>(column: string, path: JsonPathInput, alias: A): this;
2898
+ /**
2899
+ * @description Adds a raw JSON select expression
2900
+ * @param raw The raw SQL expression
2901
+ * @param alias The alias for the selected value
2902
+ * @description Result will be available in model.$annotations[alias]
2903
+ * @example
2904
+ * ```ts
2905
+ * const user = await User.query().selectJsonRaw("data->>'email'", "userEmail").first();
2906
+ * console.log(user?.$annotations?.userEmail); // Typed!
2907
+ * ```
2908
+ */
2909
+ selectJsonRaw<A extends string>(raw: string, alias: A): this;
2815
2910
  }
2816
2911
 
2817
2912
  declare abstract class WhereQueryBuilder<T extends Model> extends SelectQueryBuilder<T> {
@@ -3323,6 +3418,16 @@ type UpdateOptions = {
3323
3418
  */
3324
3419
  type RelationQueryBuilderType<T extends Model, A extends Record<string, any> = {}, R extends Record<string, any> = {}> = Omit<ModelQueryBuilder<T, A, R>, "increment" | "decrement" | "first" | "firstOrFail" | "paginate" | "pluck" | "truncate" | "many" | "one" | "oneOrFail" | "insert" | "insertMany" | "update" | "delete" | "softDelete" | "getSum" | "getAvg" | "getMin" | "getMax" | "getCount" | "getMin" | "getMax" | "getCount">;
3325
3420
 
3421
+ /**
3422
+ * Helper type to determine if annotation overrides model field or goes to $annotations
3423
+ * If K is a key of the model T, it overrides that field in the model.
3424
+ * Otherwise, it goes into the annotations object A.
3425
+ */
3426
+ type AnnotationResult<T extends Model, A extends Record<string, any>, R extends Record<string, any>, K extends string, V> = K extends keyof T ? ModelQueryBuilder<T & {
3427
+ [P in K]: V;
3428
+ }, A, R> : ModelQueryBuilder<T, A & {
3429
+ [P in K]: V;
3430
+ }, R>;
3326
3431
  declare class ModelQueryBuilder<T extends Model, A extends Record<string, any> = {}, R extends Record<string, any> = {}> extends QueryBuilder<T> {
3327
3432
  relation: Relation;
3328
3433
  protected sqlModelManagerUtils: SqlModelManagerUtils<T>;
@@ -3417,11 +3522,11 @@ declare class ModelQueryBuilder<T extends Model, A extends Record<string, any> =
3417
3522
  /**
3418
3523
  * @description Inserts a new record into the database, it is not advised to use this method directly from the query builder if using a ModelQueryBuilder (`Model.query()`), use the `Model.insert` method instead.
3419
3524
  */
3420
- insert(...args: Parameters<typeof this$1.model.insert>): ReturnType<typeof this$1.model.insert>;
3525
+ insert(...args: Parameters<typeof this$1.model.insert<T>>): ReturnType<typeof this$1.model.insert>;
3421
3526
  /**
3422
3527
  * @description Inserts multiple records into the database, it is not advised to use this method directly from the query builder if using a ModelQueryBuilder (`Model.query()`), use the `Model.insertMany` method instead.
3423
3528
  */
3424
- insertMany(...args: Parameters<typeof this$1.model.insertMany>): ReturnType<typeof this$1.model.insertMany>;
3529
+ insertMany(...args: Parameters<typeof this$1.model.insertMany<T>>): ReturnType<typeof this$1.model.insertMany>;
3425
3530
  update(data: Partial<ModelWithoutRelations<T>>, options?: UpdateOptions): Promise<number>;
3426
3531
  softDelete(options?: SoftDeleteOptions<T>): Promise<number>;
3427
3532
  delete(options?: DeleteOptions): Promise<number>;
@@ -3447,25 +3552,209 @@ declare class ModelQueryBuilder<T extends Model, A extends Record<string, any> =
3447
3552
  select(...columns: (ModelKey<T> | "*")[]): this;
3448
3553
  /**
3449
3554
  * @description Annotates a column with a SQL method or a simple alias
3450
- * @description If using a model, the result will be available in the $annotations property of the model, else it will be available in the result of the query
3555
+ * @description If the alias matches a model field name, it overrides that field. Otherwise, it's available in $annotations
3451
3556
  * @example
3452
3557
  * ```ts
3453
3558
  * const user = await User.query().annotate("max", "id", "maxId").first(); // max(id) as maxId
3454
3559
  * const user = await User.query().annotate("id", "superId").first(); // id as superId
3560
+ * // If alias matches model field, it overrides it:
3561
+ * const user = await User.query().annotate("COUNT(*)", "email").first(); // user.email is now a number
3455
3562
  * ```
3456
3563
  */
3457
- annotate<K extends string, V = any>(column: string, alias: K): ModelQueryBuilder<T, A & {
3458
- [P in K]: V;
3459
- }, R>;
3460
- annotate<K extends string, S extends SqlMethod, V = CommonSqlMethodReturnType<S>>(sqlMethod: string, column: string, alias: K): ModelQueryBuilder<T, A & {
3461
- [P in K]: V;
3462
- }, R>;
3463
- annotate<K extends string, S extends SqlMethod, V = CommonSqlMethodReturnType<S>>(sqlMethod: S, column: string, alias: K): ModelQueryBuilder<T, A & {
3464
- [P in K]: V;
3465
- }, R>;
3466
- annotate<K extends string, S extends SqlMethod, V = CommonSqlMethodReturnType<S>>(sqlMethod: S, column: string, alias: K): ModelQueryBuilder<T, A & {
3467
- [P in K]: V;
3468
- }, R>;
3564
+ annotate<K extends string, V = any>(column: string, alias: K): AnnotationResult<T, A, R, K, V>;
3565
+ annotate<K extends string, S extends SqlMethod, V = CommonSqlMethodReturnType<S>>(sqlMethod: string, column: string, alias: K): AnnotationResult<T, A, R, K, V>;
3566
+ annotate<K extends string, S extends SqlMethod, V = CommonSqlMethodReturnType<S>>(sqlMethod: S, column: string, alias: K): AnnotationResult<T, A, R, K, V>;
3567
+ annotate<K extends string, S extends SqlMethod, V = CommonSqlMethodReturnType<S>>(sqlMethod: S, column: string, alias: K): AnnotationResult<T, A, R, K, V>;
3568
+ /**
3569
+ * @description Selects a JSON value at the specified path and returns it as JSON
3570
+ * @param column The column containing JSON data
3571
+ * @param path The JSON path to extract (standardized format: "$.user.name", "user.name", or ["user", "name"])
3572
+ * @param alias The alias for the selected value
3573
+ * @description Path format is standardized across all databases - ORM converts to DB-specific syntax
3574
+ * @description If alias matches a model field, it overrides that field. Otherwise, it's in $annotations
3575
+ * @example
3576
+ * ```ts
3577
+ * // All these path formats are supported:
3578
+ *
3579
+ * // 1. With $ prefix (standard JSON path)
3580
+ * await User.query().selectJson("data", "$.user.name", "userName").first();
3581
+ *
3582
+ * // 2. Without $ prefix ($ is optional)
3583
+ * await User.query().selectJson("data", "user.name", "userName").first();
3584
+ *
3585
+ * // 3. Array format
3586
+ * await User.query().selectJson("data", ["user", "name"], "userName").first();
3587
+ *
3588
+ * // 4. Array indices with dot notation
3589
+ * await User.query().selectJson("data", "items.0.name", "firstItemName").first();
3590
+ *
3591
+ * // 5. Array indices with array format
3592
+ * await User.query().selectJson("data", ["items", 0, "name"], "firstItemName").first();
3593
+ *
3594
+ * // 6. Root object
3595
+ * await User.query().selectJson("data", "$", "allData").first();
3596
+ *
3597
+ * // Access the result - in $annotations if not a model field
3598
+ * const user = await User.query().selectJson("data", "user.name", "userName").first();
3599
+ * console.log(user?.$annotations?.userName); // Typed as any
3600
+ *
3601
+ * // If alias matches model field, it overrides it
3602
+ * const user2 = await User.query().selectJson("data", "$.name", "email").first();
3603
+ * console.log(user2?.email); // Overrides model's email field
3604
+ * ```
3605
+ */
3606
+ selectJson<K extends string>(column: ModelKey<T>, path: JsonPathInput, alias: K): AnnotationResult<T, A, R, K, any>;
3607
+ selectJson<K extends string>(column: string, path: JsonPathInput, alias: K): AnnotationResult<T, A, R, K, any>;
3608
+ /**
3609
+ * @description Selects a JSON value at the specified path and returns it as text
3610
+ * @param column The column containing JSON data
3611
+ * @param path The JSON path to extract (standardized format)
3612
+ * @param alias The alias for the selected value
3613
+ * @description Path format is standardized across all databases - ORM converts to DB-specific syntax
3614
+ * @description If alias matches a model field, it overrides that field. Otherwise, it's in $annotations
3615
+ * @example
3616
+ * ```ts
3617
+ * // All these path formats are supported:
3618
+ *
3619
+ * // 1. With $ prefix
3620
+ * await User.query().selectJsonText("data", "$.user.email", "userEmail").first();
3621
+ *
3622
+ * // 2. Without $ prefix
3623
+ * await User.query().selectJsonText("data", "user.email", "userEmail").first();
3624
+ *
3625
+ * // 3. Array format
3626
+ * await User.query().selectJsonText("data", ["user", "email"], "userEmail").first();
3627
+ *
3628
+ * // 4. Array indices
3629
+ * await User.query().selectJsonText("data", "tags.0", "firstTag").first();
3630
+ * await User.query().selectJsonText("data", ["tags", 0], "firstTag").first();
3631
+ *
3632
+ * // 5. Deep nesting
3633
+ * await User.query().selectJsonText("data", "user.profile.bio", "biography").first();
3634
+ *
3635
+ * // Access the result - in $annotations if not a model field
3636
+ * const user = await User.query().selectJsonText("data", "user.email", "userEmail").first();
3637
+ * console.log(user?.$annotations?.userEmail); // Typed as string
3638
+ * ```
3639
+ */
3640
+ selectJsonText<K extends string>(column: ModelKey<T>, path: JsonPathInput, alias: K): AnnotationResult<T, A, R, K, string>;
3641
+ selectJsonText<K extends string>(column: string, path: JsonPathInput, alias: K): AnnotationResult<T, A, R, K, string>;
3642
+ /**
3643
+ * @description Selects the length of a JSON array
3644
+ * @param column The column containing JSON array data
3645
+ * @param path The JSON path to the array (standardized format, use "$" or "" for root)
3646
+ * @param alias The alias for the length value
3647
+ * @description Path format is standardized across all databases - ORM converts to DB-specific syntax
3648
+ * @description If alias matches a model field, it overrides that field. Otherwise, it's in $annotations
3649
+ * @warning Not supported in SQLite
3650
+ * @example
3651
+ * ```ts
3652
+ * // All these path formats are supported:
3653
+ *
3654
+ * // 1. With $ prefix
3655
+ * await User.query().selectJsonArrayLength("data", "$.items", "itemCount").first();
3656
+ *
3657
+ * // 2. Without $ prefix
3658
+ * await User.query().selectJsonArrayLength("data", "items", "itemCount").first();
3659
+ *
3660
+ * // 3. Array format
3661
+ * await User.query().selectJsonArrayLength("data", ["items"], "itemCount").first();
3662
+ *
3663
+ * // 4. Root array (use "$" or "")
3664
+ * await User.query().selectJsonArrayLength("data", "$", "totalCount").first();
3665
+ * await User.query().selectJsonArrayLength("data", "", "totalCount").first();
3666
+ *
3667
+ * // 5. Nested arrays
3668
+ * await User.query().selectJsonArrayLength("data", "user.roles", "roleCount").first();
3669
+ * await User.query().selectJsonArrayLength("data", ["user", "roles"], "roleCount").first();
3670
+ *
3671
+ * // 6. Deeply nested arrays
3672
+ * await User.query().selectJsonArrayLength("data", "level1.level2.items", "deepCount").first();
3673
+ *
3674
+ * // Access the result - in $annotations if not a model field
3675
+ * const user = await User.query().selectJsonArrayLength("data", "items", "count").first();
3676
+ * console.log(user?.$annotations?.count); // Typed as number
3677
+ * ```
3678
+ */
3679
+ selectJsonArrayLength<K extends string>(column: ModelKey<T>, path: JsonPathInput, alias: K): AnnotationResult<T, A, R, K, number>;
3680
+ selectJsonArrayLength<K extends string>(column: string, path: JsonPathInput, alias: K): AnnotationResult<T, A, R, K, number>;
3681
+ /**
3682
+ * @description Selects the keys of a JSON object
3683
+ * @param column The column containing JSON object data
3684
+ * @param path The JSON path to the object (standardized format, use "$" or "" for root)
3685
+ * @param alias The alias for the keys
3686
+ * @description Path format is standardized across all databases - ORM converts to DB-specific syntax
3687
+ * @description If alias matches a model field, it overrides that field. Otherwise, it's in $annotations
3688
+ * @warning Not supported in SQLite or MSSQL
3689
+ * @postgresql Returns a native array of keys
3690
+ * @mysql Returns a JSON array of keys
3691
+ * @example
3692
+ * ```ts
3693
+ * // All these path formats are supported:
3694
+ *
3695
+ * // 1. With $ prefix
3696
+ * await User.query().selectJsonKeys("data", "$.settings", "settingKeys").first();
3697
+ *
3698
+ * // 2. Without $ prefix
3699
+ * await User.query().selectJsonKeys("data", "settings", "settingKeys").first();
3700
+ *
3701
+ * // 3. Array format
3702
+ * await User.query().selectJsonKeys("data", ["settings"], "settingKeys").first();
3703
+ *
3704
+ * // 4. Root object (use "$" or "")
3705
+ * await User.query().selectJsonKeys("data", "$", "rootKeys").first();
3706
+ * await User.query().selectJsonKeys("data", "", "rootKeys").first();
3707
+ *
3708
+ * // 5. Nested objects
3709
+ * await User.query().selectJsonKeys("data", "user.profile", "profileKeys").first();
3710
+ * await User.query().selectJsonKeys("data", ["user", "profile"], "profileKeys").first();
3711
+ *
3712
+ * // 6. Deeply nested objects
3713
+ * await User.query().selectJsonKeys("data", "settings.display.theme", "themeKeys").first();
3714
+ *
3715
+ * // Access the result - in $annotations if not a model field
3716
+ * const user = await User.query().selectJsonKeys("data", "settings", "keys").first();
3717
+ * console.log(user?.$annotations?.keys); // Typed as any[] - ["theme", "fontSize", "autoSave"]
3718
+ * ```
3719
+ */
3720
+ selectJsonKeys<K extends string>(column: ModelKey<T>, path: JsonPathInput, alias: K): AnnotationResult<T, A, R, K, any[]>;
3721
+ selectJsonKeys<K extends string>(column: string, path: JsonPathInput, alias: K): AnnotationResult<T, A, R, K, any[]>;
3722
+ /**
3723
+ * @description Adds a raw JSON select expression for database-specific operations
3724
+ * @param raw The raw SQL expression (database-specific syntax)
3725
+ * @param alias The alias for the selected value
3726
+ * @description If alias matches a model field, it overrides that field. Otherwise, it's in $annotations
3727
+ * @description Use this for advanced JSON operations not covered by other selectJson* methods
3728
+ * @warning This bypasses path standardization - you must write database-specific SQL
3729
+ * @example
3730
+ * ```ts
3731
+ * // PostgreSQL - Extract as text with ->> operator
3732
+ * await User.query().selectJsonRaw("data->>'email'", "userEmail").first();
3733
+ *
3734
+ * // PostgreSQL - Extract nested JSON with -> operator
3735
+ * await User.query().selectJsonRaw("data->'user'->'profile'->>'name'", "profileName").first();
3736
+ *
3737
+ * // PostgreSQL - Array element access
3738
+ * await User.query().selectJsonRaw("data->'items'->0->>'name'", "firstName").first();
3739
+ *
3740
+ * // MySQL - Extract value with JSON_EXTRACT and ->>
3741
+ * await User.query().selectJsonRaw("data->>'$.email'", "userEmail").first();
3742
+ *
3743
+ * // MySQL - Array length with JSON_LENGTH
3744
+ * await User.query().selectJsonRaw("JSON_LENGTH(data, '$.items')", "itemCount").first();
3745
+ *
3746
+ * // MSSQL - Extract value with JSON_VALUE
3747
+ * await User.query().selectJsonRaw("JSON_VALUE(data, '$.email')", "userEmail").first();
3748
+ *
3749
+ * // SQLite - Extract value with json_extract
3750
+ * await User.query().selectJsonRaw("json_extract(data, '$.email')", "userEmail").first();
3751
+ *
3752
+ * // Access the result - in $annotations if not a model field
3753
+ * const user = await User.query().selectJsonRaw("data->>'email'", "userEmail").first();
3754
+ * console.log(user?.$annotations?.userEmail); // Typed as any
3755
+ * ```
3756
+ */
3757
+ selectJsonRaw<K extends string>(raw: string, alias: K): AnnotationResult<T, A, R, K, any>;
3469
3758
  /**
3470
3759
  * @description Removes annotations from the serialized model, by default, annotations are maintained in the serialized model if `annotate` is used
3471
3760
  */
@@ -4230,7 +4519,7 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
4230
4519
  private connectWithoutSettingPrimary;
4231
4520
  }
4232
4521
 
4233
- type ModelWithoutRelations<T extends Model> = Pick<T, ExcludeRelations<Omit<T, "*">>>;
4522
+ type ModelWithoutRelations<T extends Model> = Pick<Omit<T, "*">, ExcludeRelations<Omit<T, "*">>> & Pick<Model, keyof Model>;
4234
4523
  type NumberModelKey<T extends Model> = {
4235
4524
  [K in keyof T]: T[K] extends number | bigint ? K : never;
4236
4525
  }[keyof T];
@@ -5077,6 +5366,12 @@ declare abstract class Model extends Entity {
5077
5366
  * @throws {HysteriaError} If the model has no primary key valorized in the instance
5078
5367
  */
5079
5368
  refresh<T extends Model = this>(options?: Omit<BaseModelMethodOptions, "ignoreHooks">): Promise<T>;
5369
+ /**
5370
+ * @description Converts the model to a JSON object
5371
+ * @description Flattens all `$annotations` into the JSON object at first level including the relations
5372
+ * @warning Use with caution, this method flattens the `$annotations` into the JSON object at first level including the relations, so if you have conflicting column names between model columns and annotations, the annotation could override the model column value
5373
+ */
5374
+ toJSON(): Record<string, any>;
5080
5375
  }
5081
5376
 
5082
5377
  type BaseModelRelationType = {