arkormx 0.2.4 → 0.2.6

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.d.mts CHANGED
@@ -79,6 +79,23 @@ interface PrismaMigrationWorkflowOptions extends PrismaSchemaSyncOptions {
79
79
  migrateMode?: 'dev' | 'deploy';
80
80
  migrationName?: string;
81
81
  }
82
+ interface AppliedMigrationEntry {
83
+ id: string;
84
+ file: string;
85
+ className: string;
86
+ appliedAt: string;
87
+ checksum?: string;
88
+ }
89
+ interface AppliedMigrationRun {
90
+ id: string;
91
+ appliedAt: string;
92
+ migrationIds: string[];
93
+ }
94
+ interface AppliedMigrationsState {
95
+ version: 1;
96
+ migrations: AppliedMigrationEntry[];
97
+ runs?: AppliedMigrationRun[];
98
+ }
82
99
  //#endregion
83
100
  //#region src/Collection.d.ts
84
101
  declare class ArkormCollection<T = any, X = T[]> extends Collection<T, X> {}
@@ -2251,6 +2268,35 @@ declare class MigrateCommand extends Command<CliApp> {
2251
2268
  private loadMigrationClassesFromFile;
2252
2269
  }
2253
2270
  //#endregion
2271
+ //#region src/cli/commands/MigrateRollbackCommand.d.ts
2272
+ /**
2273
+ * Rollback migration classes from the Prisma schema and run Prisma workflow.
2274
+ * By default, rolls back classes applied in the last migrate run.
2275
+ *
2276
+ * @author Legacy (3m1n3nc3)
2277
+ * @since 0.2.4
2278
+ */
2279
+ declare class MigrateRollbackCommand extends Command<CliApp> {
2280
+ protected signature: string;
2281
+ protected description: string;
2282
+ handle(): Promise<undefined>;
2283
+ private loadAllMigrations;
2284
+ private loadMigrationClassesFromFile;
2285
+ }
2286
+ //#endregion
2287
+ //#region src/cli/commands/MigrationHistoryCommand.d.ts
2288
+ /**
2289
+ * The MigrationHistoryCommand class manages tracked migration run history.
2290
+ *
2291
+ * @author Legacy (3m1n3nc3)
2292
+ * @since 0.2.4
2293
+ */
2294
+ declare class MigrationHistoryCommand extends Command<CliApp> {
2295
+ protected signature: string;
2296
+ protected description: string;
2297
+ handle(): Promise<void>;
2298
+ }
2299
+ //#endregion
2254
2300
  //#region src/cli/commands/ModelsSyncCommand.d.ts
