import { injectable } from "@codemation/core"; import type { AppPersistenceConfig } from "../../presentation/config/AppConfig"; const implSpecifier = (() => { const suffix = "Operations.js"; const relativePath = import.meta.url.includes("/src/") ? "./PrismaMigration" + suffix : "./infrastructure/persistence/PrismaMigration" + suffix; return new URL(relativePath, import.meta.url).href; })(); @injectable() export class PrismaMigrationDeployer { async deployPersistence(persistence: AppPersistenceConfig, env?: Readonly): Promise { const { PrismaMigrationOperations } = await import( /* webpackIgnore: true */ /* @vite-ignore */ implSpecifier ); // eslint-disable-next-line codemation/no-manual-di-new -- lazy-loaded impl; cannot be registered in DI without breaking the bootstrap chain return new PrismaMigrationOperations().deployPersistence(persistence, env); } async deploy(args: Readonly<{ databaseUrl: string; env?: Readonly }>): Promise { const { PrismaMigrationOperations } = await import( /* webpackIgnore: true */ /* @vite-ignore */ implSpecifier ); // eslint-disable-next-line codemation/no-manual-di-new -- lazy-loaded impl; cannot be registered in DI without breaking the bootstrap chain return new PrismaMigrationOperations().deploy(args); } async resolvePackageRoot(env: Readonly = process.env): Promise { const { PrismaMigrationOperations } = await import( /* webpackIgnore: true */ /* @vite-ignore */ implSpecifier ); // eslint-disable-next-line codemation/no-manual-di-new -- lazy-loaded impl; cannot be registered in DI without breaking the bootstrap chain return new PrismaMigrationOperations().resolvePackageRoot(env); } }