hysteria-orm 10.0.7 → 10.0.9

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
@@ -1382,10 +1382,10 @@ declare class InterpreterUtils {
1382
1382
  * @description Formats the table name for the database type, idempotent for quoting
1383
1383
  */
1384
1384
  formatStringTable(dbType: SqlDataSourceType, table: string): string;
1385
- prepareColumns(columns: string[], values: any[], mode?: "insert" | "update"): {
1385
+ prepareColumns(columns: string[], values: any[], mode?: "insert" | "update"): Promise<{
1386
1386
  columns: string[];
1387
1387
  values: any[];
1388
- };
1388
+ }>;
1389
1389
  /**
1390
1390
  * @description Formats the from node for write operations removing the "from" keyword
1391
1391
  */
@@ -1410,40 +1410,48 @@ declare class DryQueryBuilder extends QueryBuilder {
1410
1410
  /**
1411
1411
  * @description Builds the insert query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
1412
1412
  * @param args The arguments to pass to the insert method
1413
+ * @warning This method does not run model or column hooks
1413
1414
  * @returns The query builder
1414
1415
  */
1415
1416
  insert(...args: Parameters<typeof QueryBuilder.prototype.insert>): this;
1416
1417
  /**
1417
1418
  * @description Builds the insert many query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
1418
1419
  * @param args The arguments to pass to the insert many method
1420
+ * @warning This method does not run model or column hooks
1419
1421
  * @returns The query builder
1420
1422
  */
1421
1423
  insertMany(...args: Parameters<typeof QueryBuilder.prototype.insertMany>): this;
1422
1424
  /**
1423
1425
  * @description Builds the upsert query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
1424
1426
  * @param args The arguments to pass to the upsert method
1427
+ * @warning This method does not run model or column hooks
1425
1428
  * @returns The query builder
1426
1429
  */
1427
1430
  upsert(...args: Parameters<typeof QueryBuilder.prototype.upsert>): this;
1431
+ upsertMany(...args: Parameters<typeof QueryBuilder.prototype.upsertMany>): this;
1428
1432
  /**
1429
1433
  * @description Builds the update query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
1430
1434
  * @param data The data to update
1435
+ * @warning This method does not run model or column hooks
1431
1436
  * @returns The query builder
1432
1437
  */
1433
1438
  update(data: Record<string, any>): this;
1434
1439
  /**
1435
1440
  * @description Builds the delete query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
1441
+ * @warning This method does not run model or column hooks
1436
1442
  * @returns The query builder
1437
1443
  */
1438
1444
  delete(): this;
1439
1445
  /**
1440
1446
  * @description Builds the truncate query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
1447
+ * @warning This method does not run model or column hooks
1441
1448
  * @returns The query builder
1442
1449
  */
1443
1450
  truncate(): this;
1444
1451
  /**
1445
1452
  * @description Builds the soft delete query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
1446
1453
  * @param options Soft delete options
1454
+ * @warning This method does not run model or column hooks
1447
1455
  * @returns The query builder
1448
1456
  */
1449
1457
  softDelete(options?: Omit<SoftDeleteOptions<any>, "ignoreBeforeDeleteHook">): this;
@@ -1764,8 +1772,8 @@ ColumnDataTypeOption;
1764
1772
  type ColumnType = {
1765
1773
  columnName: string;
1766
1774
  databaseName: string;
1767
- serialize?: (value: any) => any;
1768
- prepare?: (value: any) => any;
1775
+ serialize?: (value: any) => any | Promise<any>;
1776
+ prepare?: (value: any) => any | Promise<any>;
1769
1777
  hidden?: boolean;
1770
1778
  autoUpdate?: boolean;
1771
1779
  isPrimary: boolean;
@@ -2462,7 +2470,7 @@ type UpsertOptionsRawBuilder = {
2462
2470
  updateOnConflict?: boolean;
2463
2471
  returning?: string[];
2464
2472
  };
2465
- type DryQueryBuilderWithoutReadOperations = Omit<DryQueryBuilder, "many" | "one" | "oneOrFail" | "first" | "firstOrFail" | "paginate" | "paginateWithCursor" | "exists" | "pluck" | "upsert" | "upsertMany" | "increment" | "decrement" | "getSum" | "getAvg" | "getMin" | "getMax" | "getCount" | "stream" | "chunk" | "paginate" | "paginateWithCursor" | "exists">;
2473
+ type DryQueryBuilderWithoutReadOperations = Omit<DryQueryBuilder, "many" | "one" | "oneOrFail" | "first" | "firstOrFail" | "paginate" | "paginateWithCursor" | "exists" | "pluck" | "increment" | "decrement" | "getSum" | "getAvg" | "getMin" | "getMax" | "getCount" | "stream" | "chunk" | "paginate" | "paginateWithCursor" | "exists">;
2466
2474
  type DryModelQueryBuilderWithoutReadOperations<T extends Model, A extends Record<string, any> = {}, R extends Record<string, any> = {}> = Omit<DryModelQueryBuilder<T, A, R>, "many" | "one" | "oneOrFail" | "first" | "firstOrFail" | "paginate" | "paginateWithCursor" | "exists" | "pluck" | "upsert" | "upsertMany" | "increment" | "decrement" | "getSum" | "getAvg" | "getMin" | "getMax" | "getCount" | "stream" | "chunk" | "paginate" | "paginateWithCursor" | "exists">;
2467
2475
 
2468
2476
  declare class SqlModelManagerUtils<T extends Model> {
@@ -2885,19 +2893,21 @@ declare class DryModelQueryBuilder<T extends Model, A extends Record<string, any
2885
2893
  /**
2886
2894
  * @description Builds the insert query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
2887
2895
  * @param args The arguments to pass to the insert method
2896
+ * @warning This method does not run model or column hooks
2888
2897
  * @returns The query builder
2889
2898
  */
2890
2899
  insert(...args: Parameters<typeof this$1.model.insert<T>>): this;
2891
2900
  /**
2892
2901
  * @description Builds the insert many query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
2893
2902
  * @param args The arguments to pass to the insert many method
2903
+ * @warning This method does not run model or column hooks
2894
2904
  * @returns The query builder
2895
2905
  */
2896
2906
  insertMany(...args: Parameters<typeof this$1.model.insertMany<T>>): this;
2897
2907
  /**
2898
2908
  * @description Builds the update query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
2899
2909
  * @param data The data to update
2900
- * @param options Update options
2910
+ * @warning This method does not run model or column hooks
2901
2911
  * @returns The query builder
2902
2912
  */
2903
2913
  update(...args: Parameters<ReturnType<typeof this$1.model.query<T>>["update"]>): this;
@@ -2915,6 +2925,7 @@ declare class DryModelQueryBuilder<T extends Model, A extends Record<string, any
2915
2925
  /**
2916
2926
  * @description Builds the soft delete query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
2917
2927
  * @param options Soft delete options
2928
+ * @warning This method does not run model or column hooks
2918
2929
  * @returns The query builder
2919
2930
  */
2920
2931
  softDelete(...args: Parameters<ReturnType<typeof this$1.model.query<T>>["softDelete"]>): this;
@@ -3460,6 +3471,19 @@ declare class InsertNode extends QueryNode {
3460
3471
  constructor(fromNode: FromNode, records?: Record<string, any>[], returning?: string[], disableReturning?: boolean, isRawValue?: boolean);
3461
3472
  }
3462
3473
 
3474
+ declare class OnDuplicateNode extends QueryNode {
3475
+ table: string;
3476
+ conflictColumns: string[];
3477
+ columnsToUpdate: string[];
3478
+ returning?: string[];
3479
+ mode: "update" | "ignore";
3480
+ chainsWith: string;
3481
+ canKeywordBeSeenMultipleTimes: boolean;
3482
+ folder: string;
3483
+ file: string;
3484
+ constructor(table: string, conflictColumns: string[], columnsToUpdate: string[], mode?: "update" | "ignore", returning?: string[], isRawValue?: boolean);
3485
+ }
3486
+
3463
3487
  declare class TruncateNode extends QueryNode {
3464
3488
  fromNode: FromNode | string;
3465
3489
  chainsWith: string;
@@ -3490,6 +3514,7 @@ declare class QueryBuilder<T extends Model = any> extends JsonQueryBuilder<T> {
3490
3514
  protected mustRemoveAnnotations: boolean;
3491
3515
  protected interpreterUtils: InterpreterUtils;
3492
3516
  protected insertNode: InsertNode | null;
3517
+ protected onDuplicateNode: OnDuplicateNode | null;
3493
3518
  protected updateNode: UpdateNode | null;
3494
3519
  protected deleteNode: DeleteNode | null;
3495
3520
  protected truncateNode: TruncateNode | null;
package/lib/index.d.ts CHANGED
@@ -1382,10 +1382,10 @@ declare class InterpreterUtils {
1382
1382
  * @description Formats the table name for the database type, idempotent for quoting
1383
1383
  */
1384
1384
  formatStringTable(dbType: SqlDataSourceType, table: string): string;
1385
- prepareColumns(columns: string[], values: any[], mode?: "insert" | "update"): {
1385
+ prepareColumns(columns: string[], values: any[], mode?: "insert" | "update"): Promise<{
1386
1386
  columns: string[];
1387
1387
  values: any[];
1388
- };
1388
+ }>;
1389
1389
  /**
1390
1390
  * @description Formats the from node for write operations removing the "from" keyword
1391
1391
  */
@@ -1410,40 +1410,48 @@ declare class DryQueryBuilder extends QueryBuilder {
1410
1410
  /**
1411
1411
  * @description Builds the insert query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
1412
1412
  * @param args The arguments to pass to the insert method
1413
+ * @warning This method does not run model or column hooks
1413
1414
  * @returns The query builder
1414
1415
  */
1415
1416
  insert(...args: Parameters<typeof QueryBuilder.prototype.insert>): this;
1416
1417
  /**
1417
1418
  * @description Builds the insert many query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
1418
1419
  * @param args The arguments to pass to the insert many method
1420
+ * @warning This method does not run model or column hooks
1419
1421
  * @returns The query builder
1420
1422
  */
1421
1423
  insertMany(...args: Parameters<typeof QueryBuilder.prototype.insertMany>): this;
1422
1424
  /**
1423
1425
  * @description Builds the upsert query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
1424
1426
  * @param args The arguments to pass to the upsert method
1427
+ * @warning This method does not run model or column hooks
1425
1428
  * @returns The query builder
1426
1429
  */
1427
1430
  upsert(...args: Parameters<typeof QueryBuilder.prototype.upsert>): this;
1431
+ upsertMany(...args: Parameters<typeof QueryBuilder.prototype.upsertMany>): this;
1428
1432
  /**
1429
1433
  * @description Builds the update query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
1430
1434
  * @param data The data to update
1435
+ * @warning This method does not run model or column hooks
1431
1436
  * @returns The query builder
1432
1437
  */
1433
1438
  update(data: Record<string, any>): this;
1434
1439
  /**
1435
1440
  * @description Builds the delete query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
1441
+ * @warning This method does not run model or column hooks
1436
1442
  * @returns The query builder
1437
1443
  */
1438
1444
  delete(): this;
1439
1445
  /**
1440
1446
  * @description Builds the truncate query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
1447
+ * @warning This method does not run model or column hooks
1441
1448
  * @returns The query builder
1442
1449
  */
1443
1450
  truncate(): this;
1444
1451
  /**
1445
1452
  * @description Builds the soft delete query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
1446
1453
  * @param options Soft delete options
1454
+ * @warning This method does not run model or column hooks
1447
1455
  * @returns The query builder
1448
1456
  */
1449
1457
  softDelete(options?: Omit<SoftDeleteOptions<any>, "ignoreBeforeDeleteHook">): this;
@@ -1764,8 +1772,8 @@ ColumnDataTypeOption;
1764
1772
  type ColumnType = {
1765
1773
  columnName: string;
1766
1774
  databaseName: string;
1767
- serialize?: (value: any) => any;
1768
- prepare?: (value: any) => any;
1775
+ serialize?: (value: any) => any | Promise<any>;
1776
+ prepare?: (value: any) => any | Promise<any>;
1769
1777
  hidden?: boolean;
1770
1778
  autoUpdate?: boolean;
1771
1779
  isPrimary: boolean;
@@ -2462,7 +2470,7 @@ type UpsertOptionsRawBuilder = {
2462
2470
  updateOnConflict?: boolean;
2463
2471
  returning?: string[];
2464
2472
  };
2465
- type DryQueryBuilderWithoutReadOperations = Omit<DryQueryBuilder, "many" | "one" | "oneOrFail" | "first" | "firstOrFail" | "paginate" | "paginateWithCursor" | "exists" | "pluck" | "upsert" | "upsertMany" | "increment" | "decrement" | "getSum" | "getAvg" | "getMin" | "getMax" | "getCount" | "stream" | "chunk" | "paginate" | "paginateWithCursor" | "exists">;
2473
+ type DryQueryBuilderWithoutReadOperations = Omit<DryQueryBuilder, "many" | "one" | "oneOrFail" | "first" | "firstOrFail" | "paginate" | "paginateWithCursor" | "exists" | "pluck" | "increment" | "decrement" | "getSum" | "getAvg" | "getMin" | "getMax" | "getCount" | "stream" | "chunk" | "paginate" | "paginateWithCursor" | "exists">;
2466
2474
  type DryModelQueryBuilderWithoutReadOperations<T extends Model, A extends Record<string, any> = {}, R extends Record<string, any> = {}> = Omit<DryModelQueryBuilder<T, A, R>, "many" | "one" | "oneOrFail" | "first" | "firstOrFail" | "paginate" | "paginateWithCursor" | "exists" | "pluck" | "upsert" | "upsertMany" | "increment" | "decrement" | "getSum" | "getAvg" | "getMin" | "getMax" | "getCount" | "stream" | "chunk" | "paginate" | "paginateWithCursor" | "exists">;
2467
2475
 
2468
2476
  declare class SqlModelManagerUtils<T extends Model> {
@@ -2885,19 +2893,21 @@ declare class DryModelQueryBuilder<T extends Model, A extends Record<string, any
2885
2893
  /**
2886
2894
  * @description Builds the insert query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
2887
2895
  * @param args The arguments to pass to the insert method
2896
+ * @warning This method does not run model or column hooks
2888
2897
  * @returns The query builder
2889
2898
  */
2890
2899
  insert(...args: Parameters<typeof this$1.model.insert<T>>): this;
2891
2900
  /**
2892
2901
  * @description Builds the insert many query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
2893
2902
  * @param args The arguments to pass to the insert many method
2903
+ * @warning This method does not run model or column hooks
2894
2904
  * @returns The query builder
2895
2905
  */
2896
2906
  insertMany(...args: Parameters<typeof this$1.model.insertMany<T>>): this;
2897
2907
  /**
2898
2908
  * @description Builds the update query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
2899
2909
  * @param data The data to update
2900
- * @param options Update options
2910
+ * @warning This method does not run model or column hooks
2901
2911
  * @returns The query builder
2902
2912
  */
2903
2913
  update(...args: Parameters<ReturnType<typeof this$1.model.query<T>>["update"]>): this;
@@ -2915,6 +2925,7 @@ declare class DryModelQueryBuilder<T extends Model, A extends Record<string, any
2915
2925
  /**
2916
2926
  * @description Builds the soft delete query statement without executing it, use 'unWrap' or 'toQuery' to get the query statement
2917
2927
  * @param options Soft delete options
2928
+ * @warning This method does not run model or column hooks
2918
2929
  * @returns The query builder
2919
2930
  */
2920
2931
  softDelete(...args: Parameters<ReturnType<typeof this$1.model.query<T>>["softDelete"]>): this;
@@ -3460,6 +3471,19 @@ declare class InsertNode extends QueryNode {
3460
3471
  constructor(fromNode: FromNode, records?: Record<string, any>[], returning?: string[], disableReturning?: boolean, isRawValue?: boolean);
3461
3472
  }
3462
3473
 
3474
+ declare class OnDuplicateNode extends QueryNode {
3475
+ table: string;
3476
+ conflictColumns: string[];
3477
+ columnsToUpdate: string[];
3478
+ returning?: string[];
3479
+ mode: "update" | "ignore";
3480
+ chainsWith: string;
3481
+ canKeywordBeSeenMultipleTimes: boolean;
3482
+ folder: string;
3483
+ file: string;
3484
+ constructor(table: string, conflictColumns: string[], columnsToUpdate: string[], mode?: "update" | "ignore", returning?: string[], isRawValue?: boolean);
3485
+ }
3486
+
3463
3487
  declare class TruncateNode extends QueryNode {
3464
3488
  fromNode: FromNode | string;
3465
3489
  chainsWith: string;
@@ -3490,6 +3514,7 @@ declare class QueryBuilder<T extends Model = any> extends JsonQueryBuilder<T> {
3490
3514
  protected mustRemoveAnnotations: boolean;
3491
3515
  protected interpreterUtils: InterpreterUtils;
3492
3516
  protected insertNode: InsertNode | null;
3517
+ protected onDuplicateNode: OnDuplicateNode | null;
3493
3518
  protected updateNode: UpdateNode | null;
3494
3519
  protected deleteNode: DeleteNode | null;
3495
3520
  protected truncateNode: TruncateNode | null;