hysteria-orm 10.4.0 → 10.4.2

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
@@ -1078,9 +1078,32 @@ type AdminJsInstance = {
1078
1078
  };
1079
1079
 
1080
1080
  interface CacheAdapter {
1081
+ /**
1082
+ * @description Gets a value from the cache
1083
+ * @param key The key to get the value from
1084
+ * @returns The value from the cache
1085
+ */
1081
1086
  get<T = void>(key: string): Promise<T>;
1087
+ /**
1088
+ * @description Sets a value in the cache
1089
+ * @param key The key to set the value to
1090
+ * @param data The value to set in the cache
1091
+ * @param ttl The time to live for the value in milliseconds
1092
+ */
1082
1093
  set<T = any>(key: string, data: T, ttl?: number): Promise<void>;
1094
+ /**
1095
+ * @description Invalidates a value from the cache
1096
+ * @param key The key to invalidate the value from
1097
+ */
1083
1098
  invalidate(key: string): Promise<void>;
1099
+ /**
1100
+ * @description Invalidates all values from the cache starting with the given key
1101
+ * @param key The key to invalidate the values from
1102
+ */
1103
+ invalidateAll(key: string): Promise<void>;
1104
+ /**
1105
+ * @description Disconnects from the cache adapter if needed when the data source disconnects
1106
+ */
1084
1107
  disconnect?(): Promise<void>;
1085
1108
  }
1086
1109
 
@@ -4009,6 +4032,11 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
4009
4032
  */
4010
4033
  invalidCache<K extends keyof C>(key: K, ...args: Parameters<C[K]>): Promise<void>;
4011
4034
  invalidCache<K extends keyof C>(key: K): Promise<void>;
4035
+ /**
4036
+ * @description Invalidates all values from the cache starting with the given key
4037
+ * @param key The key to invalidate the values from
4038
+ */
4039
+ invalidateAllCache(key: string): Promise<void>;
4012
4040
  /**
4013
4041
  * @description Clones the SqlDataSource instance
4014
4042
  * @param options.shouldRecreatePool Whether to recreate the pool of connections for the given driver, by default it's false
@@ -5099,7 +5127,10 @@ declare function view(statement: (query: ModelQueryBuilder<any>) => void): Class
5099
5127
  declare function column(options?: ColumnOptions): PropertyDecorator;
5100
5128
  declare namespace column {
5101
5129
  var primary: typeof primaryKeyColumn;
5102
- var date: typeof dateColumn;
5130
+ var date: typeof dateOnlyColumn;
5131
+ var datetime: typeof datetimeColumn;
5132
+ var timestamp: typeof timestampColumn;
5133
+ var time: typeof timeOnlyColumn;
5103
5134
  var boolean: typeof booleanColumn;
5104
5135
  var json: typeof jsonColumn;
5105
5136
  var uuid: typeof uuidColumn;
@@ -5168,18 +5199,57 @@ declare function asymmetric(options: Omit<AsymmetricEncryptionOptions, "prepare"
5168
5199
  */
5169
5200
  declare function booleanColumn(options?: Omit<ColumnOptions, "prepare" | "serialize">): PropertyDecorator;