2255
2301
  declare class ModelsSyncCommand extends Command<CliApp> {
2256
2302
  protected signature: string;
@@ -2731,6 +2777,21 @@ declare class ModelNotFoundException extends ArkormException {
2731
2777
  getModelName(): string;
2732
2778
  }
2733
2779
  //#endregion
2780
+ //#region src/helpers/migration-history.d.ts
2781
+ declare const resolveMigrationStateFilePath: (cwd: string, configuredPath?: string) => string;
2782
+ declare const buildMigrationIdentity: (filePath: string, className: string) => string;
2783
+ declare const computeMigrationChecksum: (filePath: string) => string;
2784
+ declare const readAppliedMigrationsState: (stateFilePath: string) => AppliedMigrationsState;
2785
+ declare const writeAppliedMigrationsState: (stateFilePath: string, state: AppliedMigrationsState) => void;
2786
+ declare const isMigrationApplied: (state: AppliedMigrationsState, identity: string, checksum?: string) => boolean;
2787
+ declare const findAppliedMigration: (state: AppliedMigrationsState, identity: string) => AppliedMigrationEntry | undefined;
2788
+ declare const markMigrationApplied: (state: AppliedMigrationsState, entry: AppliedMigrationEntry) => AppliedMigrationsState;
2789
+ declare const removeAppliedMigration: (state: AppliedMigrationsState, identity: string) => AppliedMigrationsState;
2790
+ declare const buildMigrationRunId: () => string;
2791
+ declare const markMigrationRun: (state: AppliedMigrationsState, run: AppliedMigrationRun) => AppliedMigrationsState;
2792
+ declare const getLastMigrationRun: (state: AppliedMigrationsState) => AppliedMigrationRun | undefined;
2793
+ declare const getLatestAppliedMigrations: (state: AppliedMigrationsState, steps: number) => AppliedMigrationEntry[];
2794
+ //#endregion
2734
2795
  //#region src/helpers/migrations.d.ts
2735
2796
  declare const PRISMA_MODEL_REGEX: RegExp;
2736
2797
  /**
@@ -2956,6 +3017,18 @@ declare const applyMigrationToPrismaSchema: (migration: Migration | (new () => M
2956
3017
  schemaPath: string;
2957
3018
  operations: SchemaOperation[];
2958
3019
  }>;
3020
+ /**
3021
+ * Apply the rollback (down) operations defined in a migration to a Prisma schema file.
3022
+ *
3023
+ * @param migration The migration class or instance to rollback.
3024
+ * @param options Options for applying the rollback, including schema path and write flag.
3025
+ * @returns A promise that resolves to an object containing the updated schema, schema path, and rollback operations applied.
3026
+ */
3027
+ declare const applyMigrationRollbackToPrismaSchema: (migration: Migration | (new () => Migration), options?: PrismaSchemaSyncOptions) => Promise<{
3028
+ schema: string;
3029
+ schemaPath: string;
3030
+ operations: SchemaOperation[];
3031
+ }>;
2959
3032
  /**
2960
3033
  * Run a migration by applying its schema operations to a Prisma schema
2961
3034
  * file, optionally generating Prisma client code and running migrations after
@@ -3080,4 +3153,4 @@ declare class URLDriver {
3080
3153
  url(page: number): string;
3081
3154
  }
3082
3155
  //#endregion
3083
- export { ArkormCollection, ArkormException, CliApp, ForeignKeyBuilder, InitCommand, InlineFactory, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, Migration, Model, ModelFactory, ModelNotFoundException, ModelsSyncCommand, PRISMA_MODEL_REGEX, Paginator, PrismaDelegateMap, QueryBuilder, SEEDER_BRAND, SchemaBuilder, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, TableBuilder, URLDriver, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationToPrismaSchema, applyOperationsToPrismaSchema, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationSource, buildModelBlock, buildRelationLine, configureArkormRuntime, createMigrationTimestamp, createPrismaAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationFieldName, ensureArkormConfigLoading, escapeRegex, findModelBlock, formatDefaultValue, formatRelationAction, generateMigrationFile, getDefaultStubsPath, getMigrationPlan, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, loadArkormConfig, pad, resetArkormRuntimeForTests, resolveCast, resolveMigrationClassName, resolvePrismaType, runMigrationWithPrisma, runPrismaCommand, toMigrationFileSlug, toModelName };
3156
+ export { ArkormCollection, ArkormException, CliApp, ForeignKeyBuilder, InitCommand, InlineFactory, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateRollbackCommand, Migration, MigrationHistoryCommand, Model, ModelFactory, ModelNotFoundException, ModelsSyncCommand, PRISMA_MODEL_REGEX, Paginator, PrismaDelegateMap, QueryBuilder, SEEDER_BRAND, SchemaBuilder, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, TableBuilder, URLDriver, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToPrismaSchema, applyMigrationToPrismaSchema, applyOperationsToPrismaSchema, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createMigrationTimestamp, createPrismaAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findModelBlock, formatDefaultValue, formatRelationAction, generateMigrationFile, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runMigrationWithPrisma, runPrismaCommand, toMigrationFileSlug, toModelName, writeAppliedMigrationsState };