arkormx 2.1.1 → 2.2.1

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/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as PRISMA_ENUM_MEMBER_REGEX, $t as findAppliedMigration, A as isDelegateLike, At as getMigrationPlan, B as getPersistedEnumMap, Bt as supportsDatabaseReset, C as getRuntimeAdapter, Ct as escapeRegex, D as getRuntimePaginationURLDriverFactory, Dt as formatEnumDefaultValue, E as getRuntimePaginationCurrentPageResolver, Et as formatDefaultValue, F as runArkormTransaction, Ft as runMigrationWithPrisma, G as readPersistedColumnMappingsState, Gt as TableBuilder, H as getPersistedPrimaryKeyGeneration, Ht as toModelName, I as applyOperationsToPersistedColumnMappingsState, It as runPrismaCommand, J as resolveColumnMappingsFilePath, Jt as buildMigrationIdentity, K as rebuildPersistedColumnMappingsState, Kt as ForeignKeyBuilder, L as createEmptyPersistedColumnMappingsState, Lt as stripPrismaSchemaModelsAndEnums, M as isTransactionCapableClient, Mt as resolveEnumName, N as loadArkormConfig, Nt as resolveMigrationClassName, O as getRuntimePrismaClient, Ot as formatRelationAction, P as resetArkormRuntimeForTests, Pt as resolvePrismaType, Q as writePersistedColumnMappingsState, Qt as deleteAppliedMigrationsStateFromStore, R as deletePersistedColumnMappingsState, Rt as supportsDatabaseCreation, S as getDefaultStubsPath, St as deriveSingularFieldName, T as getRuntimeDebugHandler, Tt as findModelBlock, U as getPersistedTableMetadata, Ut as SchemaBuilder, V as getPersistedEnumTsType, Vt as toMigrationFileSlug, W as getPersistedTimestampColumns, Wt as EnumBuilder, X as syncPersistedColumnMappingsFromState, Xt as computeMigrationChecksum, Y as resolvePersistedMetadataFeatures, Yt as buildMigrationRunId, Z as validatePersistedMetadataFeaturesForMigrations, Zt as createEmptyAppliedMigrationsState, _ as defineConfig, _n as ArkormCollection, _t as createMigrationTimestamp, a as HasOneRelation, an as readAppliedMigrationsState, at as applyMigrationRollbackToDatabase, b as getActiveTransactionAdapter, bt as deriveRelationAlias, c as BelongsToRelation, cn as resolveMigrationStateFilePath, ct as applyMigrationToPrismaSchema, d as Relation, dn as writeAppliedMigrationsStateToStore, dt as buildFieldLine, en as getLastMigrationRun, et as PRISMA_ENUM_REGEX, f as LengthAwarePaginator, fn as RuntimeModuleLoader, ft as buildIndexLine, g as configureArkormRuntime, gn as RelationResolutionException, gt as buildRelationLine, h as bindAdapterToModels, ht as buildModelBlock, i as HasOneThroughRelation, in as markMigrationRun, it as applyDropTableOperation, j as isQuerySchemaLike, jt as pad, k as getUserConfig, kt as generateMigrationFile, ln as supportsDatabaseMigrationState, lt as applyOperationsToPrismaSchema, m as URLDriver, mn as SetBasedEagerLoader, mt as buildMigrationSource, n as MorphOneRelation, nn as isMigrationApplied, nt as applyAlterTableOperation, o as HasManyThroughRelation, on as readAppliedMigrationsStateFromStore, ot as applyMigrationRollbackToPrismaSchema, p as Paginator, pn as UnsupportedAdapterFeatureException, pt as buildInverseRelationLine, q as resetPersistedColumnMappingsCache, qt as PrimaryKeyGenerationPlanner, r as MorphManyRelation, rn as markMigrationApplied, rt as applyCreateTableOperation, s as HasManyRelation, sn as removeAppliedMigration, st as applyMigrationToDatabase, t as MorphToManyRelation, tn as getLatestAppliedMigrations, tt as PRISMA_MODEL_REGEX, u as BelongsToManyRelation, un as writeAppliedMigrationsState, ut as buildEnumBlock, v as emitRuntimeDebugEvent, vn as ArkormException, vt as deriveCollectionFieldName, w as getRuntimeClient, wt as findEnumBlock, x as getActiveTransactionClient, xt as deriveRelationFieldName, y as ensureArkormConfigLoading, yt as deriveInverseRelationAlias, z as getPersistedColumnMap, zt as supportsDatabaseMigrationExecution } from "./relationship-BBMs-1iK.mjs";
1
+ import { $ as deletePersistedColumnMappingsState, $t as supportsDatabaseCreation, A as isDelegateLike, At as buildModelBlock, B as getRegisteredSeeders, Bt as findModelBlock, C as getRuntimeAdapter, Cn as resolveMigrationStateFilePath, Ct as applyMigrationToPrismaSchema, D as getRuntimePaginationURLDriverFactory, Dn as RuntimeModuleLoader, Dt as buildIndexLine, E as getRuntimePaginationCurrentPageResolver, En as writeAppliedMigrationsStateToStore, Et as buildFieldLine, F as runArkormTransaction, Ft as deriveRelationAlias, G as registerFactories, Gt as getMigrationPlan, H as loadMigrationsFrom, Ht as formatEnumDefaultValue, I as getRegisteredFactories, It as deriveRelationFieldName, J as registerPaths, Jt as resolveMigrationClassName, K as registerMigrations, Kt as pad, L as getRegisteredMigrations, Lt as deriveSingularFieldName, M as isTransactionCapableClient, Mn as ArkormCollection, Mt as createMigrationTimestamp, N as loadArkormConfig, Nn as ArkormException, Nt as deriveCollectionFieldName, O as getRuntimePrismaClient, On as UnsupportedAdapterFeatureException, Ot as buildInverseRelationLine, P as resetArkormRuntimeForTests, Pt as deriveInverseRelationAlias, Q as createEmptyPersistedColumnMappingsState, Qt as stripPrismaSchemaModelsAndEnums, R as getRegisteredModels, Rt as escapeRegex, S as getDefaultStubsPath, Sn as removeAppliedMigration, St as applyMigrationToDatabase, T as getRuntimeDebugHandler, Tn as writeAppliedMigrationsState, Tt as buildEnumBlock, U as loadModelsFrom, Ut as formatRelationAction, V as loadFactoriesFrom, Vt as formatDefaultValue, W as loadSeedersFrom, Wt as generateMigrationFile, X as resetRuntimeRegistryForTests, Xt as runMigrationWithPrisma, Y as registerSeeders, Yt as resolvePrismaType, Z as applyOperationsToPersistedColumnMappingsState, Zt as runPrismaCommand, _ as defineConfig, _n as isMigrationApplied, _t as applyAlterTableOperation, a as HasOneRelation, an as EnumBuilder, at as getPersistedTimestampColumns, b as getActiveTransactionAdapter, bn as readAppliedMigrationsState, bt as applyMigrationRollbackToDatabase, c as BelongsToRelation, cn as PrimaryKeyGenerationPlanner, ct as resetPersistedColumnMappingsCache, d as Relation, dn as computeMigrationChecksum, dt as syncPersistedColumnMappingsFromState, en as supportsDatabaseMigrationExecution, et as getPersistedColumnMap, f as LengthAwarePaginator, fn as createEmptyAppliedMigrationsState, ft as validatePersistedMetadataFeaturesForMigrations, g as configureArkormRuntime, gn as getLatestAppliedMigrations, gt as PRISMA_MODEL_REGEX, h as bindAdapterToModels, hn as getLastMigrationRun, ht as PRISMA_ENUM_REGEX, i as HasOneThroughRelation, in as SchemaBuilder, it as getPersistedTableMetadata, j as isQuerySchemaLike, jn as RelationResolutionException, jt as buildRelationLine, k as getUserConfig, kn as SetBasedEagerLoader, kt as buildMigrationSource, ln as buildMigrationIdentity, lt as resolveColumnMappingsFilePath, m as URLDriver, mn as findAppliedMigration, mt as PRISMA_ENUM_MEMBER_REGEX, n as MorphOneRelation, nn as toMigrationFileSlug, nt as getPersistedEnumTsType, o as HasManyThroughRelation, on as TableBuilder, ot as readPersistedColumnMappingsState, p as Paginator, pn as deleteAppliedMigrationsStateFromStore, pt as writePersistedColumnMappingsState, q as registerModels, qt as resolveEnumName, r as MorphManyRelation, rn as toModelName, rt as getPersistedPrimaryKeyGeneration, s as HasManyRelation, sn as ForeignKeyBuilder, st as rebuildPersistedColumnMappingsState, t as MorphToManyRelation, tn as supportsDatabaseReset, tt as getPersistedEnumMap, u as BelongsToManyRelation, un as buildMigrationRunId, ut as resolvePersistedMetadataFeatures, v as emitRuntimeDebugEvent, vn as markMigrationApplied, vt as applyCreateTableOperation, w as getRuntimeClient, wn as supportsDatabaseMigrationState, wt as applyOperationsToPrismaSchema, x as getActiveTransactionClient, xn as readAppliedMigrationsStateFromStore, xt as applyMigrationRollbackToPrismaSchema, y as ensureArkormConfigLoading, yn as markMigrationRun, yt as applyDropTableOperation, z as getRegisteredPaths, zt as findEnumBlock } from "./relationship-AnKH8ZaV.mjs";
2
2
  import { Pool } from "pg";