5170
5201
  /**
5171
- * @description Decorator to define a date column in the model
5172
- * @description This will automatically convert the date to the correct format for the database
5173
- * @description Supports both ISO format (YYYY-MM-DD HH:mm:ss) and Unix timestamp
5202
+ * @description Decorator to define a DATE_ONLY column in the model (YYYY-MM-DD)
5203
+ * @description This will automatically convert the date to DATE_ONLY format
5174
5204
  * @description Handles timezone conversion between UTC and local time
5175
5205
  * @description Can automatically update/create timestamps
5176
5206
  * @param options Configuration options for the date column
5177
- * @param options.format The format to store dates in ('ISO' or 'TIMESTAMP')
5207
+ * @param options.timezone The timezone to use ('UTC' or 'LOCAL')
5208
+ * @param options.autoUpdate Whether to automatically update the date on record updates
5209
+ * @param options.autoCreate Whether to automatically set the date on record creation
5210
+ * @param options.prepare Optional custom prepare function that receives the pre-handled value
5211
+ * @param options.serialize Optional custom serialize function that receives the pre-handled value
5212
+ */
5213
+ declare function dateOnlyColumn(options?: Omit<DateColumnOptions, "format">): PropertyDecorator;
5214
+ /**
5215
+ * @description Decorator to define a DATETIME column in the model (YYYY-MM-DD HH:mm:ss)
5216
+ * @description This will automatically convert the date to ISO format
5217
+ * @description Handles timezone conversion between UTC and local time
5218
+ * @description Can automatically update/create timestamps
5219
+ * @param options Configuration options for the datetime column
5220
+ * @param options.timezone The timezone to use ('UTC' or 'LOCAL')
5221
+ * @param options.autoUpdate Whether to automatically update the timestamp on record updates
5222
+ * @param options.autoCreate Whether to automatically set the timestamp on record creation
5223
+ * @param options.prepare Optional custom prepare function that receives the pre-handled value
5224
+ * @param options.serialize Optional custom serialize function that receives the pre-handled value
5225
+ */
5226
+ declare function datetimeColumn(options?: Omit<DateColumnOptions, "format">): PropertyDecorator;
5227
+ /**
5228
+ * @description Decorator to define a TIMESTAMP column in the model (Unix timestamp)
5229
+ * @description This will automatically convert the date to Unix timestamp format
5230
+ * @description Handles timezone conversion between UTC and local time
5231
+ * @description Can automatically update/create timestamps
5232
+ * @param options Configuration options for the timestamp column
5178
5233
  * @param options.timezone The timezone to use ('UTC' or 'LOCAL')
5179
5234
  * @param options.autoUpdate Whether to automatically update the timestamp on record updates
5180
5235
  * @param options.autoCreate Whether to automatically set the timestamp on record creation
5236
+ * @param options.prepare Optional custom prepare function that receives the pre-handled value
5237
+ * @param options.serialize Optional custom serialize function that receives the pre-handled value
5238
+ */
5239
+ declare function timestampColumn(options?: Omit<DateColumnOptions, "format">): PropertyDecorator;
5240
+ /**
5241
+ * @description Decorator to define a TIME_ONLY column in the model (HH:mm:ss)
5242
+ * @description This will automatically convert the date to TIME_ONLY format
5243
+ * @description Handles timezone conversion between UTC and local time
5244
+ * @description Can automatically update/create timestamps
5245
+ * @param options Configuration options for the time column
5246
+ * @param options.timezone The timezone to use ('UTC' or 'LOCAL')
5247
+ * @param options.autoUpdate Whether to automatically update the time on record updates
5248
+ * @param options.autoCreate Whether to automatically set the time on record creation
5249
+ * @param options.prepare Optional custom prepare function that receives the pre-handled value
5250
+ * @param options.serialize Optional custom serialize function that receives the pre-handled value
5181
5251
  */
5182
- declare function dateColumn(options?: Omit<DateColumnOptions, "prepare" | "serialize">): PropertyDecorator;
5252
+ declare function timeOnlyColumn(options?: Omit<DateColumnOptions, "format">): PropertyDecorator;
5183
5253
  /**
5184
5254
  * @description Decorator to define a json column in the model
5185
5255
  * @description This will automatically convert the json to the correct format for the database
@@ -5299,6 +5369,7 @@ declare class InMemoryAdapter implements CacheAdapter {
5299
5369
  get<T = void>(key: string): Promise<T>;
5300
5370
  set<T = any>(key: string, data: T, ttl?: number): Promise<void>;
5301
5371
  invalidate(key: string): Promise<void>;
5372
+ invalidateAll(key: string): Promise<void>;
5302
5373
  }
5303
5374
 
5304
5375
  declare class RedisCacheAdapter implements CacheAdapter {
@@ -5309,6 +5380,7 @@ declare class RedisCacheAdapter implements CacheAdapter {
5309
5380
  get<T = void>(key: string): Promise<T>;
5310
5381
  set<T = any>(key: string, data: T, ttl?: number): Promise<void>;
5311
5382
  invalidate(key: string): Promise<void>;
5383
+ invalidateAll(key: string): Promise<void>;
5312
5384
  private serializeData;
5313
5385
  private deserializeData;
5314
5386
  disconnect(): Promise<void>;
package/lib/index.d.ts CHANGED
@@ -1078,9 +1078,32 @@ type AdminJsInstance = {
1078
1078
  };
1079
1079
 
1080
1080
  interface CacheAdapter {
1081
+ /**
1082
+ * @description Gets a value from the cache
1083
+ * @param key The key to get the value from
1084
+ * @returns The value from the cache
1085
+ */
1081
1086
  get<T = void>(key: string): Promise<T>;
