casker-cli 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +1 -3
- package/dist/backup/application/commands/CreateBackupCommand.d.ts +8 -0
- package/dist/backup/application/commands/CreateBackupCommand.d.ts.map +1 -0
- package/dist/backup/application/commands/CreateBackupCommand.js +2 -0
- package/dist/backup/application/commands/CreateBackupCommand.js.map +1 -0
- package/dist/backup/application/commands/CreateBackupCommandHandler.d.ts +13 -0
- package/dist/backup/application/commands/CreateBackupCommandHandler.d.ts.map +1 -0
- package/dist/backup/application/commands/CreateBackupCommandHandler.js +31 -0
- package/dist/backup/application/commands/CreateBackupCommandHandler.js.map +1 -0
- package/dist/backup/application/queries/ListBackupQuery.d.ts +18 -0
- package/dist/backup/application/queries/ListBackupQuery.d.ts.map +1 -0
- package/dist/backup/application/queries/ListBackupQuery.js +2 -0
- package/dist/backup/application/queries/ListBackupQuery.js.map +1 -0
- package/dist/backup/application/queries/ListBackupQueryHandler.d.ts +9 -0
- package/dist/backup/application/queries/ListBackupQueryHandler.d.ts.map +1 -0
- package/dist/backup/application/queries/ListBackupQueryHandler.js +22 -0
- package/dist/backup/application/queries/ListBackupQueryHandler.js.map +1 -0
- package/dist/backup/composition/CreateBackupHandler.d.ts +3 -0
- package/dist/backup/composition/CreateBackupHandler.d.ts.map +1 -0
- package/dist/backup/composition/CreateBackupHandler.js +11 -0
- package/dist/backup/composition/CreateBackupHandler.js.map +1 -0
- package/dist/backup/composition/CreateListBackupHandler.d.ts +3 -0
- package/dist/backup/composition/CreateListBackupHandler.d.ts.map +1 -0
- package/dist/backup/composition/CreateListBackupHandler.js +7 -0
- package/dist/backup/composition/CreateListBackupHandler.js.map +1 -0
- package/dist/backup/domain/entities/BackupResult.d.ts +25 -0
- package/dist/backup/domain/entities/BackupResult.d.ts.map +1 -0
- package/dist/backup/domain/entities/BackupResult.js +52 -0
- package/dist/backup/domain/entities/BackupResult.js.map +1 -0
- package/dist/backup/domain/errors/BackupFailedError.d.ts +6 -0
- package/dist/backup/domain/errors/BackupFailedError.d.ts.map +1 -0
- package/dist/backup/domain/errors/BackupFailedError.js +11 -0
- package/dist/backup/domain/errors/BackupFailedError.js.map +1 -0
- package/dist/backup/domain/factories/BackupEngineFactory.d.ts +6 -0
- package/dist/backup/domain/factories/BackupEngineFactory.d.ts.map +1 -0
- package/dist/backup/domain/factories/BackupEngineFactory.js +3 -0
- package/dist/backup/domain/factories/BackupEngineFactory.js.map +1 -0
- package/dist/backup/domain/interfaces/BackupEngine.d.ts +10 -0
- package/dist/backup/domain/interfaces/BackupEngine.d.ts.map +1 -0
- package/dist/backup/domain/interfaces/BackupEngine.js +10 -0
- package/dist/backup/domain/interfaces/BackupEngine.js.map +1 -0
- package/dist/backup/domain/repositories/BackupResultRepository.d.ts +7 -0
- package/dist/backup/domain/repositories/BackupResultRepository.d.ts.map +1 -0
- package/dist/backup/domain/repositories/BackupResultRepository.js +3 -0
- package/dist/backup/domain/repositories/BackupResultRepository.js.map +1 -0
- package/dist/backup/infrastructure/engines/BaseBackupEngine.d.ts +10 -0
- package/dist/backup/infrastructure/engines/BaseBackupEngine.d.ts.map +1 -0
- package/dist/backup/infrastructure/engines/BaseBackupEngine.js +26 -0
- package/dist/backup/infrastructure/engines/BaseBackupEngine.js.map +1 -0
- package/dist/backup/infrastructure/engines/MySqlBackupEngine.d.ts +8 -0
- package/dist/backup/infrastructure/engines/MySqlBackupEngine.d.ts.map +1 -0
- package/dist/backup/infrastructure/engines/MySqlBackupEngine.js +24 -0
- package/dist/backup/infrastructure/engines/MySqlBackupEngine.js.map +1 -0
- package/dist/backup/infrastructure/engines/PostgresBackupEngine.d.ts +8 -0
- package/dist/backup/infrastructure/engines/PostgresBackupEngine.d.ts.map +1 -0
- package/dist/backup/infrastructure/engines/PostgresBackupEngine.js +24 -0
- package/dist/backup/infrastructure/engines/PostgresBackupEngine.js.map +1 -0
- package/dist/backup/infrastructure/factories/BackupEngineFactoryImpl.d.ts +12 -0
- package/dist/backup/infrastructure/factories/BackupEngineFactoryImpl.d.ts.map +1 -0
- package/dist/backup/infrastructure/factories/BackupEngineFactoryImpl.js +17 -0
- package/dist/backup/infrastructure/factories/BackupEngineFactoryImpl.js.map +1 -0
- package/dist/backup/infrastructure/persistance/entities/BackupResultModel.d.ts +11 -0
- package/dist/backup/infrastructure/persistance/entities/BackupResultModel.d.ts.map +1 -0
- package/dist/backup/infrastructure/persistance/entities/BackupResultModel.js +57 -0
- package/dist/backup/infrastructure/persistance/entities/BackupResultModel.js.map +1 -0
- package/dist/backup/infrastructure/persistance/mappers/BackupResultMapper.d.ts +7 -0
- package/dist/backup/infrastructure/persistance/mappers/BackupResultMapper.d.ts.map +1 -0
- package/dist/backup/infrastructure/persistance/mappers/BackupResultMapper.js +20 -0
- package/dist/backup/infrastructure/persistance/mappers/BackupResultMapper.js.map +1 -0
- package/dist/backup/infrastructure/persistance/migrations/1790597847025-InitialMigration.d.ts +7 -0
- package/dist/backup/infrastructure/persistance/migrations/1790597847025-InitialMigration.d.ts.map +1 -0
- package/dist/backup/infrastructure/persistance/migrations/1790597847025-InitialMigration.js +10 -0
- package/dist/backup/infrastructure/persistance/migrations/1790597847025-InitialMigration.js.map +1 -0
- package/dist/backup/infrastructure/persistance/migrations/1791226380321-AddDbName.d.ts +7 -0
- package/dist/backup/infrastructure/persistance/migrations/1791226380321-AddDbName.d.ts.map +1 -0
- package/dist/backup/infrastructure/persistance/migrations/1791226380321-AddDbName.js +16 -0
- package/dist/backup/infrastructure/persistance/migrations/1791226380321-AddDbName.js.map +1 -0
- package/dist/backup/infrastructure/persistance/repositories/BackupResultRepositoryImpl.d.ts +8 -0
- package/dist/backup/infrastructure/persistance/repositories/BackupResultRepositoryImpl.d.ts.map +1 -0
- package/dist/backup/infrastructure/persistance/repositories/BackupResultRepositoryImpl.js +28 -0
- package/dist/backup/infrastructure/persistance/repositories/BackupResultRepositoryImpl.js.map +1 -0
- package/dist/backup/presentation/cli/commands/CreateBackupCliCommand.d.ts +19 -0
- package/dist/backup/presentation/cli/commands/CreateBackupCliCommand.d.ts.map +1 -0
- package/dist/backup/presentation/cli/commands/CreateBackupCliCommand.js +66 -0
- package/dist/backup/presentation/cli/commands/CreateBackupCliCommand.js.map +1 -0
- package/dist/backup/presentation/cli/commands/ListBackupCliCommand.d.ts +17 -0
- package/dist/backup/presentation/cli/commands/ListBackupCliCommand.d.ts.map +1 -0
- package/dist/backup/presentation/cli/commands/ListBackupCliCommand.js +64 -0
- package/dist/backup/presentation/cli/commands/ListBackupCliCommand.js.map +1 -0
- package/dist/restore/application/commands/RestoreCommand.d.ts +8 -0
- package/dist/restore/application/commands/RestoreCommand.d.ts.map +1 -0
- package/dist/restore/application/commands/RestoreCommand.js +2 -0
- package/dist/restore/application/commands/RestoreCommand.js.map +1 -0
- package/dist/restore/application/commands/RestoreCommandHandler.d.ts +11 -0
- package/dist/restore/application/commands/RestoreCommandHandler.d.ts.map +1 -0
- package/dist/restore/application/commands/RestoreCommandHandler.js +14 -0
- package/dist/restore/application/commands/RestoreCommandHandler.js.map +1 -0
- package/dist/restore/composition/CreateBackupHandler.d.ts +3 -0
- package/dist/restore/composition/CreateBackupHandler.d.ts.map +1 -0
- package/dist/restore/composition/CreateBackupHandler.js +9 -0
- package/dist/restore/composition/CreateBackupHandler.js.map +1 -0
- package/dist/restore/domain/errors/RestoreFailedError.d.ts +5 -0
- package/dist/restore/domain/errors/RestoreFailedError.d.ts.map +1 -0
- package/dist/restore/domain/errors/RestoreFailedError.js +9 -0
- package/dist/restore/domain/errors/RestoreFailedError.js.map +1 -0
- package/dist/restore/domain/factories/RestoreEngineFactory.d.ts +6 -0
- package/dist/restore/domain/factories/RestoreEngineFactory.d.ts.map +1 -0
- package/dist/restore/domain/factories/RestoreEngineFactory.js +3 -0
- package/dist/restore/domain/factories/RestoreEngineFactory.js.map +1 -0
- package/dist/restore/domain/interfaces/RestoreEngine.d.ts +8 -0
- package/dist/restore/domain/interfaces/RestoreEngine.d.ts.map +1 -0
- package/dist/restore/domain/interfaces/RestoreEngine.js +7 -0
- package/dist/restore/domain/interfaces/RestoreEngine.js.map +1 -0
- package/dist/restore/infrastructure/engines/BaseRestoreEngine.d.ts +8 -0
- package/dist/restore/infrastructure/engines/BaseRestoreEngine.d.ts.map +1 -0
- package/dist/restore/infrastructure/engines/BaseRestoreEngine.js +14 -0
- package/dist/restore/infrastructure/engines/BaseRestoreEngine.js.map +1 -0
- package/dist/restore/infrastructure/engines/PostgresRestoreEngine.d.ts +7 -0
- package/dist/restore/infrastructure/engines/PostgresRestoreEngine.d.ts.map +1 -0
- package/dist/restore/infrastructure/engines/PostgresRestoreEngine.js +25 -0
- package/dist/restore/infrastructure/engines/PostgresRestoreEngine.js.map +1 -0
- package/dist/restore/infrastructure/factories/RestoreEngineFactoryImpl.d.ts +13 -0
- package/dist/restore/infrastructure/factories/RestoreEngineFactoryImpl.d.ts.map +1 -0
- package/dist/restore/infrastructure/factories/RestoreEngineFactoryImpl.js +16 -0
- package/dist/restore/infrastructure/factories/RestoreEngineFactoryImpl.js.map +1 -0
- package/dist/restore/presentation/cli/commands/RestoreCliCommand.d.ts +20 -0
- package/dist/restore/presentation/cli/commands/RestoreCliCommand.d.ts.map +1 -0
- package/dist/restore/presentation/cli/commands/RestoreCliCommand.js +65 -0
- package/dist/restore/presentation/cli/commands/RestoreCliCommand.js.map +1 -0
- package/dist/shared/application/handlers/CommandHandler.d.ts +4 -0
- package/dist/shared/application/handlers/CommandHandler.d.ts.map +1 -0
- package/dist/shared/application/handlers/CommandHandler.js +3 -0
- package/dist/shared/application/handlers/CommandHandler.js.map +1 -0
- package/dist/shared/application/handlers/QueryHandler.d.ts +4 -0
- package/dist/shared/application/handlers/QueryHandler.d.ts.map +1 -0
- package/dist/shared/application/handlers/QueryHandler.js +3 -0
- package/dist/shared/application/handlers/QueryHandler.js.map +1 -0
- package/dist/shared/composition/commands.d.ts +9 -0
- package/dist/shared/composition/commands.d.ts.map +1 -0
- package/dist/shared/composition/commands.js +9 -0
- package/dist/shared/composition/commands.js.map +1 -0
- package/dist/shared/domain/factories/CommandExecutorFactory.d.ts +11 -0
- package/dist/shared/domain/factories/CommandExecutorFactory.d.ts.map +1 -0
- package/dist/shared/domain/factories/CommandExecutorFactory.js +3 -0
- package/dist/shared/domain/factories/CommandExecutorFactory.js.map +1 -0
- package/dist/shared/domain/interfaces/CommandExecutor.d.ts +11 -0
- package/dist/shared/domain/interfaces/CommandExecutor.d.ts.map +1 -0
- package/dist/shared/domain/interfaces/CommandExecutor.js +3 -0
- package/dist/shared/domain/interfaces/CommandExecutor.js.map +1 -0
- package/dist/shared/domain/value-objects/ConnectionConfig.d.ts +24 -0
- package/dist/shared/domain/value-objects/ConnectionConfig.d.ts.map +1 -0
- package/dist/shared/domain/value-objects/ConnectionConfig.js +19 -0
- package/dist/shared/domain/value-objects/ConnectionConfig.js.map +1 -0
- package/dist/shared/domain/value-objects/ValueObject.d.ts +17 -0
- package/dist/shared/domain/value-objects/ValueObject.d.ts.map +1 -0
- package/dist/shared/domain/value-objects/ValueObject.js +34 -0
- package/dist/shared/domain/value-objects/ValueObject.js.map +1 -0
- package/dist/shared/infrastructure/config/data-source.d.ts +4 -0
- package/dist/shared/infrastructure/config/data-source.d.ts.map +1 -0
- package/dist/shared/infrastructure/config/data-source.js +13 -0
- package/dist/shared/infrastructure/config/data-source.js.map +1 -0
- package/dist/shared/infrastructure/executors/BaseCommandExecutor.d.ts +6 -0
- package/dist/shared/infrastructure/executors/BaseCommandExecutor.d.ts.map +1 -0
- package/dist/shared/infrastructure/executors/BaseCommandExecutor.js +37 -0
- package/dist/shared/infrastructure/executors/BaseCommandExecutor.js.map +1 -0
- package/dist/shared/infrastructure/executors/DockerCommandExecutor.d.ts +8 -0
- package/dist/shared/infrastructure/executors/DockerCommandExecutor.d.ts.map +1 -0
- package/dist/shared/infrastructure/executors/DockerCommandExecutor.js +13 -0
- package/dist/shared/infrastructure/executors/DockerCommandExecutor.js.map +1 -0
- package/dist/shared/infrastructure/executors/LocalCommandExecutor.d.ts +6 -0
- package/dist/shared/infrastructure/executors/LocalCommandExecutor.d.ts.map +1 -0
- package/dist/shared/infrastructure/executors/LocalCommandExecutor.js +7 -0
- package/dist/shared/infrastructure/executors/LocalCommandExecutor.js.map +1 -0
- package/dist/shared/infrastructure/factories/CommandExecutorFactoryImpl.d.ts +6 -0
- package/dist/shared/infrastructure/factories/CommandExecutorFactoryImpl.d.ts.map +1 -0
- package/dist/shared/infrastructure/factories/CommandExecutorFactoryImpl.js +13 -0
- package/dist/shared/infrastructure/factories/CommandExecutorFactoryImpl.js.map +1 -0
- package/dist/shared/presentation/bin/dev.d.ts +3 -0
- package/dist/shared/presentation/bin/dev.d.ts.map +1 -0
- package/dist/shared/presentation/bin/dev.js +4 -0
- package/dist/shared/presentation/bin/dev.js.map +1 -0
- package/dist/shared/presentation/bin/run.d.ts +3 -0
- package/dist/shared/presentation/bin/run.d.ts.map +1 -0
- package/dist/shared/presentation/bin/run.js +4 -0
- package/dist/shared/presentation/bin/run.js.map +1 -0
- package/dist/shared/presentation/hooks/init/DataSourceInitialize.d.ts +4 -0
- package/dist/shared/presentation/hooks/init/DataSourceInitialize.d.ts.map +1 -0
- package/dist/shared/presentation/hooks/init/DataSourceInitialize.js +7 -0
- package/dist/shared/presentation/hooks/init/DataSourceInitialize.js.map +1 -0
- package/dist/shared/utils/ErrorMessage.d.ts +2 -0
- package/dist/shared/utils/ErrorMessage.d.ts.map +1 -0
- package/dist/shared/utils/ErrorMessage.js +4 -0
- package/dist/shared/utils/ErrorMessage.js.map +1 -0
- package/package.json +96 -4
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { errorMessage } from '../../../shared/utils/ErrorMessage.js';
|
|
2
|
+
import { RestoreEngine } from '../../domain/interfaces/RestoreEngine.js';
|
|
3
|
+
import { RestoreFailedError } from '../../domain/errors/RestoreFailedError.js';
|
|
4
|
+
export class BaseRestoreEngine extends RestoreEngine {
|
|
5
|
+
async restore(config, backupFilePath) {
|
|
6
|
+
try {
|
|
7
|
+
await this.executor.execute(this.buildRestoreCommandSpec(config, backupFilePath));
|
|
8
|
+
}
|
|
9
|
+
catch (err) {
|
|
10
|
+
throw new RestoreFailedError(errorMessage(err));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=BaseRestoreEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseRestoreEngine.js","sourceRoot":"","sources":["../../../../src/restore/infrastructure/engines/BaseRestoreEngine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAE/E,MAAM,OAAgB,iBAEpB,SAAQ,aAAgB;IAGxB,KAAK,CAAC,OAAO,CAAC,MAAS,EAAE,cAAsB;QAC7C,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;QACpF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,kBAAkB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CommandSpec } from '../../../shared/domain/interfaces/CommandExecutor.js';
|
|
2
|
+
import type { PostgresConnectionProps } from '../../../shared/domain/value-objects/ConnectionConfig.js';
|
|
3
|
+
import { BaseRestoreEngine } from './BaseRestoreEngine.js';
|
|
4
|
+
export declare class PostgresRestoreEngine extends BaseRestoreEngine<PostgresConnectionProps> {
|
|
5
|
+
buildRestoreCommandSpec(config: PostgresConnectionProps, filePath: string): CommandSpec;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=PostgresRestoreEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostgresRestoreEngine.d.ts","sourceRoot":"","sources":["../../../../src/restore/infrastructure/engines/PostgresRestoreEngine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AACxF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0DAA0D,CAAC;AACxG,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,qBAAa,qBAAsB,SAAQ,iBAAiB,CAAC,uBAAuB,CAAC;IACnF,uBAAuB,CAAC,MAAM,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW;CAqBxF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseRestoreEngine } from './BaseRestoreEngine.js';
|
|
2
|
+
export class PostgresRestoreEngine extends BaseRestoreEngine {
|
|
3
|
+
buildRestoreCommandSpec(config, filePath) {
|
|
4
|
+
return {
|
|
5
|
+
bin: 'pg_restore',
|
|
6
|
+
args: [
|
|
7
|
+
'-Fc',
|
|
8
|
+
'-v',
|
|
9
|
+
'-h',
|
|
10
|
+
`${config.host}`,
|
|
11
|
+
'-p',
|
|
12
|
+
`${config.port}`,
|
|
13
|
+
'-U',
|
|
14
|
+
`${config.username}`,
|
|
15
|
+
'-d',
|
|
16
|
+
`${config.database}`,
|
|
17
|
+
'--clean',
|
|
18
|
+
'--if-exists',
|
|
19
|
+
],
|
|
20
|
+
env: {},
|
|
21
|
+
stdinFile: filePath,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=PostgresRestoreEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostgresRestoreEngine.js","sourceRoot":"","sources":["../../../../src/restore/infrastructure/engines/PostgresRestoreEngine.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,OAAO,qBAAsB,SAAQ,iBAA0C;IACnF,uBAAuB,CAAC,MAA+B,EAAE,QAAgB;QACvE,OAAO;YACL,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE;gBACJ,KAAK;gBACL,IAAI;gBACJ,IAAI;gBACJ,GAAG,MAAM,CAAC,IAAI,EAAE;gBAChB,IAAI;gBACJ,GAAG,MAAM,CAAC,IAAI,EAAE;gBAChB,IAAI;gBACJ,GAAG,MAAM,CAAC,QAAQ,EAAE;gBACpB,IAAI;gBACJ,GAAG,MAAM,CAAC,QAAQ,EAAE;gBACpB,SAAS;gBACT,aAAa;aACd;YACD,GAAG,EAAE,EAAE;YACP,SAAS,EAAE,QAAQ;SACpB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CommandExecutor } from '../../../shared/domain/interfaces/CommandExecutor.js';
|
|
2
|
+
import type { DatabaseConnectionProps } from '../../../shared/domain/value-objects/ConnectionConfig.js';
|
|
3
|
+
import type { RestoreEngineFactory } from '../../domain/factories/RestoreEngineFactory.js';
|
|
4
|
+
import type { RestoreEngine } from '../../domain/interfaces/RestoreEngine.js';
|
|
5
|
+
export type DriverType = DatabaseConnectionProps['type'];
|
|
6
|
+
type RestoreEngineConstructor = new (executor: CommandExecutor) => RestoreEngine;
|
|
7
|
+
export declare const engines: Record<DriverType, RestoreEngineConstructor>;
|
|
8
|
+
export declare class RestoreEngineFactoryImpl implements RestoreEngineFactory {
|
|
9
|
+
create(type: DriverType, executor: CommandExecutor): Promise<RestoreEngine>;
|
|
10
|
+
private getEngineClass;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=RestoreEngineFactoryImpl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RestoreEngineFactoryImpl.d.ts","sourceRoot":"","sources":["../../../../src/restore/infrastructure/factories/RestoreEngineFactoryImpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sDAAsD,CAAC;AAC5F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0DAA0D,CAAC;AACxG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAC3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAG9E,MAAM,MAAM,UAAU,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC;AAEzD,KAAK,wBAAwB,GAAG,KAAK,QAAQ,EAAE,eAAe,KAAK,aAAa,CAAC;AAGjF,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,wBAAwB,CAGhE,CAAC;AAEF,qBAAa,wBAAyB,YAAW,oBAAoB;IAC7D,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;IAKjF,OAAO,CAAC,cAAc;CAGvB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PostgresRestoreEngine } from '../engines/PostgresRestoreEngine.js';
|
|
2
|
+
// @ts-expect-error TS2741: mysql engine is not implemented yet
|
|
3
|
+
export const engines = {
|
|
4
|
+
postgresql: PostgresRestoreEngine,
|
|
5
|
+
// mysql: MySqlRestoreEngine,
|
|
6
|
+
};
|
|
7
|
+
export class RestoreEngineFactoryImpl {
|
|
8
|
+
async create(type, executor) {
|
|
9
|
+
const engine = this.getEngineClass(type);
|
|
10
|
+
return new engine(executor);
|
|
11
|
+
}
|
|
12
|
+
getEngineClass(type) {
|
|
13
|
+
return engines[type];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=RestoreEngineFactoryImpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RestoreEngineFactoryImpl.js","sourceRoot":"","sources":["../../../../src/restore/infrastructure/factories/RestoreEngineFactoryImpl.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAM5E,+DAA+D;AAC/D,MAAM,CAAC,MAAM,OAAO,GAAiD;IACnE,UAAU,EAAE,qBAAqB;IACjC,6BAA6B;CAC9B,CAAC;AAEF,MAAM,OAAO,wBAAwB;IACnC,KAAK,CAAC,MAAM,CAAC,IAAgB,EAAE,QAAyB;QACtD,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QACzC,OAAO,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;IAEO,cAAc,CAAC,IAAgB;QACrC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Command, Interfaces } from '@oclif/core';
|
|
2
|
+
export default class RestoreCliCommand extends Command {
|
|
3
|
+
static usage: string;
|
|
4
|
+
static description: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
type: Interfaces.OptionFlag<"postgresql" | "mysql", Interfaces.CustomOptions>;
|
|
7
|
+
host: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
8
|
+
port: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
|
|
9
|
+
username: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
10
|
+
password: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
11
|
+
database: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
12
|
+
execution: Interfaces.OptionFlag<"local" | "docker", Interfaces.CustomOptions>;
|
|
13
|
+
container: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
14
|
+
filepath: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
15
|
+
};
|
|
16
|
+
static constraints: (typeof Command)['constraints'];
|
|
17
|
+
private toCommand;
|
|
18
|
+
run(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=RestoreCliCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RestoreCliCommand.d.ts","sourceRoot":"","sources":["../../../../../src/restore/presentation/cli/commands/RestoreCliCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAsB,UAAU,EAAE,MAAM,aAAa,CAAC;AAMtE,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,OAAO;IACpD,MAAM,CAAC,KAAK,EAAE,MAAM,CAC6F;IACjH,OAAgB,WAAW,SAAyC;IACpE,OAAgB,KAAK;;;;;;;;;;MAyBnB;IAEF,MAAM,CAAC,WAAW,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,aAAa,CAAC,CAMjD;IAEF,OAAO,CAAC,SAAS;IAoBJ,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CASlC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Command, Constraints, Flags, Interfaces } from '@oclif/core';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { createRestoreHandler } from '../../../composition/CreateBackupHandler.js';
|
|
4
|
+
export default class RestoreCliCommand extends Command {
|
|
5
|
+
static usage = 'restore -t <value> -h <value> -p <value> -U <value> -P <value> -d <value> -e <value> [-c <value>] -f <value>';
|
|
6
|
+
static description = 'Restore database from a backup file';
|
|
7
|
+
static flags = {
|
|
8
|
+
type: Flags.custom({
|
|
9
|
+
char: 't',
|
|
10
|
+
description: 'Database type (e.g., postgresql, mysql)',
|
|
11
|
+
required: true,
|
|
12
|
+
})(),
|
|
13
|
+
host: Flags.string({ char: 'h', description: 'Database host', required: true }),
|
|
14
|
+
port: Flags.integer({ char: 'p', description: 'Database port', required: true }),
|
|
15
|
+
username: Flags.string({ char: 'U', description: 'Database username', required: true }),
|
|
16
|
+
password: Flags.string({ char: 'P', description: 'Database password', required: true }),
|
|
17
|
+
database: Flags.string({ char: 'd', description: 'Database name', required: true }),
|
|
18
|
+
execution: Flags.custom({
|
|
19
|
+
char: 'e',
|
|
20
|
+
description: 'Execution target (e.g., local, docker)',
|
|
21
|
+
required: true,
|
|
22
|
+
})(),
|
|
23
|
+
container: Flags.string({
|
|
24
|
+
char: 'c',
|
|
25
|
+
description: 'Docker container name',
|
|
26
|
+
}),
|
|
27
|
+
filepath: Flags.string({
|
|
28
|
+
char: 'f',
|
|
29
|
+
description: 'Backup file path',
|
|
30
|
+
required: true,
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
33
|
+
static constraints = [
|
|
34
|
+
Constraints.flag('container')
|
|
35
|
+
.is.dependentOn('execution')
|
|
36
|
+
.when.thisIsTrue((flags) => {
|
|
37
|
+
return flags.execution === 'docker';
|
|
38
|
+
}),
|
|
39
|
+
];
|
|
40
|
+
toCommand(flags) {
|
|
41
|
+
return {
|
|
42
|
+
connection: {
|
|
43
|
+
type: flags.type,
|
|
44
|
+
host: flags.host,
|
|
45
|
+
port: flags.port,
|
|
46
|
+
username: flags.username,
|
|
47
|
+
password: flags.password,
|
|
48
|
+
database: flags.database,
|
|
49
|
+
},
|
|
50
|
+
execution: {
|
|
51
|
+
mode: flags.execution,
|
|
52
|
+
container: flags.container,
|
|
53
|
+
},
|
|
54
|
+
backupFilePath: flags.filepath,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
async run() {
|
|
58
|
+
const { flags } = await this.parse(RestoreCliCommand);
|
|
59
|
+
const handler = createRestoreHandler();
|
|
60
|
+
const handlerArgs = this.toCommand(flags);
|
|
61
|
+
await handler.handle(handlerArgs);
|
|
62
|
+
console.log(chalk.green(`Database restored successfully!`));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=RestoreCliCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RestoreCliCommand.js","sourceRoot":"","sources":["../../../../../src/restore/presentation/cli/commands/RestoreCliCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAEnF,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,OAAO;IACpD,MAAM,CAAC,KAAK,GACV,8GAA8G,CAAC;IACjH,MAAM,CAAU,WAAW,GAAG,qCAAqC,CAAC;IACpE,MAAM,CAAU,KAAK,GAAG;QACtB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAa;YAC7B,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,yCAAyC;YACtD,QAAQ,EAAE,IAAI;SACf,CAAC,EAAE;QACJ,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC/E,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAChF,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QACvF,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QACvF,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QACnF,SAAS,EAAE,KAAK,CAAC,MAAM,CAA0B;YAC/C,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,IAAI;SACf,CAAC,EAAE;QACJ,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC;YACtB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,uBAAuB;SACrC,CAAC;QACF,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC;YACrB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,kBAAkB;YAC/B,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;IAEF,MAAM,CAAC,WAAW,GAAoC;QACpD,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC;aAC1B,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC;aAC3B,IAAI,CAAC,UAAU,CAAC,CAAC,KAAK,EAAW,EAAE;YAClC,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ,CAAC;QACtC,CAAC,CAAC;KACL,CAAC;IAEM,SAAS,CACf,KAA+D;QAE/D,OAAO;YACL,UAAU,EAAE;gBACV,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;aACzB;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,KAAK,CAAC,SAAS;gBACrB,SAAS,EAAE,KAAK,CAAC,SAAU;aAC5B;YACD,cAAc,EAAE,KAAK,CAAC,QAAQ;SAC/B,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAEtD,MAAM,OAAO,GAAG,oBAAoB,EAAE,CAAC;QACvC,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC1C,MAAM,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAElC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAC;IAC9D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandHandler.d.ts","sourceRoot":"","sources":["../../../../src/shared/application/handlers/CommandHandler.ts"],"names":[],"mappings":"AAAA,8BAAsB,cAAc,CAAC,QAAQ,EAAE,OAAO;IACpD,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;CACrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandHandler.js","sourceRoot":"","sources":["../../../../src/shared/application/handlers/CommandHandler.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,cAAc;CAEnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryHandler.d.ts","sourceRoot":"","sources":["../../../../src/shared/application/handlers/QueryHandler.ts"],"names":[],"mappings":"AAAA,8BAAsB,YAAY,CAAC,MAAM,EAAE,OAAO;IAChD,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CACjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryHandler.js","sourceRoot":"","sources":["../../../../src/shared/application/handlers/QueryHandler.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,YAAY;CAEjC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import CreateBackupCliCommand from '../../backup/presentation/cli/commands/CreateBackupCliCommand.js';
|
|
2
|
+
import ListBackupCliCommand from '../../backup/presentation/cli/commands/ListBackupCliCommand.js';
|
|
3
|
+
import RestoreCliCommand from '../../restore/presentation/cli/commands/RestoreCliCommand.js';
|
|
4
|
+
export declare const COMMANDS: {
|
|
5
|
+
backup: typeof CreateBackupCliCommand;
|
|
6
|
+
'backup:list': typeof ListBackupCliCommand;
|
|
7
|
+
restore: typeof RestoreCliCommand;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/shared/composition/commands.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,MAAM,kEAAkE,CAAC;AACtG,OAAO,oBAAoB,MAAM,gEAAgE,CAAC;AAClG,OAAO,iBAAiB,MAAM,8DAA8D,CAAC;AAE7F,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import CreateBackupCliCommand from '../../backup/presentation/cli/commands/CreateBackupCliCommand.js';
|
|
2
|
+
import ListBackupCliCommand from '../../backup/presentation/cli/commands/ListBackupCliCommand.js';
|
|
3
|
+
import RestoreCliCommand from '../../restore/presentation/cli/commands/RestoreCliCommand.js';
|
|
4
|
+
export const COMMANDS = {
|
|
5
|
+
backup: CreateBackupCliCommand,
|
|
6
|
+
'backup:list': ListBackupCliCommand,
|
|
7
|
+
restore: RestoreCliCommand,
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../src/shared/composition/commands.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,MAAM,kEAAkE,CAAC;AACtG,OAAO,oBAAoB,MAAM,gEAAgE,CAAC;AAClG,OAAO,iBAAiB,MAAM,8DAA8D,CAAC;AAE7F,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,MAAM,EAAE,sBAAsB;IAC9B,aAAa,EAAE,oBAAoB;IACnC,OAAO,EAAE,iBAAiB;CAC3B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CommandExecutor } from '../interfaces/CommandExecutor.js';
|
|
2
|
+
export type ExecutionTarget = {
|
|
3
|
+
mode: 'local';
|
|
4
|
+
} | {
|
|
5
|
+
mode: 'docker';
|
|
6
|
+
container: string;
|
|
7
|
+
};
|
|
8
|
+
export declare abstract class CommandExecutorFactory {
|
|
9
|
+
abstract create(type: ExecutionTarget): Promise<CommandExecutor>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=CommandExecutorFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandExecutorFactory.d.ts","sourceRoot":"","sources":["../../../../src/shared/domain/factories/CommandExecutorFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAExE,MAAM,MAAM,eAAe,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAExF,8BAAsB,sBAAsB;IAC1C,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;CACjE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandExecutorFactory.js","sourceRoot":"","sources":["../../../../src/shared/domain/factories/CommandExecutorFactory.ts"],"names":[],"mappings":"AAIA,MAAM,OAAgB,sBAAsB;CAE3C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface CommandSpec {
|
|
2
|
+
bin: string;
|
|
3
|
+
args: string[];
|
|
4
|
+
env: object;
|
|
5
|
+
stdoutFile?: string;
|
|
6
|
+
stdinFile?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare abstract class CommandExecutor {
|
|
9
|
+
abstract execute(command: CommandSpec): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=CommandExecutor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandExecutor.d.ts","sourceRoot":"","sources":["../../../../src/shared/domain/interfaces/CommandExecutor.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,8BAAsB,eAAe;IACnC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CACtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandExecutor.js","sourceRoot":"","sources":["../../../../src/shared/domain/interfaces/CommandExecutor.ts"],"names":[],"mappings":"AAQA,MAAM,OAAgB,eAAe;CAEpC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ValueObject } from './ValueObject.js';
|
|
2
|
+
import type { ValueObjectProps } from './ValueObject.js';
|
|
3
|
+
export interface PostgresConnectionProps extends ValueObjectProps {
|
|
4
|
+
type: 'postgresql';
|
|
5
|
+
host: string;
|
|
6
|
+
port: number;
|
|
7
|
+
database: string;
|
|
8
|
+
username: string;
|
|
9
|
+
password: string;
|
|
10
|
+
}
|
|
11
|
+
export interface MySqlConnectionProps extends ValueObjectProps {
|
|
12
|
+
type: 'mysql';
|
|
13
|
+
host: string;
|
|
14
|
+
port: number;
|
|
15
|
+
database: string;
|
|
16
|
+
username: string;
|
|
17
|
+
password: string;
|
|
18
|
+
}
|
|
19
|
+
export type DatabaseConnectionProps = PostgresConnectionProps | MySqlConnectionProps;
|
|
20
|
+
export declare class DatabaseConnectionConfig extends ValueObject<DatabaseConnectionProps> {
|
|
21
|
+
private constructor();
|
|
22
|
+
static create(props: DatabaseConnectionProps): DatabaseConnectionConfig;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=ConnectionConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectionConfig.d.ts","sourceRoot":"","sources":["../../../../src/shared/domain/value-objects/ConnectionConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC/D,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,uBAAuB,GAAG,uBAAuB,GAAG,oBAAoB,CAAC;AAErF,qBAAa,wBAAyB,SAAQ,WAAW,CAAC,uBAAuB,CAAC;IAChF,OAAO;IAIP,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,uBAAuB,GAAG,wBAAwB;CAYxE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ValueObject } from './ValueObject.js';
|
|
2
|
+
export class DatabaseConnectionConfig extends ValueObject {
|
|
3
|
+
constructor(props) {
|
|
4
|
+
super(props);
|
|
5
|
+
}
|
|
6
|
+
static create(props) {
|
|
7
|
+
if (!props.host.trim()) {
|
|
8
|
+
throw new Error('Host cannot be empty');
|
|
9
|
+
}
|
|
10
|
+
if (props.port < 1 || props.port > 65535) {
|
|
11
|
+
throw new Error('Invalid port number');
|
|
12
|
+
}
|
|
13
|
+
if (!props.database.trim()) {
|
|
14
|
+
throw new Error('Database name cannot be empty');
|
|
15
|
+
}
|
|
16
|
+
return new DatabaseConnectionConfig(props);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=ConnectionConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectionConfig.js","sourceRoot":"","sources":["../../../../src/shared/domain/value-objects/ConnectionConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAuB/C,MAAM,OAAO,wBAAyB,SAAQ,WAAoC;IAChF,YAAoB,KAA8B;QAChD,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAA8B;QAC1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC1C,CAAC;QACD,IAAI,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,IAAI,GAAG,KAAK,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,IAAI,wBAAwB,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type ValueObjectValue = string | number | boolean | Date | null | undefined;
|
|
2
|
+
export interface ValueObjectProps {
|
|
3
|
+
[key: string]: ValueObjectValue;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* @desc ValueObjects are objects that we determine their
|
|
7
|
+
* equality through their structural properties.
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class ValueObject<T extends ValueObjectProps> {
|
|
10
|
+
readonly props: T;
|
|
11
|
+
constructor(props: T);
|
|
12
|
+
private valuesEqual;
|
|
13
|
+
private shallowEqual;
|
|
14
|
+
equals(vo?: ValueObject<T>): boolean;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=ValueObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValueObject.d.ts","sourceRoot":"","sources":["../../../../src/shared/domain/value-objects/ValueObject.ts"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;AAE5E,MAAM,WAAW,gBAAgB;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC;CACjC;AAED;;;GAGG;AAEH,8BAAsB,WAAW,CAAC,CAAC,SAAS,gBAAgB;IAC1D,SAAgB,KAAK,EAAE,CAAC,CAAC;gBAEb,KAAK,EAAE,CAAC;IAIpB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,YAAY;IAWb,MAAM,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO;CAS5C"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @desc ValueObjects are objects that we determine their
|
|
3
|
+
* equality through their structural properties.
|
|
4
|
+
*/
|
|
5
|
+
export class ValueObject {
|
|
6
|
+
props;
|
|
7
|
+
constructor(props) {
|
|
8
|
+
this.props = Object.freeze(props);
|
|
9
|
+
}
|
|
10
|
+
valuesEqual(a, b) {
|
|
11
|
+
return a === b;
|
|
12
|
+
}
|
|
13
|
+
shallowEqual(a, b) {
|
|
14
|
+
const keysA = Object.keys(a);
|
|
15
|
+
const keysB = Object.keys(b);
|
|
16
|
+
if (keysA.length !== keysB.length)
|
|
17
|
+
return false;
|
|
18
|
+
for (const key of keysA) {
|
|
19
|
+
if (!this.valuesEqual(a[key], b[key]))
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
equals(vo) {
|
|
25
|
+
if (vo === null || vo === undefined) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
if (vo.props === undefined) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return this.shallowEqual(this.props, vo.props);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=ValueObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValueObject.js","sourceRoot":"","sources":["../../../../src/shared/domain/value-objects/ValueObject.ts"],"names":[],"mappings":"AAMA;;;GAGG;AAEH,MAAM,OAAgB,WAAW;IACf,KAAK,CAAI;IAEzB,YAAY,KAAQ;QAClB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAEO,WAAW,CAAC,CAAmB,EAAE,CAAmB;QAC1D,OAAO,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAEO,YAAY,CAAC,CAAI,EAAE,CAAI;QAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QAEhD,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;gBAAE,OAAO,KAAK,CAAC;QACtD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,MAAM,CAAC,EAAmB;QAC/B,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;YACpC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,EAAE,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-source.d.ts","sourceRoot":"","sources":["../../../../src/shared/infrastructure/config/data-source.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,eAAO,MAAM,aAAa,YAQxB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { DataSource } from 'typeorm';
|
|
3
|
+
import { BackupResultModel } from '../../../backup/infrastructure/persistance/entities/BackupResultModel.js';
|
|
4
|
+
export const AppDataSource = new DataSource({
|
|
5
|
+
type: 'better-sqlite3',
|
|
6
|
+
database: 'casker',
|
|
7
|
+
synchronize: false,
|
|
8
|
+
logging: false,
|
|
9
|
+
entities: [BackupResultModel],
|
|
10
|
+
migrations: ['src/backup/infrastructure/persistance/migrations/**/*{.ts,.js}'],
|
|
11
|
+
subscribers: [],
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=data-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-source.js","sourceRoot":"","sources":["../../../../src/shared/infrastructure/config/data-source.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0EAA0E,CAAC;AAE7G,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,UAAU,CAAC;IAC1C,IAAI,EAAE,gBAAgB;IACtB,QAAQ,EAAE,QAAQ;IAClB,WAAW,EAAE,KAAK;IAClB,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,CAAC,iBAAiB,CAAC;IAC7B,UAAU,EAAE,CAAC,gEAAgE,CAAC;IAC9E,WAAW,EAAE,EAAE;CAChB,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CommandExecutor, CommandSpec } from '../../domain/interfaces/CommandExecutor.js';
|
|
2
|
+
export declare abstract class BaseCommandExecutor implements CommandExecutor {
|
|
3
|
+
abstract execute(command: CommandSpec): Promise<void>;
|
|
4
|
+
protected run(bin: string, args: string[], env: NodeJS.ProcessEnv, stdoutFile?: string, stdinFile?: string): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=BaseCommandExecutor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseCommandExecutor.d.ts","sourceRoot":"","sources":["../../../../src/shared/infrastructure/executors/BaseCommandExecutor.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAE/F,8BAAsB,mBAAoB,YAAW,eAAe;IAClE,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;cAErC,GAAG,CACjB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC;CAiCjB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { mkdir } from 'node:fs/promises';
|
|
3
|
+
import { dirname } from 'node:path';
|
|
4
|
+
import { open } from 'node:fs/promises';
|
|
5
|
+
export class BaseCommandExecutor {
|
|
6
|
+
async run(bin, args, env, stdoutFile, stdinFile) {
|
|
7
|
+
// console.error(
|
|
8
|
+
// bin,
|
|
9
|
+
// args,
|
|
10
|
+
// { stdinFile, stdoutFile },
|
|
11
|
+
// );
|
|
12
|
+
let stdout;
|
|
13
|
+
let stdin;
|
|
14
|
+
try {
|
|
15
|
+
if (stdoutFile) {
|
|
16
|
+
await mkdir(dirname(stdoutFile), { recursive: true });
|
|
17
|
+
stdout = await open(stdoutFile, 'wx');
|
|
18
|
+
}
|
|
19
|
+
else if (stdinFile) {
|
|
20
|
+
stdin = await open(stdinFile, 'r');
|
|
21
|
+
}
|
|
22
|
+
await new Promise((resolve, reject) => {
|
|
23
|
+
const child = spawn(bin, args, {
|
|
24
|
+
env,
|
|
25
|
+
stdio: [stdin?.fd ?? 'ignore', stdout?.fd ?? 'inherit', 'inherit'],
|
|
26
|
+
});
|
|
27
|
+
child.on('error', reject);
|
|
28
|
+
child.on('close', (code) => code === 0 ? resolve() : reject(new Error(`${bin} exited with code ${code}`)));
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
await stdout?.close();
|
|
33
|
+
await stdin?.close();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=BaseCommandExecutor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseCommandExecutor.js","sourceRoot":"","sources":["../../../../src/shared/infrastructure/executors/BaseCommandExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAmB,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,MAAM,OAAgB,mBAAmB;IAG7B,KAAK,CAAC,GAAG,CACjB,GAAW,EACX,IAAc,EACd,GAAsB,EACtB,UAAmB,EACnB,SAAkB;QAElB,iBAAiB;QACjB,SAAS;QACT,UAAU;QACV,+BAA+B;QAC/B,KAAK;QACL,IAAI,MAA8B,CAAC;QACnC,IAAI,KAA6B,CAAC;QAElC,IAAI,CAAC;YACH,IAAI,UAAU,EAAE,CAAC;gBACf,MAAM,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;gBACtD,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YACxC,CAAC;iBAAM,IAAI,SAAS,EAAE,CAAC;gBACrB,KAAK,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;YACrC,CAAC;YAED,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC1C,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE;oBAC7B,GAAG;oBACH,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,IAAI,QAAQ,EAAE,MAAM,EAAE,EAAE,IAAI,SAAS,EAAE,SAAS,CAAC;iBACnE,CAAC,CAAC;gBAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;gBAC1B,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CACzB,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,GAAG,qBAAqB,IAAI,EAAE,CAAC,CAAC,CAC9E,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC;YACtB,MAAM,KAAK,EAAE,KAAK,EAAE,CAAC;QACvB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CommandSpec } from '../../domain/interfaces/CommandExecutor.js';
|
|
2
|
+
import { BaseCommandExecutor } from './BaseCommandExecutor.js';
|
|
3
|
+
export declare class DockerCommandExecutor extends BaseCommandExecutor {
|
|
4
|
+
private readonly containerName;
|
|
5
|
+
constructor(containerName: string);
|
|
6
|
+
execute(command: CommandSpec): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=DockerCommandExecutor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DockerCommandExecutor.d.ts","sourceRoot":"","sources":["../../../../src/shared/infrastructure/executors/DockerCommandExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,qBAAa,qBAAsB,SAAQ,mBAAmB;IAChD,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,MAAM;IAI5C,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CASnD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseCommandExecutor } from './BaseCommandExecutor.js';
|
|
2
|
+
export class DockerCommandExecutor extends BaseCommandExecutor {
|
|
3
|
+
containerName;
|
|
4
|
+
constructor(containerName) {
|
|
5
|
+
super();
|
|
6
|
+
this.containerName = containerName;
|
|
7
|
+
this.containerName = containerName;
|
|
8
|
+
}
|
|
9
|
+
async execute(command) {
|
|
10
|
+
await this.run('docker', ['exec', '-i', this.containerName, command.bin, ...command.args], { ...process.env, ...command.env }, command.stdoutFile, command.stdinFile);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=DockerCommandExecutor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DockerCommandExecutor.js","sourceRoot":"","sources":["../../../../src/shared/infrastructure/executors/DockerCommandExecutor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,OAAO,qBAAsB,SAAQ,mBAAmB;IAC/B;IAA7B,YAA6B,aAAqB;QAChD,KAAK,EAAE,CAAC;QADmB,kBAAa,GAAb,aAAa,CAAQ;QAEhD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IACD,KAAK,CAAC,OAAO,CAAC,OAAoB;QAChC,MAAM,IAAI,CAAC,GAAG,CACZ,QAAQ,EACR,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,EAChE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,EAClC,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,SAAS,CAClB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CommandSpec } from '../../domain/interfaces/CommandExecutor.js';
|
|
2
|
+
import { BaseCommandExecutor } from './BaseCommandExecutor.js';
|
|
3
|
+
export declare class LocalCommandExecutor extends BaseCommandExecutor {
|
|
4
|
+
execute(command: CommandSpec): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=LocalCommandExecutor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalCommandExecutor.d.ts","sourceRoot":"","sources":["../../../../src/shared/infrastructure/executors/LocalCommandExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,qBAAa,oBAAqB,SAAQ,mBAAmB;IACrD,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CASnD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseCommandExecutor } from './BaseCommandExecutor.js';
|
|
2
|
+
export class LocalCommandExecutor extends BaseCommandExecutor {
|
|
3
|
+
async execute(command) {
|
|
4
|
+
await this.run(command.bin, command.args, { ...process.env, ...command.env }, command.stdoutFile, command.stdinFile);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=LocalCommandExecutor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalCommandExecutor.js","sourceRoot":"","sources":["../../../../src/shared/infrastructure/executors/LocalCommandExecutor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,OAAO,oBAAqB,SAAQ,mBAAmB;IAC3D,KAAK,CAAC,OAAO,CAAC,OAAoB;QAChC,MAAM,IAAI,CAAC,GAAG,CACZ,OAAO,CAAC,GAAG,EACX,OAAO,CAAC,IAAI,EACZ,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,EAClC,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,SAAS,CAClB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CommandExecutorFactory, ExecutionTarget } from '../../domain/factories/CommandExecutorFactory.js';
|
|
2
|
+
import type { CommandExecutor } from '../../domain/interfaces/CommandExecutor.js';
|
|
3
|
+
export declare class CommandExecutorFactoryImpl implements CommandExecutorFactory {
|
|
4
|
+
create(execution: ExecutionTarget): Promise<CommandExecutor>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=CommandExecutorFactoryImpl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandExecutorFactoryImpl.d.ts","sourceRoot":"","sources":["../../../../src/shared/infrastructure/factories/CommandExecutorFactoryImpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EAChB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAKlF,qBAAa,0BAA2B,YAAW,sBAAsB;IACjE,MAAM,CAAC,SAAS,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;CAQnE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DockerCommandExecutor } from '../executors/DockerCommandExecutor.js';
|
|
2
|
+
import { LocalCommandExecutor } from '../executors/LocalCommandExecutor.js';
|
|
3
|
+
export class CommandExecutorFactoryImpl {
|
|
4
|
+
async create(execution) {
|
|
5
|
+
switch (execution.mode) {
|
|
6
|
+
case 'local':
|
|
7
|
+
return new LocalCommandExecutor();
|
|
8
|
+
case 'docker':
|
|
9
|
+
return new DockerCommandExecutor(execution.container);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=CommandExecutorFactoryImpl.js.map
|