3
3
  import { join, resolve } from "node:path";
4
4
  import { createRequire } from "module";
@@ -1710,6 +1710,143 @@ const createPrismaDatabaseAdapter = (prisma, mapping = {}) => {
1710
1710
  */
1711
1711
  const createPrismaCompatibilityAdapter = createPrismaDatabaseAdapter;
1712
1712
 
1713
+ //#endregion
1714
+ //#region src/Arkorm.ts
1715
+ var Arkorm = class Arkorm {
1716
+ constructor() {
1717
+ this.registerMigrations = Arkorm.registerMigrations;
1718
+ this.registerSeeders = Arkorm.registerSeeders;
1719
+ this.registerModels = Arkorm.registerModels;
1720
+ this.registerFactories = Arkorm.registerFactories;
1721
+ this.loadModelsFrom = Arkorm.loadModelsFrom;
1722
+ this.loadSeedersFrom = Arkorm.loadSeedersFrom;
1723
+ this.loadMigrationsFrom = Arkorm.loadMigrationsFrom;
1724
+ this.loadFactoriesFrom = Arkorm.loadFactoriesFrom;
1725
+ this.getRegisteredPaths = Arkorm.getRegisteredPaths;
1726
+ this.getRegisteredMigrations = Arkorm.getRegisteredMigrations;
1727
+ this.getRegisteredSeeders = Arkorm.getRegisteredSeeders;
1728
+ this.getRegisteredModels = Arkorm.getRegisteredModels;
1729
+ this.getRegisteredFactories = Arkorm.getRegisteredFactories;
1730
+ }
1731
+ /**
1732
+ * Register migration constructors directly without relying on runtime discovery.
1733
+ *
1734
+ * @param migrations
1735
+ * @returns
1736
+ */
1737
+ static registerMigrations(...migrations) {
1738
+ return registerMigrations(...migrations);
1739
+ }
1740
+ /**
1741
+ * Register seeder constructors directly without relying on runtime discovery.
1742
+ *
1743
+ * @param seeders
1744
+ * @returns
1745
+ */
1746
+ static registerSeeders(...seeders) {
1747
+ return registerSeeders(...seeders);
1748
+ }
1749
+ /**
1750
+ * Register model constructors directly without relying on runtime discovery.
1751
+ *
1752
+ * @param models
1753
+ * @returns
1754
+ */
1755
+ static registerModels(...models) {
1756
+ return registerModels(...models);
1757
+ }
1758
+ /**
1759
+ * Register factory constructors or instances directly without relying on runtime discovery.
1760
+ *
1761
+ * @param factories
1762
+ * @returns
1763
+ */
1764
+ static registerFactories(...factories) {
1765
+ return registerFactories(...factories);
1766
+ }
1767
+ /**
1768
+ * Register additional runtime discovery paths for models without replacing configured paths.
1769
+ *
1770
+ * @param paths
1771
+ * @returns
1772
+ */
1773
+ static loadModelsFrom(paths) {
1774
+ return loadModelsFrom(paths);
1775
+ }
1776
+ /**
1777
+ * Register additional runtime discovery paths for seeders without replacing configured paths.
1778
+ *
1779
+ * @param paths
1780
+ * @returns
1781
+ */
1782
+ static loadSeedersFrom(paths) {
1783
+ return loadSeedersFrom(paths);
1784
+ }
1785
+ /**
1786
+ * Register additional runtime discovery paths for migrations without replacing configured paths.
1787
+ *
1788
+ * @param paths
1789
+ * @returns
1790
+ */
1791
+ static loadMigrationsFrom(paths) {
1792
+ return loadMigrationsFrom(paths);
1793
+ }
1794
+ /**
1795
+ * Register additional runtime discovery paths for factories without replacing configured paths.
1796
+ *
1797
+ * @param paths
1798
+ * @returns
1799
+ */
1800
+ static loadFactoriesFrom(paths) {
1801
+ return loadFactoriesFrom(paths);
1802
+ }
1803
+ /**
1804
+ * Get registered runtime discovery paths or registered constructors for a specific type.
1805
+ *
1806
+ * @param key
1807
+ * @returns
1808
+ */
1809
+ static getRegisteredPaths(key) {
1810
+ return getRegisteredPaths(key);
1811
+ }
1812
+ /**
1813
+ * Get registered migration constructors instances
1814
+ *
1815
+ * @returns
1816
+ */
1817
+ static getRegisteredMigrations() {
1818
+ return getRegisteredMigrations();
1819
+ }
1820
+ /**
1821
+ * Get registered seeder constructors instances.
1822
+ *
1823
+ * @returns
1824
+ */
1825
+ static getRegisteredSeeders() {
1826
+ return getRegisteredSeeders();
1827
+ }
1828
+ /**
1829
+ * Get registered model constructors instances.
1830
+ *
1831
+ * @returns
1832
+ */
1833
+ static getRegisteredModels() {
1834
+ return getRegisteredModels();
1835
+ }
1836
+ /**
1837
+ * Get registered factory constructors or instances.
1838
+ *
1839
+ * @returns
1840
+ */
1841
+ static getRegisteredFactories() {
1842
+ return getRegisteredFactories();
1843
+ }
1844
+ };
1845
+ /**
1846
+ * Arkormx is an alias for Arkorm.
1847
+ */
1848
+ var Arkormx = class extends Arkorm {};
1849
+
1713
1850
  //#endregion
1714
1851
  //#region src/Attribute.ts
1715
1852
  var Attribute = class Attribute {
@@ -2788,10 +2925,10 @@ var MigrateCommand = class extends Command {
2788
2925
  async handle() {
2789
2926
  this.app.command = this;
2790
2927
  const configuredMigrationsDir = this.app.getConfig("paths")?.migrations ?? join(process.cwd(), "database", "migrations");
2791
- const migrationsDir = this.app.resolveRuntimeDirectoryPath(configuredMigrationsDir);
2792
- if (!existsSync$1(migrationsDir)) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
2928
+ const migrationDirs = this.resolveMigrationDirectories(configuredMigrationsDir);
2929
+ if (migrationDirs.length === 0 && getRegisteredMigrations().length === 0) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
2793
2930
  const schemaPath = this.option("schema") ? resolve(String(this.option("schema"))) : join(process.cwd(), "prisma", "schema.prisma");
2794
- const classes = this.option("all") || !this.argument("name") ? await this.loadAllMigrations(migrationsDir) : (await this.loadNamedMigration(migrationsDir, this.argument("name"))).filter(([cls]) => cls !== void 0);
2931
+ const classes = this.option("all") || !this.argument("name") ? await this.loadAllMigrations(migrationDirs) : (await this.loadNamedMigration(migrationDirs, this.argument("name"))).filter(([cls]) => cls !== void 0);
2795
2932
  if (classes.length === 0) return void this.error("Error: No migration classes found to run.");
2796
2933
  const stateFilePath = resolveMigrationStateFilePath(process.cwd(), this.option("state-file") ? String(this.option("state-file")) : void 0);
2797
2934
  const adapter = this.app.getConfig("adapter");
@@ -2819,7 +2956,7 @@ var MigrateCommand = class extends Command {
2819
2956
  });
2820
2957
  if (pending.length === 0) {
2821
2958
  if (appliedMigrationState) try {
2822
- await syncPersistedColumnMappingsFromState(process.cwd(), appliedMigrationState, await this.loadAllMigrations(migrationsDir), persistedFeatures);
2959
+ await syncPersistedColumnMappingsFromState(process.cwd(), appliedMigrationState, await this.loadAllMigrations(migrationDirs), persistedFeatures);
2823
2960
  } catch (error) {
2824
2961
  this.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
2825
2962
  return;
@@ -2863,7 +3000,7 @@ var MigrateCommand = class extends Command {
2863
3000
  });
2864
3001
  if (!(await this.runWithDatabaseCreationRetry(adapter, () => writeAppliedMigrationsStateToStore(adapter, stateFilePath, appliedMigrationState))).ok) return;
2865
3002
  try {
2866
- await syncPersistedColumnMappingsFromState(process.cwd(), appliedMigrationState, await this.loadAllMigrations(migrationsDir), persistedFeatures);
3003
+ await syncPersistedColumnMappingsFromState(process.cwd(), appliedMigrationState, await this.loadAllMigrations(migrationDirs), persistedFeatures);
2867
3004
  } catch (error) {
2868
3005
  this.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
2869
3006
  return;
@@ -2885,9 +3022,12 @@ var MigrateCommand = class extends Command {
2885
3022
  *
2886
3023
  * @param migrationsDir The directory to load migration classes from.
2887
3024
  */
2888
- async loadAllMigrations(migrationsDir) {
2889
- const files = readdirSync$1(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file)));
2890
- return (await Promise.all(files.map(async (file) => (await this.loadMigrationClassesFromFile(file)).map((cls) => [cls, file])))).flat();
3025
+ resolveMigrationDirectories(configuredMigrationsDir) {
3026
+ return [this.app.resolveRuntimeDirectoryPath(configuredMigrationsDir), ...getRegisteredPaths("migrations").map((directory) => this.app.resolveRuntimeDirectoryPath(directory))].filter((directory, index, all) => existsSync$1(directory) && all.indexOf(directory) === index);
3027
+ }
3028
+ async loadAllMigrations(migrationsDirs) {
3029
+ const files = migrationsDirs.flatMap((migrationsDir) => readdirSync$1(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file))));
3030
+ return [...(await Promise.all(files.map(async (file) => (await this.loadMigrationClassesFromFile(file)).map((cls) => [cls, file])))).flat(), ...getRegisteredMigrations().map((cls) => [cls, `registered:${cls.name}`])];
2891
3031
  }
2892
3032
  /**
2893
3033
  * Load migration classes from a specific file or by class name.
@@ -2896,10 +3036,12 @@ var MigrateCommand = class extends Command {
2896
3036
  * @param name
2897
3037
  * @returns
2898
3038
  */
2899
- async loadNamedMigration(migrationsDir, name) {
3039
+ async loadNamedMigration(migrationsDirs, name) {
2900
3040
  if (!name) return [[void 0, ""]];
2901
3041
  const base = name.replace(/Migration$/, "");
2902
- const target = [
3042
+ const registered = getRegisteredMigrations().find((cls) => cls.name === name || cls.name === `${base}Migration`);
3043
+ if (registered) return [[registered, `registered:${registered.name}`]];
3044
+ const target = migrationsDirs.flatMap((migrationsDir) => [
2903
3045
  `${name}.ts`,
2904
3046
  `${name}.js`,
2905
3047
  `${name}.mjs`,
@@ -2908,7 +3050,7 @@ var MigrateCommand = class extends Command {
2908
3050
  `${base}Migration.js`,
2909
3051
  `${base}Migration.mjs`,
2910
3052
  `${base}Migration.cjs`
2911
- ].map((file) => join(migrationsDir, file)).find((file) => existsSync$1(file));
3053
+ ].map((file) => join(migrationsDir, file))).find((file) => existsSync$1(file));
2912
3054
  if (!target) return [[void 0, name]];
2913
3055
  const runtimeTarget = this.app.resolveRuntimeScriptPath(target);
2914
3056
  return (await this.loadMigrationClassesFromFile(runtimeTarget)).map((cls) => [cls, runtimeTarget]);
@@ -2992,14 +3134,14 @@ var MigrateFreshCommand = class extends Command {
2992
3134
  async handle() {
2993
3135
  this.app.command = this;
2994
3136
  const configuredMigrationsDir = this.app.getConfig("paths")?.migrations ?? join(process.cwd(), "database", "migrations");
2995
- const migrationsDir = this.app.resolveRuntimeDirectoryPath(configuredMigrationsDir);
2996
- if (!existsSync$1(migrationsDir)) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
3137
+ const migrationDirs = this.resolveMigrationDirectories(configuredMigrationsDir);
3138
+ if (migrationDirs.length === 0 && getRegisteredMigrations().length === 0) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
2997
3139
  const adapter = this.app.getConfig("adapter");
2998
3140
  const useDatabaseMigrations = supportsDatabaseMigrationExecution(adapter);
2999
3141
  const persistedFeatures = resolvePersistedMetadataFeatures(this.app.getConfig("features"));
3000
3142
  const schemaPath = this.option("schema") ? resolve(String(this.option("schema"))) : join(process.cwd(), "prisma", "schema.prisma");
3001
3143
  const stateFilePath = resolveMigrationStateFilePath(process.cwd(), this.option("state-file") ? String(this.option("state-file")) : void 0);
3002
- const migrations = await this.loadAllMigrations(migrationsDir);
3144
+ const migrations = await this.loadAllMigrations(migrationDirs);
3003
3145
  if (migrations.length === 0) return void this.error("Error: No migration classes found to run.");
3004
3146
  if (useDatabaseMigrations) try {
3005
3147
  await validatePersistedMetadataFeaturesForMigrations(migrations, persistedFeatures);
@@ -3061,9 +3203,12 @@ var MigrateFreshCommand = class extends Command {
3061
3203
  this.success(`Refreshed database with ${migrations.length} migration(s).`);
3062
3204
  migrations.forEach(([_, file]) => this.success(this.app.splitLogger("Migrated", file)));
3063
3205
  }
3064
- async loadAllMigrations(migrationsDir) {
3065
- const files = readdirSync$1(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file)));
3066
- return (await Promise.all(files.map(async (file) => (await this.loadMigrationClassesFromFile(file)).map((cls) => [cls, file])))).flat();
3206
+ resolveMigrationDirectories(configuredMigrationsDir) {
3207
+ return [this.app.resolveRuntimeDirectoryPath(configuredMigrationsDir), ...getRegisteredPaths("migrations").map((directory) => this.app.resolveRuntimeDirectoryPath(directory))].filter((directory, index, all) => existsSync$1(directory) && all.indexOf(directory) === index);
3208
+ }
3209
+ async loadAllMigrations(migrationsDirs) {
3210
+ const files = migrationsDirs.flatMap((migrationsDir) => readdirSync$1(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file))));
3211
+ return [...(await Promise.all(files.map(async (file) => (await this.loadMigrationClassesFromFile(file)).map((cls) => [cls, file])))).flat(), ...getRegisteredMigrations().map((cls) => [cls, `registered:${cls.name}`])];
3067
3212
  }
3068
3213
  async loadMigrationClassesFromFile(filePath) {
3069
3214
  const imported = await RuntimeModuleLoader.load(filePath);
@@ -3148,8 +3293,8 @@ var MigrateRollbackCommand = class extends Command {
3148
3293
  async handle() {
3149
3294
  this.app.command = this;
3150
3295
  const configuredMigrationsDir = this.app.getConfig("paths")?.migrations ?? join(process.cwd(), "database", "migrations");
3151
- const migrationsDir = this.app.resolveRuntimeDirectoryPath(configuredMigrationsDir);
3152
- if (!existsSync$1(migrationsDir)) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
3296
+ const migrationDirs = this.resolveMigrationDirectories(configuredMigrationsDir);
3297
+ if (migrationDirs.length === 0 && getRegisteredMigrations().length === 0) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
3153
3298
  const schemaPath = this.option("schema") ? resolve(String(this.option("schema"))) : join(process.cwd(), "prisma", "schema.prisma");
3154
3299
  const stateFilePath = resolveMigrationStateFilePath(process.cwd(), this.option("state-file") ? String(this.option("state-file")) : void 0);
3155
3300
  const adapter = this.app.getConfig("adapter");
@@ -3165,7 +3310,7 @@ var MigrateRollbackCommand = class extends Command {
3165
3310
  return lastRun.migrationIds.map((id) => appliedState.migrations.find((migration) => migration.id === id)).filter((migration) => Boolean(migration));
3166
3311
  })();
3167
3312
  if (targets.length === 0) return void this.error("Error: No tracked migrations available to rollback.");
3168
- const available = await this.loadAllMigrations(migrationsDir);
3313
+ const available = await this.loadAllMigrations(migrationDirs);
3169
3314
  const rollbackClasses = targets.map((target) => {
3170
3315
  return available.find(([migrationClass, file]) => {
3171
3316
  return buildMigrationIdentity(file, migrationClass.name) === target.id || migrationClass.name === target.className;
@@ -3209,9 +3354,12 @@ var MigrateRollbackCommand = class extends Command {
3209
3354
  this.success(`Rolled back ${rollbackClasses.length} migration(s).`);
3210
3355
  rollbackClasses.forEach(([_, file]) => this.success(this.app.splitLogger("RolledBack", file)));
3211
3356
  }
3212
- async loadAllMigrations(migrationsDir) {
3213
- const files = readdirSync$1(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file)));
3214
- return (await Promise.all(files.map(async (file) => (await this.loadMigrationClassesFromFile(file)).map((cls) => [cls, file])))).flat();
3357
+ resolveMigrationDirectories(configuredMigrationsDir) {
3358
+ return [this.app.resolveRuntimeDirectoryPath(configuredMigrationsDir), ...getRegisteredPaths("migrations").map((directory) => this.app.resolveRuntimeDirectoryPath(directory))].filter((directory, index, all) => existsSync$1(directory) && all.indexOf(directory) === index);
3359
+ }
3360
+ async loadAllMigrations(migrationsDirs) {
3361
+ const files = migrationsDirs.flatMap((migrationsDir) => readdirSync$1(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file))));
3362
+ return [...(await Promise.all(files.map(async (file) => (await this.loadMigrationClassesFromFile(file)).map((cls) => [cls, file])))).flat(), ...getRegisteredMigrations().map((cls) => [cls, `registered:${cls.name}`])];
3215
3363
  }
3216
3364
  async loadMigrationClassesFromFile(filePath) {
3217
3365
  const imported = await RuntimeModuleLoader.load(filePath);
@@ -3401,9 +3549,9 @@ var SeedCommand = class extends Command {
3401
3549
  async handle() {
3402
3550
  this.app.command = this;
3403
3551
  const configuredSeedersDir = this.app.getConfig("paths")?.seeders ?? join(process.cwd(), "database", "seeders");
3404
- const seedersDir = this.app.resolveRuntimeDirectoryPath(configuredSeedersDir);
3405
- if (!existsSync$1(seedersDir)) return void this.error(`ERROR: Seeders directory not found: ${this.app.formatPathForLog(configuredSeedersDir)}`);
3406
- const classes = this.option("all") ? await this.loadAllSeeders(seedersDir) : await this.loadNamedSeeder(seedersDir, this.argument("name") ?? "DatabaseSeeder");
3552
+ const seederDirs = this.resolveSeederDirectories(configuredSeedersDir);
3553
+ if (seederDirs.length === 0 && getRegisteredSeeders().length === 0) return void this.error(`ERROR: Seeders directory not found: ${this.app.formatPathForLog(configuredSeedersDir)}`);
3554
+ const classes = this.option("all") ? await this.loadAllSeeders(seederDirs) : await this.loadNamedSeeder(seederDirs, this.argument("name") ?? "DatabaseSeeder");
3407
3555
  if (classes.length === 0) return void this.error("ERROR: No seeder classes found to run.");
3408
3556
  for (const SeederClassItem of classes) await new SeederClassItem().run();
3409
3557
  this.success("Database seeding completed");
@@ -3415,9 +3563,12 @@ var SeedCommand = class extends Command {
3415
3563
  * @param seedersDir
3416
3564
  * @returns
3417
3565
  */
3418
- async loadAllSeeders(seedersDir) {
3419
- const files = readdirSync$1(seedersDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).map((file) => this.app.resolveRuntimeScriptPath(join(seedersDir, file)));
3420
- return (await Promise.all(files.map(async (file) => await this.loadSeederClassesFromFile(file)))).flat();
3566
+ resolveSeederDirectories(configuredSeedersDir) {
3567
+ return [this.app.resolveRuntimeDirectoryPath(configuredSeedersDir), ...getRegisteredPaths("seeders").map((directory) => this.app.resolveRuntimeDirectoryPath(directory))].filter((directory, index, all) => existsSync$1(directory) && all.indexOf(directory) === index);
3568
+ }
3569
+ async loadAllSeeders(seedersDirs) {
3570
+ const files = seedersDirs.flatMap((seedersDir) => readdirSync$1(seedersDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).map((file) => this.app.resolveRuntimeScriptPath(join(seedersDir, file))));
3571
+ return [...(await Promise.all(files.map(async (file) => await this.loadSeederClassesFromFile(file)))).flat(), ...getRegisteredSeeders()];
3421
3572
  }
3422
3573
  /**
3423
3574
  * Load seeder classes from a specific file or by class name.
@@ -3426,9 +3577,11 @@ var SeedCommand = class extends Command {
3426
3577
  * @param name
3427
3578
  * @returns
3428
3579
  */
3429
- async loadNamedSeeder(seedersDir, name) {
3580
+ async loadNamedSeeder(seedersDirs, name) {
3430
3581
  const base = name.replace(/Seeder$/, "");
3431
- const target = [
3582
+ const registered = getRegisteredSeeders().find((cls) => cls.name === name || cls.name === `${base}Seeder`);
3583
+ if (registered) return [registered];
3584
+ const target = seedersDirs.flatMap((seedersDir) => [
3432
3585
  `${name}.ts`,
3433
3586
  `${name}.js`,
3434
3587
  `${name}.mjs`,
@@ -3437,7 +3590,7 @@ var SeedCommand = class extends Command {
3437
3590
  `${base}Seeder.js`,
3438
3591
  `${base}Seeder.mjs`,
3439
3592
  `${base}Seeder.cjs`
3440
- ].map((file) => join(seedersDir, file)).find((file) => existsSync$1(file));
3593
+ ].map((file) => join(seedersDir, file))).find((file) => existsSync$1(file));
3441
3594
  if (!target) return [];
3442
3595
  const runtimeTarget = this.app.resolveRuntimeScriptPath(target);
3443
3596
  return await this.loadSeederClassesFromFile(runtimeTarget);
@@ -7329,4 +7482,4 @@ var PivotModel = class extends Model {
7329
7482
  };
7330
7483
 
7331
7484
  //#endregion
7332
- export { ArkormCollection, ArkormException, Attribute, CliApp, DB, EnumBuilder, ForeignKeyBuilder, InitCommand, InlineFactory, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateFreshCommand, MigrateRollbackCommand, Migration, MigrationHistoryCommand, MissingDelegateException, Model, ModelFactory, ModelNotFoundException, ModelsSyncCommand, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, Paginator, PivotModel, PrimaryKeyGenerationPlanner, PrismaDatabaseAdapter, QueryBuilder, QueryConstraintException, QueryExecutionException, RelationResolutionException, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, ScopeNotDefinedException, SeedCommand, Seeder, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToDatabase, applyMigrationRollbackToPrismaSchema, applyMigrationToDatabase, applyMigrationToPrismaSchema, applyOperationsToPersistedColumnMappingsState, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createEmptyAppliedMigrationsState, createEmptyPersistedColumnMappingsState, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deleteAppliedMigrationsStateFromStore, deletePersistedColumnMappingsState, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, emitRuntimeDebugEvent, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionAdapter, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getPersistedColumnMap, getPersistedEnumMap, getPersistedEnumTsType, getPersistedPrimaryKeyGeneration, getPersistedTableMetadata, getPersistedTimestampColumns, getRuntimeAdapter, getRuntimeClient, getRuntimeCompatibilityAdapter, getRuntimeDebugHandler, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isQuerySchemaLike, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, readAppliedMigrationsStateFromStore, readPersistedColumnMappingsState, rebuildPersistedColumnMappingsState, removeAppliedMigration, resetArkormRuntimeForTests, resetPersistedColumnMappingsCache, resolveCast, resolveColumnMappingsFilePath, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePersistedMetadataFeatures, resolvePrismaType, resolveRuntimeCompatibilityQuerySchema, resolveRuntimeCompatibilityQuerySchemaOrThrow, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, stripPrismaSchemaModelsAndEnums, supportsDatabaseCreation, supportsDatabaseMigrationExecution, supportsDatabaseMigrationState, supportsDatabaseReset, syncPersistedColumnMappingsFromState, toMigrationFileSlug, toModelName, validatePersistedMetadataFeaturesForMigrations, writeAppliedMigrationsState, writeAppliedMigrationsStateToStore, writePersistedColumnMappingsState };
7485
+ export { Arkorm, ArkormCollection, ArkormException, Arkormx, Attribute, CliApp, DB, EnumBuilder, ForeignKeyBuilder, InitCommand, InlineFactory, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateFreshCommand, MigrateRollbackCommand, Migration, MigrationHistoryCommand, MissingDelegateException, Model, ModelFactory, ModelNotFoundException, ModelsSyncCommand, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, Paginator, PivotModel, PrimaryKeyGenerationPlanner, PrismaDatabaseAdapter, QueryBuilder, QueryConstraintException, QueryExecutionException, RelationResolutionException, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, ScopeNotDefinedException, SeedCommand, Seeder, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToDatabase, applyMigrationRollbackToPrismaSchema, applyMigrationToDatabase, applyMigrationToPrismaSchema, applyOperationsToPersistedColumnMappingsState, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createEmptyAppliedMigrationsState, createEmptyPersistedColumnMappingsState, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deleteAppliedMigrationsStateFromStore, deletePersistedColumnMappingsState, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, emitRuntimeDebugEvent, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionAdapter, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getPersistedColumnMap, getPersistedEnumMap, getPersistedEnumTsType, getPersistedPrimaryKeyGeneration, getPersistedTableMetadata, getPersistedTimestampColumns, getRegisteredFactories, getRegisteredMigrations, getRegisteredModels, getRegisteredPaths, getRegisteredSeeders, getRuntimeAdapter, getRuntimeClient, getRuntimeCompatibilityAdapter, getRuntimeDebugHandler, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isQuerySchemaLike, isTransactionCapableClient, loadArkormConfig, loadFactoriesFrom, loadMigrationsFrom, loadModelsFrom, loadSeedersFrom, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, readAppliedMigrationsStateFromStore, readPersistedColumnMappingsState, rebuildPersistedColumnMappingsState, registerFactories, registerMigrations, registerModels, registerPaths, registerSeeders, removeAppliedMigration, resetArkormRuntimeForTests, resetPersistedColumnMappingsCache, resetRuntimeRegistryForTests, resolveCast, resolveColumnMappingsFilePath, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePersistedMetadataFeatures, resolvePrismaType, resolveRuntimeCompatibilityQuerySchema, resolveRuntimeCompatibilityQuerySchemaOrThrow, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, stripPrismaSchemaModelsAndEnums, supportsDatabaseCreation, supportsDatabaseMigrationExecution, supportsDatabaseMigrationState, supportsDatabaseReset, syncPersistedColumnMappingsFromState, toMigrationFileSlug, toModelName, validatePersistedMetadataFeaturesForMigrations, writeAppliedMigrationsState, writeAppliedMigrationsStateToStore, writePersistedColumnMappingsState };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_relationship = require('../relationship-BRQjsdj3.cjs');
2
+ const require_relationship = require('../relationship-MzG94ypT.cjs');
3
3
 
4
4
  exports.BelongsToManyRelation = require_relationship.BelongsToManyRelation;
5
5
  exports.BelongsToRelation = require_relationship.BelongsToRelation;
@@ -1,2 +1,2 @@
1
- import { Ba as SingleResultRelation, Fa as HasOneThroughRelation, Ha as Relation, Ia as HasOneRelation, La as HasManyThroughRelation, Ma as MorphToManyRelation, Na as MorphOneRelation, Pa as MorphManyRelation, Ra as HasManyRelation, Ua as RelationTableLoader, Va as BelongsToManyRelation, ja as SetBasedEagerLoader, za as BelongsToRelation } from "../index-BQyFSgj_.cjs";
1
+ import { ao as HasOneRelation, co as BelongsToRelation, do as Relation, eo as SetBasedEagerLoader, fo as RelationTableLoader, io as HasOneThroughRelation, lo as SingleResultRelation, no as MorphOneRelation, oo as HasManyThroughRelation, ro as MorphManyRelation, so as HasManyRelation, to as MorphToManyRelation, uo as BelongsToManyRelation } from "../index-CEynlcyE.cjs";
2
2
  export { BelongsToManyRelation, BelongsToRelation, HasManyRelation, HasManyThroughRelation, HasOneRelation, HasOneThroughRelation, MorphManyRelation, MorphOneRelation, MorphToManyRelation, Relation, RelationTableLoader, SetBasedEagerLoader, SingleResultRelation };
@@ -1,2 +1,2 @@
1
- import { Ba as SingleResultRelation, Fa as HasOneThroughRelation, Ha as Relation, Ia as HasOneRelation, La as HasManyThroughRelation, Ma as MorphToManyRelation, Na as MorphOneRelation, Pa as MorphManyRelation, Ra as HasManyRelation, Ua as RelationTableLoader, Va as BelongsToManyRelation, ja as SetBasedEagerLoader, za as BelongsToRelation } from "../index-RvyusnXP.mjs";
1
+ import { ao as HasOneRelation, co as BelongsToRelation, do as Relation, eo as SetBasedEagerLoader, fo as RelationTableLoader, io as HasOneThroughRelation, lo as SingleResultRelation, no as MorphOneRelation, oo as HasManyThroughRelation, ro as MorphManyRelation, so as HasManyRelation, to as MorphToManyRelation, uo as BelongsToManyRelation } from "../index-D_gtCoPF.mjs";
2
2
  export { BelongsToManyRelation, BelongsToRelation, HasManyRelation, HasManyThroughRelation, HasOneRelation, HasOneThroughRelation, MorphManyRelation, MorphOneRelation, MorphToManyRelation, Relation, RelationTableLoader, SetBasedEagerLoader, SingleResultRelation };
@@ -1,3 +1,3 @@
1
- import { a as HasOneRelation, c as BelongsToRelation, d as Relation, hn as RelationTableLoader, i as HasOneThroughRelation, l as SingleResultRelation, mn as SetBasedEagerLoader, n as MorphOneRelation, o as HasManyThroughRelation, r as MorphManyRelation, s as HasManyRelation, t as MorphToManyRelation, u as BelongsToManyRelation } from "../relationship-BBMs-1iK.mjs";
1
+ import { An as RelationTableLoader, a as HasOneRelation, c as BelongsToRelation, d as Relation, i as HasOneThroughRelation, kn as SetBasedEagerLoader, l as SingleResultRelation, n as MorphOneRelation, o as HasManyThroughRelation, r as MorphManyRelation, s as HasManyRelation, t as MorphToManyRelation, u as BelongsToManyRelation } from "../relationship-AnKH8ZaV.mjs";
2
2
 
3
3
  export { BelongsToManyRelation, BelongsToRelation, HasManyRelation, HasManyThroughRelation, HasOneRelation, HasOneThroughRelation, MorphManyRelation, MorphOneRelation, MorphToManyRelation, Relation, RelationTableLoader, SetBasedEagerLoader, SingleResultRelation };
@@ -716,6 +716,7 @@ const buildMigrationIdentity = (filePath, className) => {
716
716
  return `${fileName.slice(0, fileName.length - extname(fileName).length)}:${className}`;
717
717
  };
718
718
  const computeMigrationChecksum = (filePath) => {
719
+ if (!existsSync$1(filePath)) return createHash("sha256").update(filePath).digest("hex");
719
720
  const source = readFileSync$1(filePath, "utf-8");
720
721
  return createHash("sha256").update(source).digest("hex");
721
722
  };
@@ -2590,6 +2591,149 @@ const getPersistedEnumTsType = (values) => {
2590
2591
  return buildEnumUnionType(values);
2591
2592
  };
2592
2593
 
2594
+ //#endregion
2595
+ //#region src/helpers/runtime-registry.ts
2596
+ const createEmptyRegistry = () => ({
2597
+ paths: {
2598
+ models: [],
2599
+ seeders: [],
2600
+ migrations: [],
2601
+ factories: []
2602
+ },
2603
+ migrations: [],
2604
+ seeders: [],
2605
+ models: [],
2606
+ factories: []
2607
+ });
2608
+ const registry = createEmptyRegistry();
2609
+ const pushUnique = (items, values) => {
2610
+ values.forEach((value) => {
2611
+ if (!items.includes(value)) items.push(value);
2612
+ });
2613
+ };
2614
+ const normalizePathInput = (paths) => {
2615
+ if (paths === void 0) return [];
2616
+ return (Array.isArray(paths) ? paths : [paths]).filter((path) => typeof path === "string" && path.trim().length > 0);
2617
+ };
2618
+ const normalizeConstructors = (items) => items.flatMap((item) => Array.isArray(item) ? item : [item]).filter(Boolean);
2619
+ /**
2620
+ * Register additional runtime discovery paths without replacing configured paths.
2621
+ *
2622
+ * @param paths
2623
+ */
2624
+ const registerPaths = (paths) => {
2625
+ Object.entries(paths).forEach(([key, value]) => {
2626
+ pushUnique(registry.paths[key], normalizePathInput(value));
2627
+ });
2628
+ };
2629
+ /**
2630
+ * Register additional runtime discovery paths for migrations without replacing configured paths.
2631
+ *
2632
+ * @param paths
2633
+ * @returns
2634
+ */
2635
+ const loadMigrationsFrom = (paths) => registerPaths({ migrations: paths });
2636
+ /**
2637
+ * Register additional runtime discovery paths for seeders without replacing configured paths.
2638
+ *
2639
+ * @param paths
2640
+ * @returns
2641
+ */
2642
+ const loadSeedersFrom = (paths) => registerPaths({ seeders: paths });
2643
+ /**
2644
+ * Register additional runtime discovery paths for models without replacing configured paths.
2645
+ *
2646
+ * @param paths
2647
+ * @returns
2648
+ */
2649
+ const loadModelsFrom = (paths) => registerPaths({ models: paths });
2650
+ /**
2651
+ * Register additional runtime discovery paths for factories without replacing configured paths.
2652
+ *
2653
+ * @param paths
2654
+ * @returns
2655
+ */
2656
+ const loadFactoriesFrom = (paths) => registerPaths({ factories: paths });
2657
+ /**
2658
+ * Register migration constructors directly without relying on runtime discovery.
2659
+ *
2660
+ * @param migrations
2661
+ */
2662
+ const registerMigrations = (...migrations) => {
2663
+ pushUnique(registry.migrations, normalizeConstructors(migrations));
2664
+ };
2665
+ /**
2666
+ * Register seeder constructors directly without relying on runtime discovery.
2667
+ *
2668
+ * @param seeders
2669
+ */
2670
+ const registerSeeders = (...seeders) => {
2671
+ pushUnique(registry.seeders, normalizeConstructors(seeders));
2672
+ };
2673
+ /**
2674
+ * Register model constructors directly without relying on runtime discovery.
2675
+ *
2676
+ * @param models
2677
+ */
2678
+ const registerModels = (...models) => {
2679
+ pushUnique(registry.models, normalizeConstructors(models));
2680
+ };
2681
+ /**
2682
+ * Register factory constructors or instances directly without relying on runtime discovery.
2683
+ *
2684
+ * @param factories
2685
+ */
2686
+ const registerFactories = (...factories) => {
2687
+ pushUnique(registry.factories, normalizeConstructors(factories));
2688
+ };
2689
+ /**
2690
+ * Get registered runtime discovery paths or registered constructors for a specific type.
2691
+ *
2692
+ * @param key
2693
+ * @returns
2694
+ */
2695
+ const getRegisteredPaths = (key) => {
2696
+ if (key) return [...registry.paths[key]];
2697
+ return {
2698
+ models: [...registry.paths.models],
2699
+ seeders: [...registry.paths.seeders],
2700
+ migrations: [...registry.paths.migrations],
2701
+ factories: [...registry.paths.factories]
2702
+ };
2703
+ };
2704
+ /**
2705
+ * Get registered migration constructors instances.
2706
+ *
2707
+ * @returns
2708
+ */
2709
+ const getRegisteredMigrations = () => [...registry.migrations];
2710
+ /**
2711
+ * Get registered seeder constructors instances.
2712
+ *
2713
+ * @returns
2714
+ */
2715
+ const getRegisteredSeeders = () => [...registry.seeders];
2716
+ /**
2717
+ * Get registered model constructors instances.
2718
+ *
2719
+ * @returns
2720
+ */
2721
+ const getRegisteredModels = () => [...registry.models];
2722
+ /**
2723
+ * Get registered factory constructors or instances.
2724
+ *
2725
+ * @returns
2726
+ */
2727
+ const getRegisteredFactories = () => [...registry.factories];
2728
+ const resetRuntimeRegistryForTests = () => {
2729
+ const empty = createEmptyRegistry();
2730
+ registry.paths = empty.paths;
2731
+ registry.migrations = empty.migrations;
2732
+ registry.seeders = empty.seeders;
2733
+ registry.models = empty.models;
2734
+ registry.factories = empty.factories;
2735
+ };
2736
+
2593
2737
  //#endregion
2594
2738
  //#region src/helpers/runtime-config.ts
2595
2739
  const resolveDefaultStubsPath = () => {
@@ -2777,6 +2921,7 @@ const resetArkormRuntimeForTests = () => {
2777
2921
  runtimePaginationCurrentPageResolver = void 0;
2778
2922
  runtimeDebugHandler = void 0;
2779
2923
  resetPersistedColumnMappingsCache();
2924
+ resetRuntimeRegistryForTests();
2780
2925
  };
2781
2926
  /**
2782
2927
  * Resolve a runtime client instance from the provided resolver, which can be either
@@ -4443,4 +4588,4 @@ var MorphToManyRelation = class extends Relation {
4443
4588
  };
4444
4589
 
4445
4590
  //#endregion
4446
- export { PRISMA_ENUM_MEMBER_REGEX as $, findAppliedMigration as $t, isDelegateLike as A, getMigrationPlan as At, getPersistedEnumMap as B, supportsDatabaseReset as Bt, getRuntimeAdapter as C, escapeRegex as Ct, getRuntimePaginationURLDriverFactory as D, formatEnumDefaultValue as Dt, getRuntimePaginationCurrentPageResolver as E, formatDefaultValue as Et, runArkormTransaction as F, runMigrationWithPrisma as Ft, readPersistedColumnMappingsState as G, TableBuilder as Gt, getPersistedPrimaryKeyGeneration as H, toModelName as Ht, applyOperationsToPersistedColumnMappingsState as I, runPrismaCommand as It, resolveColumnMappingsFilePath as J, buildMigrationIdentity as Jt, rebuildPersistedColumnMappingsState as K, ForeignKeyBuilder as Kt, createEmptyPersistedColumnMappingsState as L, stripPrismaSchemaModelsAndEnums as Lt, isTransactionCapableClient as M, resolveEnumName as Mt, loadArkormConfig as N, resolveMigrationClassName as Nt, getRuntimePrismaClient as O, formatRelationAction as Ot, resetArkormRuntimeForTests as P, resolvePrismaType as Pt, writePersistedColumnMappingsState as Q, deleteAppliedMigrationsStateFromStore as Qt, deletePersistedColumnMappingsState as R, supportsDatabaseCreation as Rt, getDefaultStubsPath as S, deriveSingularFieldName as St, getRuntimeDebugHandler as T, findModelBlock as Tt, getPersistedTableMetadata as U, SchemaBuilder as Ut, getPersistedEnumTsType as V, toMigrationFileSlug as Vt, getPersistedTimestampColumns as W, EnumBuilder as Wt, syncPersistedColumnMappingsFromState as X, computeMigrationChecksum as Xt, resolvePersistedMetadataFeatures as Y, buildMigrationRunId as Yt, validatePersistedMetadataFeaturesForMigrations as Z, createEmptyAppliedMigrationsState as Zt, defineConfig as _, ArkormCollection as _n, createMigrationTimestamp as _t, HasOneRelation as a, readAppliedMigrationsState as an, applyMigrationRollbackToDatabase as at, getActiveTransactionAdapter as b, deriveRelationAlias as bt, BelongsToRelation as c, resolveMigrationStateFilePath as cn, applyMigrationToPrismaSchema as ct, Relation as d, writeAppliedMigrationsStateToStore as dn, buildFieldLine as dt, getLastMigrationRun as en, PRISMA_ENUM_REGEX as et, LengthAwarePaginator as f, RuntimeModuleLoader as fn, buildIndexLine as ft, configureArkormRuntime as g, RelationResolutionException as gn, buildRelationLine as gt, bindAdapterToModels as h, RelationTableLoader as hn, buildModelBlock as ht, HasOneThroughRelation as i, markMigrationRun as in, applyDropTableOperation as it, isQuerySchemaLike as j, pad as jt, getUserConfig as k, generateMigrationFile as kt, SingleResultRelation as l, supportsDatabaseMigrationState as ln, applyOperationsToPrismaSchema as lt, URLDriver as m, SetBasedEagerLoader as mn, buildMigrationSource as mt, MorphOneRelation as n, isMigrationApplied as nn, applyAlterTableOperation as nt, HasManyThroughRelation as o, readAppliedMigrationsStateFromStore as on, applyMigrationRollbackToPrismaSchema as ot, Paginator as p, UnsupportedAdapterFeatureException as pn, buildInverseRelationLine as pt, resetPersistedColumnMappingsCache as q, PrimaryKeyGenerationPlanner as qt, MorphManyRelation as r, markMigrationApplied as rn, applyCreateTableOperation as rt, HasManyRelation as s, removeAppliedMigration as sn, applyMigrationToDatabase as st, MorphToManyRelation as t, getLatestAppliedMigrations as tn, PRISMA_MODEL_REGEX as tt, BelongsToManyRelation as u, writeAppliedMigrationsState as un, buildEnumBlock as ut, emitRuntimeDebugEvent as v, ArkormException as vn, deriveCollectionFieldName as vt, getRuntimeClient as w, findEnumBlock as wt, getActiveTransactionClient as x, deriveRelationFieldName as xt, ensureArkormConfigLoading as y, deriveInverseRelationAlias as yt, getPersistedColumnMap as z, supportsDatabaseMigrationExecution as zt };
4591
+ export { deletePersistedColumnMappingsState as $, supportsDatabaseCreation as $t, isDelegateLike as A, RelationTableLoader as An, buildModelBlock as At, getRegisteredSeeders as B, findModelBlock as Bt, getRuntimeAdapter as C, resolveMigrationStateFilePath as Cn, applyMigrationToPrismaSchema as Ct, getRuntimePaginationURLDriverFactory as D, RuntimeModuleLoader as Dn, buildIndexLine as Dt, getRuntimePaginationCurrentPageResolver as E, writeAppliedMigrationsStateToStore as En, buildFieldLine as Et, runArkormTransaction as F, deriveRelationAlias as Ft, registerFactories as G, getMigrationPlan as Gt, loadMigrationsFrom as H, formatEnumDefaultValue as Ht, getRegisteredFactories as I, deriveRelationFieldName as It, registerPaths as J, resolveMigrationClassName as Jt, registerMigrations as K, pad as Kt, getRegisteredMigrations as L, deriveSingularFieldName as Lt, isTransactionCapableClient as M, ArkormCollection as Mn, createMigrationTimestamp as Mt, loadArkormConfig as N, ArkormException as Nn, deriveCollectionFieldName as Nt, getRuntimePrismaClient as O, UnsupportedAdapterFeatureException as On, buildInverseRelationLine as Ot, resetArkormRuntimeForTests as P, deriveInverseRelationAlias as Pt, createEmptyPersistedColumnMappingsState as Q, stripPrismaSchemaModelsAndEnums as Qt, getRegisteredModels as R, escapeRegex as Rt, getDefaultStubsPath as S, removeAppliedMigration as Sn, applyMigrationToDatabase as St, getRuntimeDebugHandler as T, writeAppliedMigrationsState as Tn, buildEnumBlock as Tt, loadModelsFrom as U, formatRelationAction as Ut, loadFactoriesFrom as V, formatDefaultValue as Vt, loadSeedersFrom as W, generateMigrationFile as Wt, resetRuntimeRegistryForTests as X, runMigrationWithPrisma as Xt, registerSeeders as Y, resolvePrismaType as Yt, applyOperationsToPersistedColumnMappingsState as Z, runPrismaCommand as Zt, defineConfig as _, isMigrationApplied as _n, applyAlterTableOperation as _t, HasOneRelation as a, EnumBuilder as an, getPersistedTimestampColumns as at, getActiveTransactionAdapter as b, readAppliedMigrationsState as bn, applyMigrationRollbackToDatabase as bt, BelongsToRelation as c, PrimaryKeyGenerationPlanner as cn, resetPersistedColumnMappingsCache as ct, Relation as d, computeMigrationChecksum as dn, syncPersistedColumnMappingsFromState as dt, supportsDatabaseMigrationExecution as en, getPersistedColumnMap as et, LengthAwarePaginator as f, createEmptyAppliedMigrationsState as fn, validatePersistedMetadataFeaturesForMigrations as ft, configureArkormRuntime as g, getLatestAppliedMigrations as gn, PRISMA_MODEL_REGEX as gt, bindAdapterToModels as h, getLastMigrationRun as hn, PRISMA_ENUM_REGEX as ht, HasOneThroughRelation as i, SchemaBuilder as in, getPersistedTableMetadata as it, isQuerySchemaLike as j, RelationResolutionException as jn, buildRelationLine as jt, getUserConfig as k, SetBasedEagerLoader as kn, buildMigrationSource as kt, SingleResultRelation as l, buildMigrationIdentity as ln, resolveColumnMappingsFilePath as lt, URLDriver as m, findAppliedMigration as mn, PRISMA_ENUM_MEMBER_REGEX as mt, MorphOneRelation as n, toMigrationFileSlug as nn, getPersistedEnumTsType as nt, HasManyThroughRelation as o, TableBuilder as on, readPersistedColumnMappingsState as ot, Paginator as p, deleteAppliedMigrationsStateFromStore as pn, writePersistedColumnMappingsState as pt, registerModels as q, resolveEnumName as qt, MorphManyRelation as r, toModelName as rn, getPersistedPrimaryKeyGeneration as rt, HasManyRelation as s, ForeignKeyBuilder as sn, rebuildPersistedColumnMappingsState as st, MorphToManyRelation as t, supportsDatabaseReset as tn, getPersistedEnumMap as tt, BelongsToManyRelation as u, buildMigrationRunId as un, resolvePersistedMetadataFeatures as ut, emitRuntimeDebugEvent as v, markMigrationApplied as vn, applyCreateTableOperation as vt, getRuntimeClient as w, supportsDatabaseMigrationState as wn, applyOperationsToPrismaSchema as wt, getActiveTransactionClient as x, readAppliedMigrationsStateFromStore as xn, applyMigrationRollbackToPrismaSchema as xt, ensureArkormConfigLoading as y, markMigrationRun as yn, applyDropTableOperation as yt, getRegisteredPaths as z, findEnumBlock as zt };