1087
+ /**
1088
+ * @description Sets a value in the cache
1089
+ * @param key The key to set the value to
1090
+ * @param data The value to set in the cache
1091
+ * @param ttl The time to live for the value in milliseconds
1092
+ */
1082
1093
  set<T = any>(key: string, data: T, ttl?: number): Promise<void>;
1094
+ /**
1095
+ * @description Invalidates a value from the cache
1096
+ * @param key The key to invalidate the value from
1097
+ */
1083
1098
  invalidate(key: string): Promise<void>;
1099
+ /**
1100
+ * @description Invalidates all values from the cache starting with the given key
1101
+ * @param key The key to invalidate the values from
1102
+ */
1103
+ invalidateAll(key: string): Promise<void>;
1104
+ /**
1105
+ * @description Disconnects from the cache adapter if needed when the data source disconnects
1106
+ */
1084
1107
  disconnect?(): Promise<void>;
1085
1108
  }
1086
1109
 
@@ -4009,6 +4032,11 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
4009
4032
  */
4010
4033
  invalidCache<K extends keyof C>(key: K, ...args: Parameters<C[K]>): Promise<void>;
4011
4034
  invalidCache<K extends keyof C>(key: K): Promise<void>;
4035
+ /**
4036
+ * @description Invalidates all values from the cache starting with the given key
4037
+ * @param key The key to invalidate the values from
4038
+ */
4039
+ invalidateAllCache(key: string): Promise<void>;
4012
4040
  /**
4013
4041
  * @description Clones the SqlDataSource instance
4014
4042
  * @param options.shouldRecreatePool Whether to recreate the pool of connections for the given driver, by default it's false
@@ -5099,7 +5127,10 @@ declare function view(statement: (query: ModelQueryBuilder<any>) => void): Class
5099
5127
  declare function column(options?: ColumnOptions): PropertyDecorator;
5100
5128
  declare namespace column {
5101
5129
  var primary: typeof primaryKeyColumn;
5102
- var date: typeof dateColumn;
5130
+ var date: typeof dateOnlyColumn;
5131
+ var datetime: typeof datetimeColumn;
5132
+ var timestamp: typeof timestampColumn;
5133
+ var time: typeof timeOnlyColumn;
5103
5134
  var boolean: typeof booleanColumn;
5104
5135
  var json: typeof jsonColumn;
5105
5136
  var uuid: typeof uuidColumn;
@@ -5168,18 +5199,57 @@ declare function asymmetric(options: Omit<AsymmetricEncryptionOptions, "prepare"
5168
5199
  */
5169
5200
  declare function booleanColumn(options?: Omit<ColumnOptions, "prepare" | "serialize">): PropertyDecorator;
