hysteria-orm 10.3.7 → 10.3.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
@@ -113,6 +113,10 @@ interface NotNullableMysqlSqlDataSourceInput extends MysqlSqlDataSourceInput {
113
113
  }
114
114
  interface SqliteDataSourceInput extends CommonDataSourceInput {
115
115
  readonly type?: "sqlite";
116
+ /**
117
+ * @description The filename of the database file for SQLite
118
+ * @default ":memory:"
119
+ */
116
120
  readonly database?: string;
117
121
  }
118
122
  interface NotNullableSqliteDataSourceInput extends SqliteDataSourceInput {
@@ -1149,6 +1153,21 @@ type MigrationConfigWithTransactional = MigrationConfigBase & {
1149
1153
  * @description Adds transactional option only for PostgreSQL and CockroachDB
1150
1154
  */
1151
1155
  type MigrationConfig<D extends SqlDataSourceType = SqlDataSourceType> = D extends "postgres" | "cockroachdb" ? MigrationConfigWithTransactional : MigrationConfigBase;
1156
+ /**
1157
+ * @description Seeder configuration options
1158
+ */
1159
+ type SeederConfig = {
1160
+ /**
1161
+ * @description The path to the seeders folder
1162
+ * @default "database/seeders"
1163
+ */
1164
+ path?: string;
1165
+ /**
1166
+ * @description Path to the tsconfig.json file for TypeScript seeder files
1167
+ * @default "./tsconfig.json"
1168
+ */
1169
+ tsconfig?: string;
1170
+ };
1152
1171
  /**
1153
1172
  * @description Common input properties shared across all SqlDataSource types
1154
1173
  */
@@ -1174,6 +1193,10 @@ type SqlDataSourceInputBase<T extends Record<string, SqlDataSourceModel> = {}, C
1174
1193
  * @description Migration configuration for the sql data source
1175
1194
  */
1176
1195
  migrations?: MigrationConfig<D>;
1196
+ /**
1197
+ * @description Seeder configuration for the sql data source
1198
+ */
1199
+ seeders?: SeederConfig;
1177
1200
  /**
1178
1201
  * @description The cache strategy to use for the sql data source, it's used to configure the cache strategy for the sql data source
1179
1202
  */
@@ -3833,6 +3856,13 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
3833
3856
  transactional: boolean;
3834
3857
  lockTimeout?: number;
3835
3858
  };
3859
+ /**
3860
+ * @description Seeder configuration for the sql data source
3861
+ */
3862
+ seederConfig: {
3863
+ path: string;
3864
+ tsconfig?: string;
3865
+ };
3836
3866
  /**
3837
3867
  * @description AdminJS configuration options
3838
3868
  */
@@ -6077,6 +6107,21 @@ declare class HysteriaLogger {
6077
6107
  static warn(message: string): void;
6078
6108
  }
6079
6109
 
6110
+ /**
6111
+ * @description Base class for all seeders
6112
+ * @description Provides access to the SqlDataSource instance
6113
+ */
6114
+ declare abstract class BaseSeeder {
6115
+ protected sqlDataSource: SqlDataSource;
6116
+ readonly logger: typeof HysteriaLogger;
6117
+ constructor(sqlDataSource: SqlDataSource);
6118
+ /**
6119
+ * @description Run the seeder
6120
+ * @description This method should be implemented by all seeders
6121
+ */
6122
+ abstract run(): Promise<void>;
6123
+ }
6124
+
6080
6125
  type WithPerformanceResult<R = any> = [string, R];
6081
6126
  /**
6082
6127
  * @description executes the async function with a timer to check how long it took
@@ -6111,4 +6156,4 @@ declare const generateOpenApiModelWithMetadata: <T extends new () => Model>(mode
6111
6156
  $id?: string;
6112
6157
  }>;
6113
6158
 
6114
- export { type AdminJsActionOptions, type AdminJsAssets, type AdminJsBranding, type AdminJsInstance, type AdminJsLocale, type AdminJsOptions, type AdminJsPage, type AdminJsPropertyOptions, type AdminJsResourceOptions, type AdminJsSettings, type AnnotatedModel, type AsymmetricEncryptionOptions, AutogeneratedModel, type BaseModelMethodOptions, type BaseModelRelationType, type CacheAdapter, type CacheKeys, ClientMigrator, Collection, type ColumnDataTypeOption, type ColumnDataTypeOptionSimple, type ColumnDataTypeOptionWithBinary, type ColumnDataTypeOptionWithDatePrecision, type ColumnDataTypeOptionWithEnum, type ColumnDataTypeOptionWithLength, type ColumnDataTypeOptionWithPrecision, type ColumnDataTypeOptionWithScaleAndPrecision, type ColumnDataTypeOptionWithText, type ColumnOptions, type ColumnType, type CommonDataSourceInput, type CommonSqlMethodReturnType, type ConnectionPolicies, type DataSourceInput, type DataSourceType, type DateColumnOptions, DryModelQueryBuilder, DryQueryBuilder, type FetchHooks, type GetConnectionReturnType, HysteriaError, InMemoryAdapter, type IndexType, type LazyRelationType, type ManyOptions, type ManyToManyOptions, type ManyToManyStringOptions, Migration, type MigrationConfig, type MigrationConfigBase, Model, type ModelInstanceType, ModelQueryBuilder, type ModelWithoutRelations, MongoDataSource, type MongoDataSourceInput$1 as MongoDataSourceInput, type MssqlConnectionInstance, type MssqlDataSourceInput, type MssqlPoolInstance, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullableOracleDBDataSourceInput, type NotNullableOracleMssqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NumberModelKey, type OneOptions, type OracleDBDataSourceInput, type OracleDBPoolInstance, type PgPoolClientInstance, type PostgresSqlDataSourceInput, QueryBuilder, type RawModelOptions, RawNode, type RawQueryOptions, RedisCacheAdapter, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationQueryBuilderType, type ReplicationType, type SlaveAlgorithm, type SlaveContext, type SqlCloneOptions, SqlDataSource, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDriverSpecificOptions, type SqlPoolType, type Sqlite3ConnectionOptions, type SqliteConnectionInstance, type SqliteDataSourceInput, type StartTransactionOptions, type SymmetricEncryptionOptions, type TableFormat, type ThroughModel, TimestampedModel, Transaction, type TransactionExecutionOptions, type UniqueType, type UseCacheReturnType, type UseConnectionInput, UserMixin, UuidModel, belongsTo, column, createModelFactory, defineMigrator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, getCollectionProperties, getIndexes, getModelColumns, type getPoolReturnType, getPrimaryKey, getRelations, getRelationsMetadata, getUniques, hasMany, hasOne, index, HysteriaLogger as logger, manyToMany, property, RedisDataSource as redis, unique, view, withPerformance };
6159
+ export { type AdminJsActionOptions, type AdminJsAssets, type AdminJsBranding, type AdminJsInstance, type AdminJsLocale, type AdminJsOptions, type AdminJsPage, type AdminJsPropertyOptions, type AdminJsResourceOptions, type AdminJsSettings, type AnnotatedModel, type AsymmetricEncryptionOptions, AutogeneratedModel, type BaseModelMethodOptions, type BaseModelRelationType, BaseSeeder, type CacheAdapter, type CacheKeys, ClientMigrator, Collection, type ColumnDataTypeOption, type ColumnDataTypeOptionSimple, type ColumnDataTypeOptionWithBinary, type ColumnDataTypeOptionWithDatePrecision, type ColumnDataTypeOptionWithEnum, type ColumnDataTypeOptionWithLength, type ColumnDataTypeOptionWithPrecision, type ColumnDataTypeOptionWithScaleAndPrecision, type ColumnDataTypeOptionWithText, type ColumnOptions, type ColumnType, type CommonDataSourceInput, type CommonSqlMethodReturnType, type ConnectionPolicies, type DataSourceInput, type DataSourceType, type DateColumnOptions, DryModelQueryBuilder, DryQueryBuilder, type FetchHooks, type GetConnectionReturnType, HysteriaError, InMemoryAdapter, type IndexType, type LazyRelationType, type ManyOptions, type ManyToManyOptions, type ManyToManyStringOptions, Migration, type MigrationConfig, type MigrationConfigBase, Model, type ModelInstanceType, ModelQueryBuilder, type ModelWithoutRelations, MongoDataSource, type MongoDataSourceInput$1 as MongoDataSourceInput, type MssqlConnectionInstance, type MssqlDataSourceInput, type MssqlPoolInstance, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullableOracleDBDataSourceInput, type NotNullableOracleMssqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NumberModelKey, type OneOptions, type OracleDBDataSourceInput, type OracleDBPoolInstance, type PgPoolClientInstance, type PostgresSqlDataSourceInput, QueryBuilder, type RawModelOptions, RawNode, type RawQueryOptions, RedisCacheAdapter, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationQueryBuilderType, type ReplicationType, type SeederConfig, type SlaveAlgorithm, type SlaveContext, type SqlCloneOptions, SqlDataSource, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDriverSpecificOptions, type SqlPoolType, type Sqlite3ConnectionOptions, type SqliteConnectionInstance, type SqliteDataSourceInput, type StartTransactionOptions, type SymmetricEncryptionOptions, type TableFormat, type ThroughModel, TimestampedModel, Transaction, type TransactionExecutionOptions, type UniqueType, type UseCacheReturnType, type UseConnectionInput, UserMixin, UuidModel, belongsTo, column, createModelFactory, defineMigrator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, getCollectionProperties, getIndexes, getModelColumns, type getPoolReturnType, getPrimaryKey, getRelations, getRelationsMetadata, getUniques, hasMany, hasOne, index, HysteriaLogger as logger, manyToMany, property, RedisDataSource as redis, unique, view, withPerformance };
package/lib/index.d.ts CHANGED
@@ -113,6 +113,10 @@ interface NotNullableMysqlSqlDataSourceInput extends MysqlSqlDataSourceInput {
113
113
  }
114
114
  interface SqliteDataSourceInput extends CommonDataSourceInput {
115
115
  readonly type?: "sqlite";
116
+ /**
117
+ * @description The filename of the database file for SQLite
118
+ * @default ":memory:"
119
+ */
116
120
  readonly database?: string;
117
121
  }