5170
5201
  /**
5171
- * @description Decorator to define a date column in the model
5172
- * @description This will automatically convert the date to the correct format for the database
5173
- * @description Supports both ISO format (YYYY-MM-DD HH:mm:ss) and Unix timestamp
5202
+ * @description Decorator to define a DATE_ONLY column in the model (YYYY-MM-DD)
5203
+ * @description This will automatically convert the date to DATE_ONLY format
5174
5204
  * @description Handles timezone conversion between UTC and local time
5175
5205
  * @description Can automatically update/create timestamps
5176
5206
  * @param options Configuration options for the date column
5177
- * @param options.format The format to store dates in ('ISO' or 'TIMESTAMP')
5207
+ * @param options.timezone The timezone to use ('UTC' or 'LOCAL')
5208
+ * @param options.autoUpdate Whether to automatically update the date on record updates
5209
+ * @param options.autoCreate Whether to automatically set the date on record creation
5210
+ * @param options.prepare Optional custom prepare function that receives the pre-handled value
5211
+ * @param options.serialize Optional custom serialize function that receives the pre-handled value
5212
+ */
5213
+ declare function dateOnlyColumn(options?: Omit<DateColumnOptions, "format">): PropertyDecorator;
5214
+ /**
5215
+ * @description Decorator to define a DATETIME column in the model (YYYY-MM-DD HH:mm:ss)
5216
+ * @description This will automatically convert the date to ISO format
5217
+ * @description Handles timezone conversion between UTC and local time
5218
+ * @description Can automatically update/create timestamps
5219
+ * @param options Configuration options for the datetime column
5220
+ * @param options.timezone The timezone to use ('UTC' or 'LOCAL')
5221
+ * @param options.autoUpdate Whether to automatically update the timestamp on record updates
5222
+ * @param options.autoCreate Whether to automatically set the timestamp on record creation
5223
+ * @param options.prepare Optional custom prepare function that receives the pre-handled value
5224
+ * @param options.serialize Optional custom serialize function that receives the pre-handled value
5225
+ */
5226
+ declare function datetimeColumn(options?: Omit<DateColumnOptions, "format">): PropertyDecorator;
5227
+ /**
5228
+ * @description Decorator to define a TIMESTAMP column in the model (Unix timestamp)
5229
+ * @description This will automatically convert the date to Unix timestamp format
5230
+ * @description Handles timezone conversion between UTC and local time
5231
+ * @description Can automatically update/create timestamps
5232
+ * @param options Configuration options for the timestamp column
5178
5233
  * @param options.timezone The timezone to use ('UTC' or 'LOCAL')
5179
5234
  * @param options.autoUpdate Whether to automatically update the timestamp on record updates
5180
5235
  * @param options.autoCreate Whether to automatically set the timestamp on record creation
5236
+ * @param options.prepare Optional custom prepare function that receives the pre-handled value
5237
+ * @param options.serialize Optional custom serialize function that receives the pre-handled value
5238
+ */
5239
+ declare function timestampColumn(options?: Omit<DateColumnOptions, "format">): PropertyDecorator;
5240
+ /**
5241
+ * @description Decorator to define a TIME_ONLY column in the model (HH:mm:ss)
5242
+ * @description This will automatically convert the date to TIME_ONLY format
5243
+ * @description Handles timezone conversion between UTC and local time
5244
+ * @description Can automatically update/create timestamps
5245
+ * @param options Configuration options for the time column
5246
+ * @param options.timezone The timezone to use ('UTC' or 'LOCAL')
5247
+ * @param options.autoUpdate Whether to automatically update the time on record updates
5248
+ * @param options.autoCreate Whether to automatically set the time on record creation
5249
+ * @param options.prepare Optional custom prepare function that receives the pre-handled value
5250
+ * @param options.serialize Optional custom serialize function that receives the pre-handled value
5181
5251
  */
5182
- declare function dateColumn(options?: Omit<DateColumnOptions, "prepare" | "serialize">): PropertyDecorator;
5252
+ declare function timeOnlyColumn(options?: Omit<DateColumnOptions, "format">): PropertyDecorator;
5183
5253
  /**
5184
5254
  * @description Decorator to define a json column in the model
5185
5255
  * @description This will automatically convert the json to the correct format for the database
@@ -5299,6 +5369,7 @@ declare class InMemoryAdapter implements CacheAdapter {
5299
5369
  get<T = void>(key: string): Promise<T>;
5300
5370
  set<T = any>(key: string, data: T, ttl?: number): Promise<void>;
5301
5371
  invalidate(key: string): Promise<void>;
5372
+ invalidateAll(key: string): Promise<void>;
5302
5373
  }
5303
5374
 
5304
5375
  declare class RedisCacheAdapter implements CacheAdapter {
@@ -5309,6 +5380,7 @@ declare class RedisCacheAdapter implements CacheAdapter {
5309
5380
  get<T = void>(key: string): Promise<T>;
5310
5381
  set<T = any>(key: string, data: T, ttl?: number): Promise<void>;
5311
5382
  invalidate(key: string): Promise<void>;
5383
+ invalidateAll(key: string): Promise<void>;
5312
5384
  private serializeData;
5313
5385
  private deserializeData;
5314
5386
  disconnect(): Promise<void>;