118
122
  interface NotNullableSqliteDataSourceInput extends SqliteDataSourceInput {
@@ -1149,6 +1153,21 @@ type MigrationConfigWithTransactional = MigrationConfigBase & {
1149
1153
  * @description Adds transactional option only for PostgreSQL and CockroachDB
1150
1154
  */
1151
1155
  type MigrationConfig<D extends SqlDataSourceType = SqlDataSourceType> = D extends "postgres" | "cockroachdb" ? MigrationConfigWithTransactional : MigrationConfigBase;
1156
+ /**
1157
+ * @description Seeder configuration options
1158
+ */
1159
+ type SeederConfig = {
1160
+ /**
1161
+ * @description The path to the seeders folder
1162
+ * @default "database/seeders"
1163
+ */
1164
+ path?: string;
1165
+ /**
1166
+ * @description Path to the tsconfig.json file for TypeScript seeder files
1167
+ * @default "./tsconfig.json"
1168
+ */
1169
+ tsconfig?: string;
1170
+ };
1152
1171
  /**
1153
1172
  * @description Common input properties shared across all SqlDataSource types
1154
1173
  */
@@ -1174,6 +1193,10 @@ type SqlDataSourceInputBase<T extends Record<string, SqlDataSourceModel> = {}, C
1174
1193
  * @description Migration configuration for the sql data source
1175
1194
  */
1176
1195
  migrations?: MigrationConfig<D>;
1196
+ /**
1197
+ * @description Seeder configuration for the sql data source
1198
+ */
1199
+ seeders?: SeederConfig;
1177
1200
  /**
1178
1201
  * @description The cache strategy to use for the sql data source, it's used to configure the cache strategy for the sql data source
1179
1202
  */
@@ -3833,6 +3856,13 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
3833
3856
  transactional: boolean;
3834
3857
  lockTimeout?: number;
3835
3858
  };
3859
+ /**
3860
+ * @description Seeder configuration for the sql data source
3861
+ */
3862
+ seederConfig: {
3863
+ path: string;
3864
+ tsconfig?: string;
3865
+ };
3836
3866
  /**
3837
3867
  * @description AdminJS configuration options
3838
3868
  */
@@ -6077,6 +6107,21 @@ declare class HysteriaLogger {
6077
6107
  static warn(message: string): void;
6078
6108
  }
6079
6109
 
6110
+ /**
6111
+ * @description Base class for all seeders
6112
+ * @description Provides access to the SqlDataSource instance
6113
+ */
6114
+ declare abstract class BaseSeeder {
6115
+ protected sqlDataSource: SqlDataSource;
6116
+ readonly logger: typeof HysteriaLogger;
6117
+ constructor(sqlDataSource: SqlDataSource);
6118
+ /**
6119
+ * @description Run the seeder
6120
+ * @description This method should be implemented by all seeders
6121
+ */
6122
+ abstract run(): Promise<void>;
6123
+ }
6124
+
6080
6125
  type WithPerformanceResult<R = any> = [string, R];
6081
6126
  /**
6082
6127
  * @description executes the async function with a timer to check how long it took
@@ -6111,4 +6156,4 @@ declare const generateOpenApiModelWithMetadata: <T extends new () => Model>(mode
6111
6156
  $id?: string;
6112
6157
  }>;
6113
6158
 
6114
- export { type AdminJsActionOptions, type AdminJsAssets, type AdminJsBranding, type AdminJsInstance, type AdminJsLocale, type AdminJsOptions, type AdminJsPage, type AdminJsPropertyOptions, type AdminJsResourceOptions, type AdminJsSettings, type AnnotatedModel, type AsymmetricEncryptionOptions, AutogeneratedModel, type BaseModelMethodOptions, type BaseModelRelationType, type CacheAdapter, type CacheKeys, ClientMigrator, Collection, type ColumnDataTypeOption, type ColumnDataTypeOptionSimple, type ColumnDataTypeOptionWithBinary, type ColumnDataTypeOptionWithDatePrecision, type ColumnDataTypeOptionWithEnum, type ColumnDataTypeOptionWithLength, type ColumnDataTypeOptionWithPrecision, type ColumnDataTypeOptionWithScaleAndPrecision, type ColumnDataTypeOptionWithText, type ColumnOptions, type ColumnType, type CommonDataSourceInput, type CommonSqlMethodReturnType, type ConnectionPolicies, type DataSourceInput, type DataSourceType, type DateColumnOptions, DryModelQueryBuilder, DryQueryBuilder, type FetchHooks, type GetConnectionReturnType, HysteriaError, InMemoryAdapter, type IndexType, type LazyRelationType, type ManyOptions, type ManyToManyOptions, type ManyToManyStringOptions, Migration, type MigrationConfig, type MigrationConfigBase, Model, type ModelInstanceType, ModelQueryBuilder, type ModelWithoutRelations, MongoDataSource, type MongoDataSourceInput$1 as MongoDataSourceInput, type MssqlConnectionInstance, type MssqlDataSourceInput, type MssqlPoolInstance, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullableOracleDBDataSourceInput, type NotNullableOracleMssqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NumberModelKey, type OneOptions, type OracleDBDataSourceInput, type OracleDBPoolInstance, type PgPoolClientInstance, type PostgresSqlDataSourceInput, QueryBuilder, type RawModelOptions, RawNode, type RawQueryOptions, RedisCacheAdapter, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationQueryBuilderType, type ReplicationType, type SlaveAlgorithm, type SlaveContext, type SqlCloneOptions, SqlDataSource, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDriverSpecificOptions, type SqlPoolType, type Sqlite3ConnectionOptions, type SqliteConnectionInstance, type SqliteDataSourceInput, type StartTransactionOptions, type SymmetricEncryptionOptions, type TableFormat, type ThroughModel, TimestampedModel, Transaction, type TransactionExecutionOptions, type UniqueType, type UseCacheReturnType, type UseConnectionInput, UserMixin, UuidModel, belongsTo, column, createModelFactory, defineMigrator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, getCollectionProperties, getIndexes, getModelColumns, type getPoolReturnType, getPrimaryKey, getRelations, getRelationsMetadata, getUniques, hasMany, hasOne, index, HysteriaLogger as logger, manyToMany, property, RedisDataSource as redis, unique, view, withPerformance };
6159
+ export { type AdminJsActionOptions, type AdminJsAssets, type AdminJsBranding, type AdminJsInstance, type AdminJsLocale, type AdminJsOptions, type AdminJsPage, type AdminJsPropertyOptions, type AdminJsResourceOptions, type AdminJsSettings, type AnnotatedModel, type AsymmetricEncryptionOptions, AutogeneratedModel, type BaseModelMethodOptions, type BaseModelRelationType, BaseSeeder, type CacheAdapter, type CacheKeys, ClientMigrator, Collection, type ColumnDataTypeOption, type ColumnDataTypeOptionSimple, type ColumnDataTypeOptionWithBinary, type ColumnDataTypeOptionWithDatePrecision, type ColumnDataTypeOptionWithEnum, type ColumnDataTypeOptionWithLength, type ColumnDataTypeOptionWithPrecision, type ColumnDataTypeOptionWithScaleAndPrecision, type ColumnDataTypeOptionWithText, type ColumnOptions, type ColumnType, type CommonDataSourceInput, type CommonSqlMethodReturnType, type ConnectionPolicies, type DataSourceInput, type DataSourceType, type DateColumnOptions, DryModelQueryBuilder, DryQueryBuilder, type FetchHooks, type GetConnectionReturnType, HysteriaError, InMemoryAdapter, type IndexType, type LazyRelationType, type ManyOptions, type ManyToManyOptions, type ManyToManyStringOptions, Migration, type MigrationConfig, type MigrationConfigBase, Model, type ModelInstanceType, ModelQueryBuilder, type ModelWithoutRelations, MongoDataSource, type MongoDataSourceInput$1 as MongoDataSourceInput, type MssqlConnectionInstance, type MssqlDataSourceInput, type MssqlPoolInstance, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullableOracleDBDataSourceInput, type NotNullableOracleMssqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NumberModelKey, type OneOptions, type OracleDBDataSourceInput, type OracleDBPoolInstance, type PgPoolClientInstance, type PostgresSqlDataSourceInput, QueryBuilder, type RawModelOptions, RawNode, type RawQueryOptions, RedisCacheAdapter, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationQueryBuilderType, type ReplicationType, type SeederConfig, type SlaveAlgorithm, type SlaveContext, type SqlCloneOptions, SqlDataSource, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDriverSpecificOptions, type SqlPoolType, type Sqlite3ConnectionOptions, type SqliteConnectionInstance, type SqliteDataSourceInput, type StartTransactionOptions, type SymmetricEncryptionOptions, type TableFormat, type ThroughModel, TimestampedModel, Transaction, type TransactionExecutionOptions, type UniqueType, type UseCacheReturnType, type UseConnectionInput, UserMixin, UuidModel, belongsTo, column, createModelFactory, defineMigrator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, getCollectionProperties, getIndexes, getModelColumns, type getPoolReturnType, getPrimaryKey, getRelations, getRelationsMetadata, getUniques, hasMany, hasOne, index, HysteriaLogger as logger, manyToMany, property, RedisDataSource as redis, unique, view, withPerformance };