@contember/cli 2.0.0-alpha.9 → 2.0.0-beta.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/contember-docker.sh +0 -0
- package/dist/development/run.cjs.map +1 -1
- package/dist/development/run.js.map +1 -1
- package/dist/development/src/commands/deploy/DeployCommand.cjs +5 -5
- package/dist/development/src/commands/deploy/DeployCommand.cjs.map +1 -1
- package/dist/development/src/commands/deploy/DeployCommand.js +5 -5
- package/dist/development/src/commands/deploy/DeployCommand.js.map +1 -1
- package/dist/development/src/commands/migrations/MigrationAmendCommand.cjs +15 -3
- package/dist/development/src/commands/migrations/MigrationAmendCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationAmendCommand.js +15 -3
- package/dist/development/src/commands/migrations/MigrationAmendCommand.js.map +1 -1
- package/dist/development/src/commands/migrations/MigrationBlankCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationBlankCommand.js.map +1 -1
- package/dist/development/src/commands/migrations/MigrationDescribeCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationDescribeCommand.js.map +1 -1
- package/dist/development/src/commands/migrations/MigrationDiffCommand.cjs +1 -1
- package/dist/development/src/commands/migrations/MigrationDiffCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationDiffCommand.js +1 -1
- package/dist/development/src/commands/migrations/MigrationDiffCommand.js.map +1 -1
- package/dist/development/src/commands/migrations/MigrationExecuteCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationExecuteCommand.js.map +1 -1
- package/dist/development/src/commands/migrations/MigrationRebaseCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationRebaseCommand.js.map +1 -1
- package/dist/development/src/commands/migrations/MigrationStatusCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationStatusCommand.js.map +1 -1
- package/dist/development/src/commands/misc/VersionCommand.cjs.map +1 -1
- package/dist/development/src/commands/misc/VersionCommand.js.map +1 -1
- package/dist/development/src/commands/project/ProjectGenerateDocumentationCommand.cjs.map +1 -1
- package/dist/development/src/commands/project/ProjectGenerateDocumentationCommand.js.map +1 -1
- package/dist/development/src/commands/project/ProjectPrintSchemaCommand.cjs +13 -2
- package/dist/development/src/commands/project/ProjectPrintSchemaCommand.cjs.map +1 -1
- package/dist/development/src/commands/project/ProjectPrintSchemaCommand.js +14 -3
- package/dist/development/src/commands/project/ProjectPrintSchemaCommand.js.map +1 -1
- package/dist/development/src/commands/project/ProjectValidateCommand.cjs.map +1 -1
- package/dist/development/src/commands/project/ProjectValidateCommand.js.map +1 -1
- package/dist/development/src/commands/transfer/ExportCommand.cjs +2 -0
- package/dist/development/src/commands/transfer/ExportCommand.cjs.map +1 -1
- package/dist/development/src/commands/transfer/ExportCommand.js +2 -0
- package/dist/development/src/commands/transfer/ExportCommand.js.map +1 -1
- package/dist/development/src/commands/transfer/ImportCommand.cjs.map +1 -1
- package/dist/development/src/commands/transfer/ImportCommand.js.map +1 -1
- package/dist/development/src/commands/transfer/TransferCommand.cjs +2 -0
- package/dist/development/src/commands/transfer/TransferCommand.cjs.map +1 -1
- package/dist/development/src/commands/transfer/TransferCommand.js +2 -0
- package/dist/development/src/commands/transfer/TransferCommand.js.map +1 -1
- package/dist/development/src/commands/transfer/utils.cjs.map +1 -1
- package/dist/development/src/commands/transfer/utils.js.map +1 -1
- package/dist/development/src/commands/workspace/WorkspaceUpdateApiCommand.cjs.map +1 -1
- package/dist/development/src/commands/workspace/WorkspaceUpdateApiCommand.js.map +1 -1
- package/dist/development/src/consts.cjs +3 -1
- package/dist/development/src/consts.cjs.map +1 -1
- package/dist/development/src/consts.js +4 -2
- package/dist/development/src/consts.js.map +1 -1
- package/dist/development/src/dic.cjs +3 -1
- package/dist/development/src/dic.cjs.map +1 -1
- package/dist/development/src/dic.js +3 -1
- package/dist/development/src/dic.js.map +1 -1
- package/dist/development/src/lib/SystemClientProvider.cjs.map +1 -1
- package/dist/development/src/lib/SystemClientProvider.js.map +1 -1
- package/dist/development/src/lib/TenantClientProvider.cjs.map +1 -1
- package/dist/development/src/lib/TenantClientProvider.js.map +1 -1
- package/dist/development/src/lib/VersionChecker.cjs.map +1 -1
- package/dist/development/src/lib/VersionChecker.js.map +1 -1
- package/dist/development/src/lib/admin/AdminClient.cjs +1 -1
- package/dist/development/src/lib/admin/AdminClient.cjs.map +1 -1
- package/dist/development/src/lib/admin/AdminClient.js +1 -1
- package/dist/development/src/lib/admin/AdminClient.js.map +1 -1
- package/dist/development/src/lib/admin/AdminDeployer.cjs.map +1 -1
- package/dist/development/src/lib/admin/AdminDeployer.js.map +1 -1
- package/dist/development/src/lib/dsn.cjs.map +1 -1
- package/dist/development/src/lib/dsn.js.map +1 -1
- package/dist/development/src/lib/env.cjs +4 -1
- package/dist/development/src/lib/env.cjs.map +1 -1
- package/dist/development/src/lib/env.js +4 -1
- package/dist/development/src/lib/env.js.map +1 -1
- package/dist/development/src/lib/fs/DockerComposeManager.cjs.map +1 -1
- package/dist/development/src/lib/fs/DockerComposeManager.js.map +1 -1
- package/dist/development/src/lib/fs/FileSystem.cjs.map +1 -1
- package/dist/development/src/lib/fs/FileSystem.js.map +1 -1
- package/dist/development/src/lib/fs/YamlHandler.cjs.map +1 -1
- package/dist/development/src/lib/fs/YamlHandler.js.map +1 -1
- package/dist/development/src/lib/js/EsBuildBuilder.cjs +24 -19
- package/dist/development/src/lib/js/EsBuildBuilder.cjs.map +1 -1
- package/dist/development/src/lib/js/EsBuildBuilder.js +1 -1
- package/dist/development/src/lib/js/EsBuildBuilder.js.map +1 -1
- package/dist/development/src/lib/js/EvalExecutor.cjs +2 -2
- package/dist/development/src/lib/js/EvalExecutor.cjs.map +1 -1
- package/dist/development/src/lib/js/EvalExecutor.js +2 -2
- package/dist/development/src/lib/js/EvalExecutor.js.map +1 -1
- package/dist/development/src/lib/js/JsCodeRunner.cjs.map +1 -1
- package/dist/development/src/lib/js/JsCodeRunner.js.map +1 -1
- package/dist/development/src/lib/migrations/MigrationExecutionFacade.cjs +1 -1
- package/dist/development/src/lib/migrations/MigrationExecutionFacade.cjs.map +1 -1
- package/dist/development/src/lib/migrations/MigrationExecutionFacade.js +1 -1
- package/dist/development/src/lib/migrations/MigrationExecutionFacade.js.map +1 -1
- package/dist/development/src/lib/migrations/MigrationPrinter.cjs.map +1 -1
- package/dist/development/src/lib/migrations/MigrationPrinter.js.map +1 -1
- package/dist/development/src/lib/migrations/MigrationRebaseFacade.cjs.map +1 -1
- package/dist/development/src/lib/migrations/MigrationRebaseFacade.js.map +1 -1
- package/dist/development/src/lib/migrations/MigrationsStatusFacade.cjs.map +1 -1
- package/dist/development/src/lib/migrations/MigrationsStatusFacade.js.map +1 -1
- package/dist/development/src/lib/migrations/MigrationsValidator.cjs.map +1 -1
- package/dist/development/src/lib/migrations/MigrationsValidator.js.map +1 -1
- package/dist/development/src/lib/migrations/migrations.cjs.map +1 -1
- package/dist/development/src/lib/migrations/migrations.js.map +1 -1
- package/dist/development/src/lib/project/RemoteProject.cjs.map +1 -1
- package/dist/development/src/lib/project/RemoteProject.js.map +1 -1
- package/dist/development/src/lib/project/RemoteProjectProvider.cjs.map +1 -1
- package/dist/development/src/lib/project/RemoteProjectProvider.js.map +1 -1
- package/dist/development/src/lib/project/RemoteProjectResolver.cjs +9 -2
- package/dist/development/src/lib/project/RemoteProjectResolver.cjs.map +1 -1
- package/dist/development/src/lib/project/RemoteProjectResolver.js +9 -2
- package/dist/development/src/lib/project/RemoteProjectResolver.js.map +1 -1
- package/dist/development/src/lib/project/docs/components/EntityInfo.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/components/EntityInfo.js.map +1 -1
- package/dist/development/src/lib/project/docs/components/FieldLink.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/components/FieldLink.js.map +1 -1
- package/dist/development/src/lib/project/docs/components/FieldPermissions.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/components/FieldPermissions.js.map +1 -1
- package/dist/development/src/lib/project/docs/components/FieldType.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/components/FieldType.js.map +1 -1
- package/dist/development/src/lib/project/docs/components/OnDelete.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/components/OnDelete.js.map +1 -1
- package/dist/development/src/lib/project/docs/components/ProjectInfo.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/components/ProjectInfo.js.map +1 -1
- package/dist/development/src/lib/project/docs/components/SinglePermission.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/components/SinglePermission.js.map +1 -1
- package/dist/development/src/lib/project/docs/projectDescribe.cjs +3 -5
- package/dist/development/src/lib/project/docs/projectDescribe.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/projectDescribe.js +3 -4
- package/dist/development/src/lib/project/docs/projectDescribe.js.map +1 -1
- package/dist/development/src/lib/schema/SchemaLoader.cjs.map +1 -1
- package/dist/development/src/lib/schema/SchemaLoader.js.map +1 -1
- package/dist/development/src/lib/schema/SchemaValidationHelper.cjs.map +1 -1
- package/dist/development/src/lib/schema/SchemaValidationPrinter.cjs.map +1 -1
- package/dist/development/src/lib/schema/SchemaValidationPrinter.js.map +1 -1
- package/dist/development/src/lib/schema/collectReferences.cjs.map +1 -1
- package/dist/development/src/lib/schema/collectReferences.js.map +1 -1
- package/dist/development/src/lib/stream.cjs.map +1 -1
- package/dist/development/src/lib/stream.js.map +1 -1
- package/dist/development/src/lib/tenant/TenantClient.cjs +4 -8
- package/dist/development/src/lib/tenant/TenantClient.cjs.map +1 -1
- package/dist/development/src/lib/tenant/TenantClient.js +3 -7
- package/dist/development/src/lib/tenant/TenantClient.js.map +1 -1
- package/dist/development/src/lib/transfer/DataTransferClient.cjs +2 -2
- package/dist/development/src/lib/transfer/DataTransferClient.cjs.map +1 -1
- package/dist/development/src/lib/transfer/DataTransferClient.js +2 -2
- package/dist/development/src/lib/transfer/DataTransferClient.js.map +1 -1
- package/dist/development/src/lib/transfer/stdio.cjs.map +1 -1
- package/dist/development/src/lib/transfer/stdio.js.map +1 -1
- package/dist/development/src/lib/workspace/WorkspaceResolver.cjs.map +1 -1
- package/dist/development/src/lib/workspace/WorkspaceResolver.js.map +1 -1
- package/dist/production/run.cjs.map +1 -1
- package/dist/production/run.js +0 -0
- package/dist/production/run.js.map +1 -1
- package/dist/production/src/commands/deploy/DeployCommand.cjs +5 -5
- package/dist/production/src/commands/deploy/DeployCommand.cjs.map +1 -1
- package/dist/production/src/commands/deploy/DeployCommand.js +5 -5
- package/dist/production/src/commands/deploy/DeployCommand.js.map +1 -1
- package/dist/production/src/commands/migrations/MigrationAmendCommand.cjs +15 -3
- package/dist/production/src/commands/migrations/MigrationAmendCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationAmendCommand.js +15 -3
- package/dist/production/src/commands/migrations/MigrationAmendCommand.js.map +1 -1
- package/dist/production/src/commands/migrations/MigrationBlankCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationBlankCommand.js.map +1 -1
- package/dist/production/src/commands/migrations/MigrationDescribeCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationDescribeCommand.js.map +1 -1
- package/dist/production/src/commands/migrations/MigrationDiffCommand.cjs +1 -1
- package/dist/production/src/commands/migrations/MigrationDiffCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationDiffCommand.js +1 -1
- package/dist/production/src/commands/migrations/MigrationDiffCommand.js.map +1 -1
- package/dist/production/src/commands/migrations/MigrationExecuteCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationExecuteCommand.js.map +1 -1
- package/dist/production/src/commands/migrations/MigrationRebaseCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationRebaseCommand.js.map +1 -1
- package/dist/production/src/commands/migrations/MigrationStatusCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationStatusCommand.js.map +1 -1
- package/dist/production/src/commands/misc/VersionCommand.cjs.map +1 -1
- package/dist/production/src/commands/misc/VersionCommand.js.map +1 -1
- package/dist/production/src/commands/project/ProjectGenerateDocumentationCommand.cjs.map +1 -1
- package/dist/production/src/commands/project/ProjectGenerateDocumentationCommand.js.map +1 -1
- package/dist/production/src/commands/project/ProjectPrintSchemaCommand.cjs +13 -2
- package/dist/production/src/commands/project/ProjectPrintSchemaCommand.cjs.map +1 -1
- package/dist/production/src/commands/project/ProjectPrintSchemaCommand.js +14 -3
- package/dist/production/src/commands/project/ProjectPrintSchemaCommand.js.map +1 -1
- package/dist/production/src/commands/project/ProjectValidateCommand.cjs.map +1 -1
- package/dist/production/src/commands/project/ProjectValidateCommand.js.map +1 -1
- package/dist/production/src/commands/transfer/ExportCommand.cjs +2 -0
- package/dist/production/src/commands/transfer/ExportCommand.cjs.map +1 -1
- package/dist/production/src/commands/transfer/ExportCommand.js +2 -0
- package/dist/production/src/commands/transfer/ExportCommand.js.map +1 -1
- package/dist/production/src/commands/transfer/ImportCommand.cjs.map +1 -1
- package/dist/production/src/commands/transfer/ImportCommand.js.map +1 -1
- package/dist/production/src/commands/transfer/TransferCommand.cjs +2 -0
- package/dist/production/src/commands/transfer/TransferCommand.cjs.map +1 -1
- package/dist/production/src/commands/transfer/TransferCommand.js +2 -0
- package/dist/production/src/commands/transfer/TransferCommand.js.map +1 -1
- package/dist/production/src/commands/transfer/utils.cjs.map +1 -1
- package/dist/production/src/commands/transfer/utils.js.map +1 -1
- package/dist/production/src/commands/workspace/WorkspaceUpdateApiCommand.cjs.map +1 -1
- package/dist/production/src/commands/workspace/WorkspaceUpdateApiCommand.js.map +1 -1
- package/dist/production/src/consts.cjs +3 -1
- package/dist/production/src/consts.cjs.map +1 -1
- package/dist/production/src/consts.js +4 -2
- package/dist/production/src/consts.js.map +1 -1
- package/dist/production/src/dic.cjs +3 -1
- package/dist/production/src/dic.cjs.map +1 -1
- package/dist/production/src/dic.js +3 -1
- package/dist/production/src/dic.js.map +1 -1
- package/dist/production/src/lib/SystemClientProvider.cjs.map +1 -1
- package/dist/production/src/lib/SystemClientProvider.js.map +1 -1
- package/dist/production/src/lib/TenantClientProvider.cjs.map +1 -1
- package/dist/production/src/lib/TenantClientProvider.js.map +1 -1
- package/dist/production/src/lib/VersionChecker.cjs.map +1 -1
- package/dist/production/src/lib/VersionChecker.js.map +1 -1
- package/dist/production/src/lib/admin/AdminClient.cjs +1 -1
- package/dist/production/src/lib/admin/AdminClient.cjs.map +1 -1
- package/dist/production/src/lib/admin/AdminClient.js +1 -1
- package/dist/production/src/lib/admin/AdminClient.js.map +1 -1
- package/dist/production/src/lib/admin/AdminDeployer.cjs.map +1 -1
- package/dist/production/src/lib/admin/AdminDeployer.js.map +1 -1
- package/dist/production/src/lib/dsn.cjs.map +1 -1
- package/dist/production/src/lib/dsn.js.map +1 -1
- package/dist/production/src/lib/env.cjs +4 -1
- package/dist/production/src/lib/env.cjs.map +1 -1
- package/dist/production/src/lib/env.js +4 -1
- package/dist/production/src/lib/env.js.map +1 -1
- package/dist/production/src/lib/fs/DockerComposeManager.cjs.map +1 -1
- package/dist/production/src/lib/fs/DockerComposeManager.js.map +1 -1
- package/dist/production/src/lib/fs/FileSystem.cjs.map +1 -1
- package/dist/production/src/lib/fs/FileSystem.js.map +1 -1
- package/dist/production/src/lib/fs/YamlHandler.cjs.map +1 -1
- package/dist/production/src/lib/fs/YamlHandler.js.map +1 -1
- package/dist/production/src/lib/js/EsBuildBuilder.cjs +24 -19
- package/dist/production/src/lib/js/EsBuildBuilder.cjs.map +1 -1
- package/dist/production/src/lib/js/EsBuildBuilder.js +1 -1
- package/dist/production/src/lib/js/EsBuildBuilder.js.map +1 -1
- package/dist/production/src/lib/js/EvalExecutor.cjs +2 -2
- package/dist/production/src/lib/js/EvalExecutor.cjs.map +1 -1
- package/dist/production/src/lib/js/EvalExecutor.js +2 -2
- package/dist/production/src/lib/js/EvalExecutor.js.map +1 -1
- package/dist/production/src/lib/js/JsCodeRunner.cjs.map +1 -1
- package/dist/production/src/lib/js/JsCodeRunner.js.map +1 -1
- package/dist/production/src/lib/migrations/MigrationExecutionFacade.cjs +1 -1
- package/dist/production/src/lib/migrations/MigrationExecutionFacade.cjs.map +1 -1
- package/dist/production/src/lib/migrations/MigrationExecutionFacade.js +1 -1
- package/dist/production/src/lib/migrations/MigrationExecutionFacade.js.map +1 -1
- package/dist/production/src/lib/migrations/MigrationPrinter.cjs.map +1 -1
- package/dist/production/src/lib/migrations/MigrationPrinter.js.map +1 -1
- package/dist/production/src/lib/migrations/MigrationRebaseFacade.cjs.map +1 -1
- package/dist/production/src/lib/migrations/MigrationRebaseFacade.js.map +1 -1
- package/dist/production/src/lib/migrations/MigrationsStatusFacade.cjs.map +1 -1
- package/dist/production/src/lib/migrations/MigrationsStatusFacade.js.map +1 -1
- package/dist/production/src/lib/migrations/MigrationsValidator.cjs.map +1 -1
- package/dist/production/src/lib/migrations/MigrationsValidator.js.map +1 -1
- package/dist/production/src/lib/migrations/migrations.cjs.map +1 -1
- package/dist/production/src/lib/migrations/migrations.js.map +1 -1
- package/dist/production/src/lib/project/RemoteProject.cjs.map +1 -1
- package/dist/production/src/lib/project/RemoteProject.js.map +1 -1
- package/dist/production/src/lib/project/RemoteProjectProvider.cjs.map +1 -1
- package/dist/production/src/lib/project/RemoteProjectProvider.js.map +1 -1
- package/dist/production/src/lib/project/RemoteProjectResolver.cjs +9 -2
- package/dist/production/src/lib/project/RemoteProjectResolver.cjs.map +1 -1
- package/dist/production/src/lib/project/RemoteProjectResolver.js +9 -2
- package/dist/production/src/lib/project/RemoteProjectResolver.js.map +1 -1
- package/dist/production/src/lib/project/docs/components/EntityInfo.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/components/EntityInfo.js.map +1 -1
- package/dist/production/src/lib/project/docs/components/FieldPermissions.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/components/FieldPermissions.js.map +1 -1
- package/dist/production/src/lib/project/docs/components/FieldType.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/components/FieldType.js.map +1 -1
- package/dist/production/src/lib/project/docs/components/OnDelete.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/components/OnDelete.js.map +1 -1
- package/dist/production/src/lib/project/docs/components/ProjectInfo.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/components/ProjectInfo.js.map +1 -1
- package/dist/production/src/lib/project/docs/components/SinglePermission.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/components/SinglePermission.js.map +1 -1
- package/dist/production/src/lib/project/docs/projectDescribe.cjs +2 -4
- package/dist/production/src/lib/project/docs/projectDescribe.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/projectDescribe.js +2 -3
- package/dist/production/src/lib/project/docs/projectDescribe.js.map +1 -1
- package/dist/production/src/lib/schema/SchemaLoader.cjs.map +1 -1
- package/dist/production/src/lib/schema/SchemaLoader.js.map +1 -1
- package/dist/production/src/lib/schema/SchemaValidationHelper.cjs.map +1 -1
- package/dist/production/src/lib/schema/SchemaValidationPrinter.cjs.map +1 -1
- package/dist/production/src/lib/schema/SchemaValidationPrinter.js.map +1 -1
- package/dist/production/src/lib/schema/collectReferences.cjs.map +1 -1
- package/dist/production/src/lib/schema/collectReferences.js.map +1 -1
- package/dist/production/src/lib/stream.cjs.map +1 -1
- package/dist/production/src/lib/stream.js.map +1 -1
- package/dist/production/src/lib/tenant/TenantClient.cjs +4 -8
- package/dist/production/src/lib/tenant/TenantClient.cjs.map +1 -1
- package/dist/production/src/lib/tenant/TenantClient.js +3 -7
- package/dist/production/src/lib/tenant/TenantClient.js.map +1 -1
- package/dist/production/src/lib/transfer/DataTransferClient.cjs +2 -2
- package/dist/production/src/lib/transfer/DataTransferClient.cjs.map +1 -1
- package/dist/production/src/lib/transfer/DataTransferClient.js +2 -2
- package/dist/production/src/lib/transfer/DataTransferClient.js.map +1 -1
- package/dist/production/src/lib/transfer/stdio.cjs.map +1 -1
- package/dist/production/src/lib/transfer/stdio.js.map +1 -1
- package/dist/production/src/lib/workspace/WorkspaceResolver.cjs.map +1 -1
- package/dist/production/src/lib/workspace/WorkspaceResolver.js.map +1 -1
- package/dist/types/commands/deploy/DeployCommand.d.ts.map +1 -1
- package/dist/types/commands/migrations/MigrationAmendCommand.d.ts +1 -0
- package/dist/types/commands/migrations/MigrationAmendCommand.d.ts.map +1 -1
- package/dist/types/commands/project/ProjectPrintSchemaCommand.d.ts +4 -0
- package/dist/types/commands/project/ProjectPrintSchemaCommand.d.ts.map +1 -1
- package/dist/types/commands/transfer/ExportCommand.d.ts +1 -0
- package/dist/types/commands/transfer/ExportCommand.d.ts.map +1 -1
- package/dist/types/commands/transfer/TransferCommand.d.ts +1 -0
- package/dist/types/commands/transfer/TransferCommand.d.ts.map +1 -1
- package/dist/types/consts.d.ts.map +1 -1
- package/dist/types/dic.d.ts.map +1 -1
- package/dist/types/lib/env.d.ts +3 -0
- package/dist/types/lib/env.d.ts.map +1 -1
- package/dist/types/lib/js/EsBuildBuilder.d.ts.map +1 -1
- package/dist/types/lib/migrations/MigrationExecutionFacade.d.ts +2 -2
- package/dist/types/lib/migrations/MigrationExecutionFacade.d.ts.map +1 -1
- package/dist/types/lib/migrations/MigrationPrinter.d.ts.map +1 -1
- package/dist/types/lib/project/RemoteProjectResolver.d.ts +1 -1
- package/dist/types/lib/project/RemoteProjectResolver.d.ts.map +1 -1
- package/dist/types/lib/project/docs/projectDescribe.d.ts.map +1 -1
- package/dist/types/lib/tenant/TenantClient.d.ts +2 -2
- package/dist/types/lib/tenant/TenantClient.d.ts.map +1 -1
- package/dist/types/lib/transfer/DataTransferClient.d.ts +2 -1
- package/dist/types/lib/transfer/DataTransferClient.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +34 -31
- package/src/commands/deploy/DeployCommand.ts +6 -5
- package/src/commands/migrations/MigrationAmendCommand.ts +16 -3
- package/src/commands/migrations/MigrationDiffCommand.ts +1 -1
- package/src/commands/project/ProjectPrintSchemaCommand.ts +19 -3
- package/src/commands/transfer/ExportCommand.ts +3 -0
- package/src/commands/transfer/TransferCommand.ts +3 -0
- package/src/consts.ts +4 -2
- package/src/dic.ts +3 -1
- package/src/lib/admin/AdminClient.ts +1 -1
- package/src/lib/env.ts +6 -0
- package/src/lib/js/EsBuildBuilder.ts +1 -1
- package/src/lib/js/EvalExecutor.ts +2 -2
- package/src/lib/migrations/MigrationExecutionFacade.ts +3 -3
- package/src/lib/migrations/MigrationPrinter.ts +3 -0
- package/src/lib/project/RemoteProjectResolver.ts +10 -2
- package/src/lib/project/docs/projectDescribe.tsx +2 -3
- package/src/lib/tenant/TenantClient.ts +5 -9
- package/src/lib/transfer/DataTransferClient.ts +3 -2
- package/src/tsconfig.json +1 -0
- package/tsconfig.settings.json +0 -1
- package/Dockerfile +0 -20
- package/build.sh +0 -11
- package/esbuild.cjs +0 -27
package/contember-docker.sh
CHANGED
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.cjs","sources":["../../../packages/cli/src/run.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { join, resolve } from 'node:path'\nimport { packageRoot } from './consts'\nimport { createContainer } from './dic'\nimport { readCliEnv } from './lib/env'\nimport { WorkspaceResolver } from './lib/workspace/WorkspaceResolver'\nimport { YamlHandler } from './lib/fs/YamlHandler'\nimport { FileSystem } from './lib/fs/FileSystem';\n\n(async () => {\n\t// eslint-disable-next-line @typescript-eslint/no-var-requires\n\tconst version = require(join(packageRoot, 'package.json')).version\n\tconst nodeVersion = process.version.match(/^v?(\\d+)\\..+$/)\n\tif (nodeVersion && Number(nodeVersion[1]) < 18) {\n\t\tthrow `Node >= 18 is required`\n\t}\n\tconst env = readCliEnv()\n\tconst dir = env.dir ? resolve(env.dir) : process.cwd()\n\tconst workspaceResolver = new WorkspaceResolver(new YamlHandler(new FileSystem()))\n\tconst workspace = await workspaceResolver.resolve(dir)\n\tconst dic = createContainer({\n\t\tversion,\n\t\tworkspace,\n\t\tenv: env,\n\t\truntime: process.title === 'bun' ? 'bun' : 'node',\n\t})\n\n\n\tawait dic.application.run(process.argv.slice(2))\n})().catch(e => {\n\tconsole.log(e)\n\tprocess.exit(1)\n})\n"],"names":["join","packageRoot","env","readCliEnv","resolve","WorkspaceResolver","YamlHandler","FileSystem","dic","createContainer"],"mappings":";;;;;;;;;CASC,YAAY;AAEZ,QAAM,UAAU,QAAQA,
|
|
1
|
+
{"version":3,"file":"run.cjs","sources":["../../../packages/cli/src/run.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { join, resolve } from 'node:path'\nimport { packageRoot } from './consts'\nimport { createContainer } from './dic'\nimport { readCliEnv } from './lib/env'\nimport { WorkspaceResolver } from './lib/workspace/WorkspaceResolver'\nimport { YamlHandler } from './lib/fs/YamlHandler'\nimport { FileSystem } from './lib/fs/FileSystem';\n\n(async () => {\n\t// eslint-disable-next-line @typescript-eslint/no-var-requires\n\tconst version = require(join(packageRoot, 'package.json')).version\n\tconst nodeVersion = process.version.match(/^v?(\\d+)\\..+$/)\n\tif (nodeVersion && Number(nodeVersion[1]) < 18) {\n\t\tthrow `Node >= 18 is required`\n\t}\n\tconst env = readCliEnv()\n\tconst dir = env.dir ? resolve(env.dir) : process.cwd()\n\tconst workspaceResolver = new WorkspaceResolver(new YamlHandler(new FileSystem()))\n\tconst workspace = await workspaceResolver.resolve(dir)\n\tconst dic = createContainer({\n\t\tversion,\n\t\tworkspace,\n\t\tenv: env,\n\t\truntime: process.title === 'bun' ? 'bun' : 'node',\n\t})\n\n\n\tawait dic.application.run(process.argv.slice(2))\n})().catch(e => {\n\tconsole.log(e)\n\tprocess.exit(1)\n})\n"],"names":["join","packageRoot","env","readCliEnv","resolve","WorkspaceResolver","YamlHandler","FileSystem","dic","createContainer"],"mappings":";;;;;;;;;CASC,YAAY;AAEZ,QAAM,UAAU,QAAQA,UAAAA,KAAKC,OAAAA,aAAa,cAAc,CAAC,EAAE;AAC3D,QAAM,cAAc,QAAQ,QAAQ,MAAM,eAAe;AACzD,MAAI,eAAe,OAAO,YAAY,CAAC,CAAC,IAAI,IAAI;AACzC,UAAA;AAAA,EAAA;AAEP,QAAMC,QAAMC,IAAAA,WAAW;AACjB,QAAA,MAAMD,MAAI,MAAME,UAAAA,QAAQF,MAAI,GAAG,IAAI,QAAQ,IAAI;AAC/C,QAAA,oBAAoB,IAAIG,kBAAkB,kBAAA,IAAIC,YAAAA,YAAY,IAAIC,WAAA,WAAA,CAAY,CAAC;AACjF,QAAM,YAAY,MAAM,kBAAkB,QAAQ,GAAG;AACrD,QAAMC,QAAMC,IAAAA,gBAAgB;AAAA,IAC3B;AAAA,IACA;AAAA,IAAA,KACAP;AAAAA,IACA,SAAS,QAAQ,UAAU,QAAQ,QAAQ;AAAA,EAAA,CAC3C;AAGD,QAAMM,MAAI,YAAY,IAAI,QAAQ,KAAK,MAAM,CAAC,CAAC;AAChD,KAAK,MAAM,CAAK,MAAA;AACf,UAAQ,IAAI,CAAC;AACb,UAAQ,KAAK,CAAC;AACf,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sources":["../../../packages/cli/src/run.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { join, resolve } from 'node:path'\nimport { packageRoot } from './consts'\nimport { createContainer } from './dic'\nimport { readCliEnv } from './lib/env'\nimport { WorkspaceResolver } from './lib/workspace/WorkspaceResolver'\nimport { YamlHandler } from './lib/fs/YamlHandler'\nimport { FileSystem } from './lib/fs/FileSystem';\n\n(async () => {\n\t// eslint-disable-next-line @typescript-eslint/no-var-requires\n\tconst version = require(join(packageRoot, 'package.json')).version\n\tconst nodeVersion = process.version.match(/^v?(\\d+)\\..+$/)\n\tif (nodeVersion && Number(nodeVersion[1]) < 18) {\n\t\tthrow `Node >= 18 is required`\n\t}\n\tconst env = readCliEnv()\n\tconst dir = env.dir ? resolve(env.dir) : process.cwd()\n\tconst workspaceResolver = new WorkspaceResolver(new YamlHandler(new FileSystem()))\n\tconst workspace = await workspaceResolver.resolve(dir)\n\tconst dic = createContainer({\n\t\tversion,\n\t\tworkspace,\n\t\tenv: env,\n\t\truntime: process.title === 'bun' ? 'bun' : 'node',\n\t})\n\n\n\tawait dic.application.run(process.argv.slice(2))\n})().catch(e => {\n\tconsole.log(e)\n\tprocess.exit(1)\n})\n"],"names":[],"mappings":";;;;;;;;CASC,YAAY;AAEZ,QAAM,UAAU,QAAQ,KAAK,aAAa,cAAc,CAAC,EAAE;AAC3D,QAAM,cAAc,QAAQ,QAAQ,MAAM,eAAe;AACzD,MAAI,eAAe,OAAO,YAAY,CAAC,CAAC,IAAI,IAAI;AACzC,UAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"run.js","sources":["../../../packages/cli/src/run.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { join, resolve } from 'node:path'\nimport { packageRoot } from './consts'\nimport { createContainer } from './dic'\nimport { readCliEnv } from './lib/env'\nimport { WorkspaceResolver } from './lib/workspace/WorkspaceResolver'\nimport { YamlHandler } from './lib/fs/YamlHandler'\nimport { FileSystem } from './lib/fs/FileSystem';\n\n(async () => {\n\t// eslint-disable-next-line @typescript-eslint/no-var-requires\n\tconst version = require(join(packageRoot, 'package.json')).version\n\tconst nodeVersion = process.version.match(/^v?(\\d+)\\..+$/)\n\tif (nodeVersion && Number(nodeVersion[1]) < 18) {\n\t\tthrow `Node >= 18 is required`\n\t}\n\tconst env = readCliEnv()\n\tconst dir = env.dir ? resolve(env.dir) : process.cwd()\n\tconst workspaceResolver = new WorkspaceResolver(new YamlHandler(new FileSystem()))\n\tconst workspace = await workspaceResolver.resolve(dir)\n\tconst dic = createContainer({\n\t\tversion,\n\t\tworkspace,\n\t\tenv: env,\n\t\truntime: process.title === 'bun' ? 'bun' : 'node',\n\t})\n\n\n\tawait dic.application.run(process.argv.slice(2))\n})().catch(e => {\n\tconsole.log(e)\n\tprocess.exit(1)\n})\n"],"names":[],"mappings":";;;;;;;;CASC,YAAY;AAEZ,QAAM,UAAU,QAAQ,KAAK,aAAa,cAAc,CAAC,EAAE;AAC3D,QAAM,cAAc,QAAQ,QAAQ,MAAM,eAAe;AACzD,MAAI,eAAe,OAAO,YAAY,CAAC,CAAC,IAAI,IAAI;AACzC,UAAA;AAAA,EAAA;AAEP,QAAM,MAAM,WAAW;AACjB,QAAA,MAAM,IAAI,MAAM,QAAQ,IAAI,GAAG,IAAI,QAAQ,IAAI;AAC/C,QAAA,oBAAoB,IAAI,kBAAkB,IAAI,YAAY,IAAI,WAAA,CAAY,CAAC;AACjF,QAAM,YAAY,MAAM,kBAAkB,QAAQ,GAAG;AACrD,QAAM,MAAM,gBAAgB;AAAA,IAC3B;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,QAAQ,UAAU,QAAQ,QAAQ;AAAA,EAAA,CAC3C;AAGD,QAAM,IAAI,YAAY,IAAI,QAAQ,KAAK,MAAM,CAAC,CAAC;AAChD,KAAK,MAAM,CAAK,MAAA;AACf,UAAQ,IAAI,CAAC;AACb,UAAQ,KAAK,CAAC;AACf,CAAC;"}
|
|
@@ -24,21 +24,21 @@ class DeployCommand extends cliCommon.Command {
|
|
|
24
24
|
}
|
|
25
25
|
async execute(input) {
|
|
26
26
|
const dsn = input.getArgument("dsn");
|
|
27
|
-
const
|
|
27
|
+
const adminEndpoint = input.getOption("admin");
|
|
28
|
+
const remoteProject = this.remoteProjectResolver.resolve(dsn, adminEndpoint);
|
|
28
29
|
if (!remoteProject) {
|
|
29
30
|
throw `Project not defined. Please provide DSN or environment variables CONTEMBER_*`;
|
|
30
31
|
}
|
|
31
32
|
this.remoteProjectProvider.setRemoteProject(remoteProject);
|
|
32
|
-
let adminEndpoint = input.getOption("admin");
|
|
33
33
|
const deployMigration = input.getOption("no-migrations") !== true;
|
|
34
34
|
const yes = input.getOption("yes") === true;
|
|
35
35
|
const projectAdminDistDir = this.workspace.adminDistDir;
|
|
36
|
-
const deployAdmin = input.getOption("no-admin") !== true && !!adminEndpoint && !!projectAdminDistDir;
|
|
36
|
+
const deployAdmin = input.getOption("no-admin") !== true && !!remoteProject.adminEndpoint && !!projectAdminDistDir;
|
|
37
37
|
console.log("");
|
|
38
38
|
console.log("Contember project deployment configuration:");
|
|
39
39
|
console.log(`Target project name: ${remoteProject.name}`);
|
|
40
40
|
console.log(`API URL: ${remoteProject.endpoint}`);
|
|
41
|
-
console.log(`Admin URL: ${adminEndpoint ?? "none"}`);
|
|
41
|
+
console.log(`Admin URL: ${remoteProject.adminEndpoint ?? "none"}`);
|
|
42
42
|
console.log(`Deploy token: ${maskToken.maskToken(remoteProject.token)}`);
|
|
43
43
|
console.log("");
|
|
44
44
|
if (deployAdmin && !await this.fs.pathExists(`${projectAdminDistDir}/index.html`)) {
|
|
@@ -79,7 +79,7 @@ class DeployCommand extends cliCommon.Command {
|
|
|
79
79
|
console.log("");
|
|
80
80
|
console.log("Deployment successful");
|
|
81
81
|
console.log(`API URL: ${remoteProject.endpoint}`);
|
|
82
|
-
console.log(`Admin URL: ${adminEndpoint ?? "none"}`);
|
|
82
|
+
console.log(`Admin URL: ${remoteProject.adminEndpoint ?? "none"}`);
|
|
83
83
|
return 0;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeployCommand.cjs","sources":["../../../../../../packages/cli/src/commands/deploy/DeployCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport prompts from 'prompts'\nimport { maskToken } from '../../lib/maskToken'\nimport { MigrationExecutionFacade } from '../../lib/migrations/MigrationExecutionFacade'\nimport { AdminDeployer } from '../../lib/admin/AdminDeployer'\nimport { FileSystem } from '../../lib/fs/FileSystem'\nimport { RemoteProject } from '../../lib/project/RemoteProject'\nimport { Workspace } from '../../lib/workspace/Workspace'\nimport { RemoteProjectProvider } from '../../lib/project/RemoteProjectProvider'\nimport { RemoteProjectResolver } from '../../lib/project/RemoteProjectResolver'\n\ntype Args = {\n\tdsn: string\n}\n\ntype Options = {\n\tadmin?: string\n\t['no-admin']?: boolean\n\t['no-migrations']?: boolean\n\troot?: boolean\n\tyes?: boolean\n}\n\nexport class DeployCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly adminDeployer: AdminDeployer,\n\t\tprivate readonly migrationExecutionFacade: MigrationExecutionFacade,\n\t\tprivate readonly fs: FileSystem,\n\t\tprivate readonly remoteProjectProvider: RemoteProjectProvider,\n\t\tprivate readonly remoteProjectResolver: RemoteProjectResolver,\n\t\tprivate readonly workspace: Workspace,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Deploy Contember project')\n\t\tconfiguration.argument('dsn')\n\n\t\tconfiguration.option('admin').valueRequired()\n\t\tconfiguration.option('root').valueNone()\n\t\tconfiguration.option('no-admin').valueNone()\n\t\tconfiguration.option('no-migrations').valueNone()\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void | number> {\n\n\t\tconst dsn = input.getArgument('dsn')\n\t\tconst remoteProject = this.remoteProjectResolver.resolve(dsn)\n\t\tif (!remoteProject) {\n\t\t\tthrow `Project not defined. Please provide DSN or environment variables CONTEMBER_*`\n\t\t}\n\t\tthis.remoteProjectProvider.setRemoteProject(remoteProject)\n\n\t\
|
|
1
|
+
{"version":3,"file":"DeployCommand.cjs","sources":["../../../../../../packages/cli/src/commands/deploy/DeployCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport prompts from 'prompts'\nimport { maskToken } from '../../lib/maskToken'\nimport { MigrationExecutionFacade } from '../../lib/migrations/MigrationExecutionFacade'\nimport { AdminDeployer } from '../../lib/admin/AdminDeployer'\nimport { FileSystem } from '../../lib/fs/FileSystem'\nimport { RemoteProject } from '../../lib/project/RemoteProject'\nimport { Workspace } from '../../lib/workspace/Workspace'\nimport { RemoteProjectProvider } from '../../lib/project/RemoteProjectProvider'\nimport { RemoteProjectResolver } from '../../lib/project/RemoteProjectResolver'\n\ntype Args = {\n\tdsn: string\n}\n\ntype Options = {\n\tadmin?: string\n\t['no-admin']?: boolean\n\t['no-migrations']?: boolean\n\troot?: boolean\n\tyes?: boolean\n}\n\nexport class DeployCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly adminDeployer: AdminDeployer,\n\t\tprivate readonly migrationExecutionFacade: MigrationExecutionFacade,\n\t\tprivate readonly fs: FileSystem,\n\t\tprivate readonly remoteProjectProvider: RemoteProjectProvider,\n\t\tprivate readonly remoteProjectResolver: RemoteProjectResolver,\n\t\tprivate readonly workspace: Workspace,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Deploy Contember project')\n\t\tconfiguration.argument('dsn')\n\n\t\tconfiguration.option('admin').valueRequired()\n\t\tconfiguration.option('root').valueNone()\n\t\tconfiguration.option('no-admin').valueNone()\n\t\tconfiguration.option('no-migrations').valueNone()\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void | number> {\n\n\t\tconst dsn = input.getArgument('dsn')\n\t\tconst adminEndpoint = input.getOption('admin')\n\t\tconst remoteProject = this.remoteProjectResolver.resolve(dsn, adminEndpoint)\n\t\tif (!remoteProject) {\n\t\t\tthrow `Project not defined. Please provide DSN or environment variables CONTEMBER_*`\n\t\t}\n\t\tthis.remoteProjectProvider.setRemoteProject(remoteProject)\n\n\t\tconst deployMigration = input.getOption('no-migrations') !== true\n\t\tconst yes = input.getOption('yes') === true\n\t\tconst projectAdminDistDir = this.workspace.adminDistDir\n\n\t\tconst deployAdmin = input.getOption('no-admin') !== true && !!remoteProject.adminEndpoint && !!projectAdminDistDir\n\n\n\t\tconsole.log('')\n\t\tconsole.log('Contember project deployment configuration:')\n\t\tconsole.log(`Target project name: ${remoteProject.name}`)\n\t\tconsole.log(`API URL: ${remoteProject.endpoint}`)\n\t\tconsole.log(`Admin URL: ${remoteProject.adminEndpoint ?? 'none'}`)\n\t\tconsole.log(`Deploy token: ${maskToken(remoteProject.token)}`)\n\t\tconsole.log('')\n\n\n\t\tif (deployAdmin && !(await this.fs.pathExists(`${projectAdminDistDir}/index.html`))) {\n\t\t\tthrow `Missing ${projectAdminDistDir}/index.html. Please build admin before deploying.`\n\t\t}\n\n\t\tif (deployMigration) {\n\t\t\tconst result = await this.migrationExecutionFacade.execute({\n\t\t\t\tforce: false,\n\t\t\t\trequireConfirmation: !yes,\n\t\t\t\tadditionalMessage: deployAdmin ? 'Admin will be deployed.' : 'Admin will NOT be deployed.',\n\t\t\t})\n\t\t\tif (!result) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif (deployAdmin) {\n\t\t\tif (!deployMigration && !yes) {\n\t\t\t\tif (!process.stdin.isTTY) {\n\t\t\t\t\tthrow 'TTY not available. Pass --yes option to confirm execution.'\n\t\t\t\t}\n\t\t\t\tconsole.log('Admin will be deployed.')\n\t\t\t\tconsole.log('(to skip this dialog, you can pass --yes option)')\n\t\t\t\tconsole.log('')\n\t\t\t\tconst { ok } = await prompts({\n\t\t\t\t\ttype: 'confirm',\n\t\t\t\t\tname: 'ok',\n\t\t\t\t\tmessage: `Do you want to continue?`,\n\t\t\t\t})\n\t\t\t\tif (!ok) {\n\t\t\t\t\treturn 1\n\t\t\t\t}\n\t\t\t}\n\t\t\tawait this.adminDeployer.deploy({\n\t\t\t\tdir: projectAdminDistDir,\n\t\t\t\troot: input.getOption('root') === true,\n\t\t\t})\n\t\t}\n\n\t\tconsole.log('')\n\t\tconsole.log('Deployment successful')\n\t\tconsole.log(`API URL: ${remoteProject.endpoint}`)\n\t\tconsole.log(`Admin URL: ${remoteProject.adminEndpoint ?? 'none'}`)\n\n\t\treturn 0\n\t}\n}\n"],"names":["Command","maskToken"],"mappings":";;;;;AAuBO,MAAM,sBAAsBA,UAAAA,QAAuB;AAAA,EACzD,YACkB,eACA,0BACA,IACA,uBACA,uBACA,WAChB;AACK,UAAA;AAPW,SAAA,gBAAA;AACA,SAAA,2BAAA;AACA,SAAA,KAAA;AACA,SAAA,wBAAA;AACA,SAAA,wBAAA;AACA,SAAA,YAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,0BAA0B;AACpD,kBAAc,SAAS,KAAK;AAEd,kBAAA,OAAO,OAAO,EAAE,cAAc;AAC9B,kBAAA,OAAO,MAAM,EAAE,UAAU;AACzB,kBAAA,OAAO,UAAU,EAAE,UAAU;AAC7B,kBAAA,OAAO,eAAe,EAAE,UAAU;AAChD,kBACE,OAAO,KAAK,EACZ,UAAU,EACV,YAAY,8BAA8B;AAAA,EAAA;AAAA,EAG7C,MAAgB,QAAQ,OAAqD;AAEtE,UAAA,MAAM,MAAM,YAAY,KAAK;AAC7B,UAAA,gBAAgB,MAAM,UAAU,OAAO;AAC7C,UAAM,gBAAgB,KAAK,sBAAsB,QAAQ,KAAK,aAAa;AAC3E,QAAI,CAAC,eAAe;AACb,YAAA;AAAA,IAAA;AAEF,SAAA,sBAAsB,iBAAiB,aAAa;AAEzD,UAAM,kBAAkB,MAAM,UAAU,eAAe,MAAM;AAC7D,UAAM,MAAM,MAAM,UAAU,KAAK,MAAM;AACjC,UAAA,sBAAsB,KAAK,UAAU;AAErC,UAAA,cAAc,MAAM,UAAU,UAAU,MAAM,QAAQ,CAAC,CAAC,cAAc,iBAAiB,CAAC,CAAC;AAG/F,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,6CAA6C;AACzD,YAAQ,IAAI,wBAAwB,cAAc,IAAI,EAAE;AACxD,YAAQ,IAAI,YAAY,cAAc,QAAQ,EAAE;AAChD,YAAQ,IAAI,cAAc,cAAc,iBAAiB,MAAM,EAAE;AACjE,YAAQ,IAAI,iBAAiBC,UAAA,UAAU,cAAc,KAAK,CAAC,EAAE;AAC7D,YAAQ,IAAI,EAAE;AAGV,QAAA,eAAe,CAAE,MAAM,KAAK,GAAG,WAAW,GAAG,mBAAmB,aAAa,GAAI;AACpF,YAAM,WAAW,mBAAmB;AAAA,IAAA;AAGrC,QAAI,iBAAiB;AACpB,YAAM,SAAS,MAAM,KAAK,yBAAyB,QAAQ;AAAA,QAC1D,OAAO;AAAA,QACP,qBAAqB,CAAC;AAAA,QACtB,mBAAmB,cAAc,4BAA4B;AAAA,MAAA,CAC7D;AACD,UAAI,CAAC,QAAQ;AACZ;AAAA,MAAA;AAAA,IACD;AAGD,QAAI,aAAa;AACZ,UAAA,CAAC,mBAAmB,CAAC,KAAK;AACzB,YAAA,CAAC,QAAQ,MAAM,OAAO;AACnB,gBAAA;AAAA,QAAA;AAEP,gBAAQ,IAAI,yBAAyB;AACrC,gBAAQ,IAAI,kDAAkD;AAC9D,gBAAQ,IAAI,EAAE;AACd,cAAM,EAAE,OAAO,MAAM,QAAQ;AAAA,UAC5B,MAAM;AAAA,UACN,MAAM;AAAA,UACN,SAAS;AAAA,QAAA,CACT;AACD,YAAI,CAAC,IAAI;AACD,iBAAA;AAAA,QAAA;AAAA,MACR;AAEK,YAAA,KAAK,cAAc,OAAO;AAAA,QAC/B,KAAK;AAAA,QACL,MAAM,MAAM,UAAU,MAAM,MAAM;AAAA,MAAA,CAClC;AAAA,IAAA;AAGF,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,uBAAuB;AACnC,YAAQ,IAAI,YAAY,cAAc,QAAQ,EAAE;AAChD,YAAQ,IAAI,cAAc,cAAc,iBAAiB,MAAM,EAAE;AAE1D,WAAA;AAAA,EAAA;AAET;;"}
|
|
@@ -22,21 +22,21 @@ class DeployCommand extends Command {
|
|
|
22
22
|
}
|
|
23
23
|
async execute(input) {
|
|
24
24
|
const dsn = input.getArgument("dsn");
|
|
25
|
-
const
|
|
25
|
+
const adminEndpoint = input.getOption("admin");
|
|
26
|
+
const remoteProject = this.remoteProjectResolver.resolve(dsn, adminEndpoint);
|
|
26
27
|
if (!remoteProject) {
|
|
27
28
|
throw `Project not defined. Please provide DSN or environment variables CONTEMBER_*`;
|
|
28
29
|
}
|
|
29
30
|
this.remoteProjectProvider.setRemoteProject(remoteProject);
|
|
30
|
-
let adminEndpoint = input.getOption("admin");
|
|
31
31
|
const deployMigration = input.getOption("no-migrations") !== true;
|
|
32
32
|
const yes = input.getOption("yes") === true;
|
|
33
33
|
const projectAdminDistDir = this.workspace.adminDistDir;
|
|
34
|
-
const deployAdmin = input.getOption("no-admin") !== true && !!adminEndpoint && !!projectAdminDistDir;
|
|
34
|
+
const deployAdmin = input.getOption("no-admin") !== true && !!remoteProject.adminEndpoint && !!projectAdminDistDir;
|
|
35
35
|
console.log("");
|
|
36
36
|
console.log("Contember project deployment configuration:");
|
|
37
37
|
console.log(`Target project name: ${remoteProject.name}`);
|
|
38
38
|
console.log(`API URL: ${remoteProject.endpoint}`);
|
|
39
|
-
console.log(`Admin URL: ${adminEndpoint ?? "none"}`);
|
|
39
|
+
console.log(`Admin URL: ${remoteProject.adminEndpoint ?? "none"}`);
|
|
40
40
|
console.log(`Deploy token: ${maskToken(remoteProject.token)}`);
|
|
41
41
|
console.log("");
|
|
42
42
|
if (deployAdmin && !await this.fs.pathExists(`${projectAdminDistDir}/index.html`)) {
|
|
@@ -77,7 +77,7 @@ class DeployCommand extends Command {
|
|
|
77
77
|
console.log("");
|
|
78
78
|
console.log("Deployment successful");
|
|
79
79
|
console.log(`API URL: ${remoteProject.endpoint}`);
|
|
80
|
-
console.log(`Admin URL: ${adminEndpoint ?? "none"}`);
|
|
80
|
+
console.log(`Admin URL: ${remoteProject.adminEndpoint ?? "none"}`);
|
|
81
81
|
return 0;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeployCommand.js","sources":["../../../../../../packages/cli/src/commands/deploy/DeployCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport prompts from 'prompts'\nimport { maskToken } from '../../lib/maskToken'\nimport { MigrationExecutionFacade } from '../../lib/migrations/MigrationExecutionFacade'\nimport { AdminDeployer } from '../../lib/admin/AdminDeployer'\nimport { FileSystem } from '../../lib/fs/FileSystem'\nimport { RemoteProject } from '../../lib/project/RemoteProject'\nimport { Workspace } from '../../lib/workspace/Workspace'\nimport { RemoteProjectProvider } from '../../lib/project/RemoteProjectProvider'\nimport { RemoteProjectResolver } from '../../lib/project/RemoteProjectResolver'\n\ntype Args = {\n\tdsn: string\n}\n\ntype Options = {\n\tadmin?: string\n\t['no-admin']?: boolean\n\t['no-migrations']?: boolean\n\troot?: boolean\n\tyes?: boolean\n}\n\nexport class DeployCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly adminDeployer: AdminDeployer,\n\t\tprivate readonly migrationExecutionFacade: MigrationExecutionFacade,\n\t\tprivate readonly fs: FileSystem,\n\t\tprivate readonly remoteProjectProvider: RemoteProjectProvider,\n\t\tprivate readonly remoteProjectResolver: RemoteProjectResolver,\n\t\tprivate readonly workspace: Workspace,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Deploy Contember project')\n\t\tconfiguration.argument('dsn')\n\n\t\tconfiguration.option('admin').valueRequired()\n\t\tconfiguration.option('root').valueNone()\n\t\tconfiguration.option('no-admin').valueNone()\n\t\tconfiguration.option('no-migrations').valueNone()\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void | number> {\n\n\t\tconst dsn = input.getArgument('dsn')\n\t\tconst remoteProject = this.remoteProjectResolver.resolve(dsn)\n\t\tif (!remoteProject) {\n\t\t\tthrow `Project not defined. Please provide DSN or environment variables CONTEMBER_*`\n\t\t}\n\t\tthis.remoteProjectProvider.setRemoteProject(remoteProject)\n\n\t\
|
|
1
|
+
{"version":3,"file":"DeployCommand.js","sources":["../../../../../../packages/cli/src/commands/deploy/DeployCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport prompts from 'prompts'\nimport { maskToken } from '../../lib/maskToken'\nimport { MigrationExecutionFacade } from '../../lib/migrations/MigrationExecutionFacade'\nimport { AdminDeployer } from '../../lib/admin/AdminDeployer'\nimport { FileSystem } from '../../lib/fs/FileSystem'\nimport { RemoteProject } from '../../lib/project/RemoteProject'\nimport { Workspace } from '../../lib/workspace/Workspace'\nimport { RemoteProjectProvider } from '../../lib/project/RemoteProjectProvider'\nimport { RemoteProjectResolver } from '../../lib/project/RemoteProjectResolver'\n\ntype Args = {\n\tdsn: string\n}\n\ntype Options = {\n\tadmin?: string\n\t['no-admin']?: boolean\n\t['no-migrations']?: boolean\n\troot?: boolean\n\tyes?: boolean\n}\n\nexport class DeployCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly adminDeployer: AdminDeployer,\n\t\tprivate readonly migrationExecutionFacade: MigrationExecutionFacade,\n\t\tprivate readonly fs: FileSystem,\n\t\tprivate readonly remoteProjectProvider: RemoteProjectProvider,\n\t\tprivate readonly remoteProjectResolver: RemoteProjectResolver,\n\t\tprivate readonly workspace: Workspace,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Deploy Contember project')\n\t\tconfiguration.argument('dsn')\n\n\t\tconfiguration.option('admin').valueRequired()\n\t\tconfiguration.option('root').valueNone()\n\t\tconfiguration.option('no-admin').valueNone()\n\t\tconfiguration.option('no-migrations').valueNone()\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void | number> {\n\n\t\tconst dsn = input.getArgument('dsn')\n\t\tconst adminEndpoint = input.getOption('admin')\n\t\tconst remoteProject = this.remoteProjectResolver.resolve(dsn, adminEndpoint)\n\t\tif (!remoteProject) {\n\t\t\tthrow `Project not defined. Please provide DSN or environment variables CONTEMBER_*`\n\t\t}\n\t\tthis.remoteProjectProvider.setRemoteProject(remoteProject)\n\n\t\tconst deployMigration = input.getOption('no-migrations') !== true\n\t\tconst yes = input.getOption('yes') === true\n\t\tconst projectAdminDistDir = this.workspace.adminDistDir\n\n\t\tconst deployAdmin = input.getOption('no-admin') !== true && !!remoteProject.adminEndpoint && !!projectAdminDistDir\n\n\n\t\tconsole.log('')\n\t\tconsole.log('Contember project deployment configuration:')\n\t\tconsole.log(`Target project name: ${remoteProject.name}`)\n\t\tconsole.log(`API URL: ${remoteProject.endpoint}`)\n\t\tconsole.log(`Admin URL: ${remoteProject.adminEndpoint ?? 'none'}`)\n\t\tconsole.log(`Deploy token: ${maskToken(remoteProject.token)}`)\n\t\tconsole.log('')\n\n\n\t\tif (deployAdmin && !(await this.fs.pathExists(`${projectAdminDistDir}/index.html`))) {\n\t\t\tthrow `Missing ${projectAdminDistDir}/index.html. Please build admin before deploying.`\n\t\t}\n\n\t\tif (deployMigration) {\n\t\t\tconst result = await this.migrationExecutionFacade.execute({\n\t\t\t\tforce: false,\n\t\t\t\trequireConfirmation: !yes,\n\t\t\t\tadditionalMessage: deployAdmin ? 'Admin will be deployed.' : 'Admin will NOT be deployed.',\n\t\t\t})\n\t\t\tif (!result) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif (deployAdmin) {\n\t\t\tif (!deployMigration && !yes) {\n\t\t\t\tif (!process.stdin.isTTY) {\n\t\t\t\t\tthrow 'TTY not available. Pass --yes option to confirm execution.'\n\t\t\t\t}\n\t\t\t\tconsole.log('Admin will be deployed.')\n\t\t\t\tconsole.log('(to skip this dialog, you can pass --yes option)')\n\t\t\t\tconsole.log('')\n\t\t\t\tconst { ok } = await prompts({\n\t\t\t\t\ttype: 'confirm',\n\t\t\t\t\tname: 'ok',\n\t\t\t\t\tmessage: `Do you want to continue?`,\n\t\t\t\t})\n\t\t\t\tif (!ok) {\n\t\t\t\t\treturn 1\n\t\t\t\t}\n\t\t\t}\n\t\t\tawait this.adminDeployer.deploy({\n\t\t\t\tdir: projectAdminDistDir,\n\t\t\t\troot: input.getOption('root') === true,\n\t\t\t})\n\t\t}\n\n\t\tconsole.log('')\n\t\tconsole.log('Deployment successful')\n\t\tconsole.log(`API URL: ${remoteProject.endpoint}`)\n\t\tconsole.log(`Admin URL: ${remoteProject.adminEndpoint ?? 'none'}`)\n\n\t\treturn 0\n\t}\n}\n"],"names":[],"mappings":";;;AAuBO,MAAM,sBAAsB,QAAuB;AAAA,EACzD,YACkB,eACA,0BACA,IACA,uBACA,uBACA,WAChB;AACK,UAAA;AAPW,SAAA,gBAAA;AACA,SAAA,2BAAA;AACA,SAAA,KAAA;AACA,SAAA,wBAAA;AACA,SAAA,wBAAA;AACA,SAAA,YAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,0BAA0B;AACpD,kBAAc,SAAS,KAAK;AAEd,kBAAA,OAAO,OAAO,EAAE,cAAc;AAC9B,kBAAA,OAAO,MAAM,EAAE,UAAU;AACzB,kBAAA,OAAO,UAAU,EAAE,UAAU;AAC7B,kBAAA,OAAO,eAAe,EAAE,UAAU;AAChD,kBACE,OAAO,KAAK,EACZ,UAAU,EACV,YAAY,8BAA8B;AAAA,EAAA;AAAA,EAG7C,MAAgB,QAAQ,OAAqD;AAEtE,UAAA,MAAM,MAAM,YAAY,KAAK;AAC7B,UAAA,gBAAgB,MAAM,UAAU,OAAO;AAC7C,UAAM,gBAAgB,KAAK,sBAAsB,QAAQ,KAAK,aAAa;AAC3E,QAAI,CAAC,eAAe;AACb,YAAA;AAAA,IAAA;AAEF,SAAA,sBAAsB,iBAAiB,aAAa;AAEzD,UAAM,kBAAkB,MAAM,UAAU,eAAe,MAAM;AAC7D,UAAM,MAAM,MAAM,UAAU,KAAK,MAAM;AACjC,UAAA,sBAAsB,KAAK,UAAU;AAErC,UAAA,cAAc,MAAM,UAAU,UAAU,MAAM,QAAQ,CAAC,CAAC,cAAc,iBAAiB,CAAC,CAAC;AAG/F,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,6CAA6C;AACzD,YAAQ,IAAI,wBAAwB,cAAc,IAAI,EAAE;AACxD,YAAQ,IAAI,YAAY,cAAc,QAAQ,EAAE;AAChD,YAAQ,IAAI,cAAc,cAAc,iBAAiB,MAAM,EAAE;AACjE,YAAQ,IAAI,iBAAiB,UAAU,cAAc,KAAK,CAAC,EAAE;AAC7D,YAAQ,IAAI,EAAE;AAGV,QAAA,eAAe,CAAE,MAAM,KAAK,GAAG,WAAW,GAAG,mBAAmB,aAAa,GAAI;AACpF,YAAM,WAAW,mBAAmB;AAAA,IAAA;AAGrC,QAAI,iBAAiB;AACpB,YAAM,SAAS,MAAM,KAAK,yBAAyB,QAAQ;AAAA,QAC1D,OAAO;AAAA,QACP,qBAAqB,CAAC;AAAA,QACtB,mBAAmB,cAAc,4BAA4B;AAAA,MAAA,CAC7D;AACD,UAAI,CAAC,QAAQ;AACZ;AAAA,MAAA;AAAA,IACD;AAGD,QAAI,aAAa;AACZ,UAAA,CAAC,mBAAmB,CAAC,KAAK;AACzB,YAAA,CAAC,QAAQ,MAAM,OAAO;AACnB,gBAAA;AAAA,QAAA;AAEP,gBAAQ,IAAI,yBAAyB;AACrC,gBAAQ,IAAI,kDAAkD;AAC9D,gBAAQ,IAAI,EAAE;AACd,cAAM,EAAE,OAAO,MAAM,QAAQ;AAAA,UAC5B,MAAM;AAAA,UACN,MAAM;AAAA,UACN,SAAS;AAAA,QAAA,CACT;AACD,YAAI,CAAC,IAAI;AACD,iBAAA;AAAA,QAAA;AAAA,MACR;AAEK,YAAA,KAAK,cAAc,OAAO;AAAA,QAC/B,KAAK;AAAA,QACL,MAAM,MAAM,UAAU,MAAM,MAAM;AAAA,MAAA,CAClC;AAAA,IAAA;AAGF,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,uBAAuB;AACnC,YAAQ,IAAI,YAAY,cAAc,QAAQ,EAAE;AAChD,YAAQ,IAAI,cAAc,cAAc,iBAAiB,MAAM,EAAE;AAE1D,WAAA;AAAA,EAAA;AAET;"}
|
|
@@ -79,7 +79,7 @@ class MigrationAmendCommand extends cliCommon.Command {
|
|
|
79
79
|
const systemClient = this.systemApiClientProvider.get();
|
|
80
80
|
await systemClient.migrate([intermediateResult.migration], force);
|
|
81
81
|
await systemClient.migrationDelete(intermediateResult.migration.version);
|
|
82
|
-
if (!newMigrationResult) {
|
|
82
|
+
if (!newMigrationResult && await this.shouldRemove()) {
|
|
83
83
|
await this.migrationCreator.removeMigration(amendMigration.name);
|
|
84
84
|
await systemClient.migrationDelete(amendMigration.version);
|
|
85
85
|
console.log("Latest migration was removed");
|
|
@@ -88,8 +88,8 @@ class MigrationAmendCommand extends cliCommon.Command {
|
|
|
88
88
|
const newMigration = {
|
|
89
89
|
name: amendMigration.name,
|
|
90
90
|
version: amendMigration.version,
|
|
91
|
-
formatVersion: newMigrationResult
|
|
92
|
-
modifications: newMigrationResult
|
|
91
|
+
formatVersion: newMigrationResult?.migration.formatVersion ?? amendMigration.formatVersion,
|
|
92
|
+
modifications: newMigrationResult?.migration.modifications ?? []
|
|
93
93
|
};
|
|
94
94
|
await this.migrationCreator.saveMigration(newMigration);
|
|
95
95
|
await systemClient.migrationModify(amendMigration.version, newMigration);
|
|
@@ -118,6 +118,18 @@ class MigrationAmendCommand extends cliCommon.Command {
|
|
|
118
118
|
});
|
|
119
119
|
return action === "yes";
|
|
120
120
|
}
|
|
121
|
+
async shouldRemove() {
|
|
122
|
+
const { action } = await prompts({
|
|
123
|
+
type: "select",
|
|
124
|
+
name: "action",
|
|
125
|
+
message: "The amendment results in a no-op migration because the changes introduced by the latest migration were reverted.\nYou can choose to remove the latest migration or to modify it so it is empty.",
|
|
126
|
+
choices: [
|
|
127
|
+
{ value: "remove", title: "Remove latest migration" },
|
|
128
|
+
{ value: "keep", title: "Keep latest migration and make it empty" }
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
return action === "remove";
|
|
132
|
+
}
|
|
121
133
|
}
|
|
122
134
|
exports.MigrationAmendCommand = MigrationAmendCommand;
|
|
123
135
|
//# sourceMappingURL=MigrationAmendCommand.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationAmendCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationAmendCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { InvalidSchemaException, SchemaMigrator } from '@contember/schema-migrations'\nimport prompts from 'prompts'\nimport { emptySchema } from '@contember/schema-utils'\nimport { MigrationCreator, MigrationsResolver, SchemaVersionBuilder, SystemClient } from '@contember/migrations-client'\nimport { MigrationsStatusFacade } from '../../lib/migrations/MigrationsStatusFacade'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { MigrationsValidator } from '../../lib/migrations/MigrationsValidator'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { printValidationErrors } from '../../lib/schema/SchemaValidationPrinter'\nimport { SystemClientProvider } from '../../lib/SystemClientProvider'\n\ntype Args = {\n\tmigration?: string\n}\n\ntype Options = {\n\tyes?: true\n\tforce: boolean\n}\n\nexport class MigrationAmendCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly systemApiClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationsStatusFacade: MigrationsStatusFacade,\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationCreator: MigrationCreator,\n\t\tprivate readonly migrationsValidator: MigrationsValidator,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t\tprivate readonly schemaMigrator: SchemaMigrator,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Amends latest migration')\n\t\tconfiguration.argument('migration').optional()\n\t\tconfiguration.option('force').description('Ignore migrations order and missing migrations (dev only)')\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst migrationName = input.getArgument('migration')\n\t\tconst amendMigration = migrationName\n\t\t\t? await this.migrationsResolver.findSchemaMigrationByVersion(migrationName)\n\t\t\t: await this.migrationsResolver.findLatestSchemaMigration()\n\t\tif (!amendMigration) {\n\t\t\tthrow 'No migration to amend'\n\t\t}\n\t\tconst force = input.getOption('force')\n\t\tconst status = await this.migrationsStatusFacade.resolveMigrationsStatus({ force })\n\t\tif (status.migrationsToExecute.length > 0) {\n\t\t\tthrow `Some migrations are not executed. Unable to amend.`\n\t\t}\n\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\ttry {\n\t\t\tconst initialSchema = await this.schemaVersionBuilder.buildSchema()\n\t\t\tconst intermediateResult = await this.migrationCreator.prepareMigration(initialSchema, schema, '')\n\t\t\tif (intermediateResult === null) {\n\t\t\t\tconsole.log('Nothing to do')\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tif (amendMigration.formatVersion !== intermediateResult.migration.formatVersion) {\n\t\t\t\tthrow 'Incompatible migration format version'\n\t\t\t}\n\t\t\tconst prevSchema = await this.schemaVersionBuilder.buildSchemaAdvanced(\n\t\t\t\temptySchema,\n\t\t\t\tversion => version < amendMigration.version,\n\t\t\t)\n\t\t\tconst newSchema = await this.schemaMigrator.applyModifications(\n\t\t\t\tprevSchema,\n\t\t\t\t[...amendMigration.modifications, ...intermediateResult.migration.modifications],\n\t\t\t\tamendMigration.formatVersion,\n\t\t\t)\n\t\t\tconst newMigrationResult = await this.migrationCreator.prepareMigration(prevSchema, newSchema, '')\n\t\t\tconst followingMigrations = (await this.migrationsResolver.getSchemaMigrations()).filter(\n\t\t\t\tit => it.version > amendMigration.version,\n\t\t\t)\n\n\t\t\tconst valid = await this.migrationsValidator.validate(\n\t\t\t\tprevSchema,\n\t\t\t\t[...(newMigrationResult ? [newMigrationResult.migration] : []), ...followingMigrations],\n\t\t\t)\n\t\t\tif (!valid) {\n\t\t\t\tthrow `Cannot amend migration`\n\t\t\t}\n\n\t\t\tthis.migrationPrinter.printMigrationDescription(\n\t\t\t\tintermediateResult.initialSchema,\n\t\t\t\tintermediateResult.migration,\n\t\t\t\t{ noSql: true },\n\t\t\t)\n\t\t\tconsole.log(`Amending ${amendMigration.name}`)\n\t\t\tif (!(await this.shouldContinue(input))) {\n\t\t\t\tconsole.log('Aborting')\n\t\t\t\treturn 1\n\t\t\t}\n\t\t\tconst systemClient = this.systemApiClientProvider.get()\n\t\t\tawait systemClient.migrate([intermediateResult.migration], force)\n\t\t\tawait systemClient.migrationDelete(intermediateResult.migration.version)\n\n\t\t\tif (!newMigrationResult) {\n\t\t\t\tawait this.migrationCreator.removeMigration(amendMigration.name)\n\t\t\t\tawait systemClient.migrationDelete(amendMigration.version)\n\t\t\t\tconsole.log('Latest migration was removed')\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tconst newMigration = {\n\t\t\t\tname: amendMigration.name,\n\t\t\t\tversion: amendMigration.version,\n\t\t\t\tformatVersion: newMigrationResult
|
|
1
|
+
{"version":3,"file":"MigrationAmendCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationAmendCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { InvalidSchemaException, SchemaMigrator } from '@contember/schema-migrations'\nimport prompts from 'prompts'\nimport { emptySchema } from '@contember/schema-utils'\nimport { MigrationCreator, MigrationsResolver, SchemaVersionBuilder, SystemClient } from '@contember/migrations-client'\nimport { MigrationsStatusFacade } from '../../lib/migrations/MigrationsStatusFacade'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { MigrationsValidator } from '../../lib/migrations/MigrationsValidator'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { printValidationErrors } from '../../lib/schema/SchemaValidationPrinter'\nimport { SystemClientProvider } from '../../lib/SystemClientProvider'\n\ntype Args = {\n\tmigration?: string\n}\n\ntype Options = {\n\tyes?: true\n\tforce: boolean\n}\n\nexport class MigrationAmendCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly systemApiClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationsStatusFacade: MigrationsStatusFacade,\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationCreator: MigrationCreator,\n\t\tprivate readonly migrationsValidator: MigrationsValidator,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t\tprivate readonly schemaMigrator: SchemaMigrator,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Amends latest migration')\n\t\tconfiguration.argument('migration').optional()\n\t\tconfiguration.option('force').description('Ignore migrations order and missing migrations (dev only)')\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst migrationName = input.getArgument('migration')\n\t\tconst amendMigration = migrationName\n\t\t\t? await this.migrationsResolver.findSchemaMigrationByVersion(migrationName)\n\t\t\t: await this.migrationsResolver.findLatestSchemaMigration()\n\t\tif (!amendMigration) {\n\t\t\tthrow 'No migration to amend'\n\t\t}\n\t\tconst force = input.getOption('force')\n\t\tconst status = await this.migrationsStatusFacade.resolveMigrationsStatus({ force })\n\t\tif (status.migrationsToExecute.length > 0) {\n\t\t\tthrow `Some migrations are not executed. Unable to amend.`\n\t\t}\n\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\ttry {\n\t\t\tconst initialSchema = await this.schemaVersionBuilder.buildSchema()\n\t\t\tconst intermediateResult = await this.migrationCreator.prepareMigration(initialSchema, schema, '')\n\t\t\tif (intermediateResult === null) {\n\t\t\t\tconsole.log('Nothing to do')\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tif (amendMigration.formatVersion !== intermediateResult.migration.formatVersion) {\n\t\t\t\tthrow 'Incompatible migration format version'\n\t\t\t}\n\t\t\tconst prevSchema = await this.schemaVersionBuilder.buildSchemaAdvanced(\n\t\t\t\temptySchema,\n\t\t\t\tversion => version < amendMigration.version,\n\t\t\t)\n\t\t\tconst newSchema = await this.schemaMigrator.applyModifications(\n\t\t\t\tprevSchema,\n\t\t\t\t[...amendMigration.modifications, ...intermediateResult.migration.modifications],\n\t\t\t\tamendMigration.formatVersion,\n\t\t\t)\n\t\t\tconst newMigrationResult = await this.migrationCreator.prepareMigration(prevSchema, newSchema, '')\n\t\t\tconst followingMigrations = (await this.migrationsResolver.getSchemaMigrations()).filter(\n\t\t\t\tit => it.version > amendMigration.version,\n\t\t\t)\n\n\t\t\tconst valid = await this.migrationsValidator.validate(\n\t\t\t\tprevSchema,\n\t\t\t\t[...(newMigrationResult ? [newMigrationResult.migration] : []), ...followingMigrations],\n\t\t\t)\n\t\t\tif (!valid) {\n\t\t\t\tthrow `Cannot amend migration`\n\t\t\t}\n\n\t\t\tthis.migrationPrinter.printMigrationDescription(\n\t\t\t\tintermediateResult.initialSchema,\n\t\t\t\tintermediateResult.migration,\n\t\t\t\t{ noSql: true },\n\t\t\t)\n\t\t\tconsole.log(`Amending ${amendMigration.name}`)\n\t\t\tif (!(await this.shouldContinue(input))) {\n\t\t\t\tconsole.log('Aborting')\n\t\t\t\treturn 1\n\t\t\t}\n\t\t\tconst systemClient = this.systemApiClientProvider.get()\n\t\t\tawait systemClient.migrate([intermediateResult.migration], force)\n\t\t\tawait systemClient.migrationDelete(intermediateResult.migration.version)\n\n\t\t\tif (!newMigrationResult && await this.shouldRemove()) {\n\t\t\t\tawait this.migrationCreator.removeMigration(amendMigration.name)\n\t\t\t\tawait systemClient.migrationDelete(amendMigration.version)\n\t\t\t\tconsole.log('Latest migration was removed')\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tconst newMigration = {\n\t\t\t\tname: amendMigration.name,\n\t\t\t\tversion: amendMigration.version,\n\t\t\t\tformatVersion: newMigrationResult?.migration.formatVersion ?? amendMigration.formatVersion,\n\t\t\t\tmodifications: newMigrationResult?.migration.modifications ?? [],\n\t\t\t}\n\t\t\tawait this.migrationCreator.saveMigration(newMigration)\n\t\t\tawait systemClient.migrationModify(amendMigration.version, newMigration)\n\n\t\t\treturn 0\n\t\t} catch (e) {\n\t\t\tif (e instanceof InvalidSchemaException) {\n\t\t\t\tprintValidationErrors(e.validationErrors, e.message)\n\t\t\t\treturn 1\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\t}\n\n\tprivate async shouldContinue(input: Input<{}, { yes?: true }>): Promise<boolean> {\n\t\tconst yes = input.getOption('yes')\n\t\tif (yes) {\n\t\t\treturn true\n\t\t}\n\t\tconst { action } = await prompts({\n\t\t\ttype: 'select',\n\t\t\tname: 'action',\n\t\t\tmessage: 'Do you want to continue?',\n\t\t\tchoices: [\n\t\t\t\t{ value: 'yes', title: 'Yes' },\n\t\t\t\t{ value: 'no', title: 'Abort' },\n\t\t\t],\n\t\t})\n\t\treturn action === 'yes'\n\t}\n\n\tprivate async shouldRemove(): Promise<boolean> {\n\t\tconst { action } = await prompts({\n\t\t\ttype: 'select',\n\t\t\tname: 'action',\n\t\t\tmessage: 'The amendment results in a no-op migration because the changes introduced by the latest migration were reverted.\\nYou can choose to remove the latest migration or to modify it so it is empty.',\n\t\t\tchoices: [\n\t\t\t\t{ value: 'remove', title: 'Remove latest migration' },\n\t\t\t\t{ value: 'keep', title: 'Keep latest migration and make it empty' },\n\t\t\t],\n\t\t})\n\t\treturn action === 'remove'\n\t}\n}\n"],"names":["Command","emptySchema","InvalidSchemaException","printValidationErrors"],"mappings":"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"}
|
|
@@ -77,7 +77,7 @@ class MigrationAmendCommand extends Command {
|
|
|
77
77
|
const systemClient = this.systemApiClientProvider.get();
|
|
78
78
|
await systemClient.migrate([intermediateResult.migration], force);
|
|
79
79
|
await systemClient.migrationDelete(intermediateResult.migration.version);
|
|
80
|
-
if (!newMigrationResult) {
|
|
80
|
+
if (!newMigrationResult && await this.shouldRemove()) {
|
|
81
81
|
await this.migrationCreator.removeMigration(amendMigration.name);
|
|
82
82
|
await systemClient.migrationDelete(amendMigration.version);
|
|
83
83
|
console.log("Latest migration was removed");
|
|
@@ -86,8 +86,8 @@ class MigrationAmendCommand extends Command {
|
|
|
86
86
|
const newMigration = {
|
|
87
87
|
name: amendMigration.name,
|
|
88
88
|
version: amendMigration.version,
|
|
89
|
-
formatVersion: newMigrationResult
|
|
90
|
-
modifications: newMigrationResult
|
|
89
|
+
formatVersion: newMigrationResult?.migration.formatVersion ?? amendMigration.formatVersion,
|
|
90
|
+
modifications: newMigrationResult?.migration.modifications ?? []
|
|
91
91
|
};
|
|
92
92
|
await this.migrationCreator.saveMigration(newMigration);
|
|
93
93
|
await systemClient.migrationModify(amendMigration.version, newMigration);
|
|
@@ -116,6 +116,18 @@ class MigrationAmendCommand extends Command {
|
|
|
116
116
|
});
|
|
117
117
|
return action === "yes";
|
|
118
118
|
}
|
|
119
|
+
async shouldRemove() {
|
|
120
|
+
const { action } = await prompts({
|
|
121
|
+
type: "select",
|
|
122
|
+
name: "action",
|
|
123
|
+
message: "The amendment results in a no-op migration because the changes introduced by the latest migration were reverted.\nYou can choose to remove the latest migration or to modify it so it is empty.",
|
|
124
|
+
choices: [
|
|
125
|
+
{ value: "remove", title: "Remove latest migration" },
|
|
126
|
+
{ value: "keep", title: "Keep latest migration and make it empty" }
|
|
127
|
+
]
|
|
128
|
+
});
|
|
129
|
+
return action === "remove";
|
|
130
|
+
}
|
|
119
131
|
}
|
|
120
132
|
export {
|
|
121
133
|
MigrationAmendCommand
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationAmendCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationAmendCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { InvalidSchemaException, SchemaMigrator } from '@contember/schema-migrations'\nimport prompts from 'prompts'\nimport { emptySchema } from '@contember/schema-utils'\nimport { MigrationCreator, MigrationsResolver, SchemaVersionBuilder, SystemClient } from '@contember/migrations-client'\nimport { MigrationsStatusFacade } from '../../lib/migrations/MigrationsStatusFacade'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { MigrationsValidator } from '../../lib/migrations/MigrationsValidator'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { printValidationErrors } from '../../lib/schema/SchemaValidationPrinter'\nimport { SystemClientProvider } from '../../lib/SystemClientProvider'\n\ntype Args = {\n\tmigration?: string\n}\n\ntype Options = {\n\tyes?: true\n\tforce: boolean\n}\n\nexport class MigrationAmendCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly systemApiClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationsStatusFacade: MigrationsStatusFacade,\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationCreator: MigrationCreator,\n\t\tprivate readonly migrationsValidator: MigrationsValidator,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t\tprivate readonly schemaMigrator: SchemaMigrator,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Amends latest migration')\n\t\tconfiguration.argument('migration').optional()\n\t\tconfiguration.option('force').description('Ignore migrations order and missing migrations (dev only)')\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst migrationName = input.getArgument('migration')\n\t\tconst amendMigration = migrationName\n\t\t\t? await this.migrationsResolver.findSchemaMigrationByVersion(migrationName)\n\t\t\t: await this.migrationsResolver.findLatestSchemaMigration()\n\t\tif (!amendMigration) {\n\t\t\tthrow 'No migration to amend'\n\t\t}\n\t\tconst force = input.getOption('force')\n\t\tconst status = await this.migrationsStatusFacade.resolveMigrationsStatus({ force })\n\t\tif (status.migrationsToExecute.length > 0) {\n\t\t\tthrow `Some migrations are not executed. Unable to amend.`\n\t\t}\n\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\ttry {\n\t\t\tconst initialSchema = await this.schemaVersionBuilder.buildSchema()\n\t\t\tconst intermediateResult = await this.migrationCreator.prepareMigration(initialSchema, schema, '')\n\t\t\tif (intermediateResult === null) {\n\t\t\t\tconsole.log('Nothing to do')\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tif (amendMigration.formatVersion !== intermediateResult.migration.formatVersion) {\n\t\t\t\tthrow 'Incompatible migration format version'\n\t\t\t}\n\t\t\tconst prevSchema = await this.schemaVersionBuilder.buildSchemaAdvanced(\n\t\t\t\temptySchema,\n\t\t\t\tversion => version < amendMigration.version,\n\t\t\t)\n\t\t\tconst newSchema = await this.schemaMigrator.applyModifications(\n\t\t\t\tprevSchema,\n\t\t\t\t[...amendMigration.modifications, ...intermediateResult.migration.modifications],\n\t\t\t\tamendMigration.formatVersion,\n\t\t\t)\n\t\t\tconst newMigrationResult = await this.migrationCreator.prepareMigration(prevSchema, newSchema, '')\n\t\t\tconst followingMigrations = (await this.migrationsResolver.getSchemaMigrations()).filter(\n\t\t\t\tit => it.version > amendMigration.version,\n\t\t\t)\n\n\t\t\tconst valid = await this.migrationsValidator.validate(\n\t\t\t\tprevSchema,\n\t\t\t\t[...(newMigrationResult ? [newMigrationResult.migration] : []), ...followingMigrations],\n\t\t\t)\n\t\t\tif (!valid) {\n\t\t\t\tthrow `Cannot amend migration`\n\t\t\t}\n\n\t\t\tthis.migrationPrinter.printMigrationDescription(\n\t\t\t\tintermediateResult.initialSchema,\n\t\t\t\tintermediateResult.migration,\n\t\t\t\t{ noSql: true },\n\t\t\t)\n\t\t\tconsole.log(`Amending ${amendMigration.name}`)\n\t\t\tif (!(await this.shouldContinue(input))) {\n\t\t\t\tconsole.log('Aborting')\n\t\t\t\treturn 1\n\t\t\t}\n\t\t\tconst systemClient = this.systemApiClientProvider.get()\n\t\t\tawait systemClient.migrate([intermediateResult.migration], force)\n\t\t\tawait systemClient.migrationDelete(intermediateResult.migration.version)\n\n\t\t\tif (!newMigrationResult) {\n\t\t\t\tawait this.migrationCreator.removeMigration(amendMigration.name)\n\t\t\t\tawait systemClient.migrationDelete(amendMigration.version)\n\t\t\t\tconsole.log('Latest migration was removed')\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tconst newMigration = {\n\t\t\t\tname: amendMigration.name,\n\t\t\t\tversion: amendMigration.version,\n\t\t\t\tformatVersion: newMigrationResult
|
|
1
|
+
{"version":3,"file":"MigrationAmendCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationAmendCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { InvalidSchemaException, SchemaMigrator } from '@contember/schema-migrations'\nimport prompts from 'prompts'\nimport { emptySchema } from '@contember/schema-utils'\nimport { MigrationCreator, MigrationsResolver, SchemaVersionBuilder, SystemClient } from '@contember/migrations-client'\nimport { MigrationsStatusFacade } from '../../lib/migrations/MigrationsStatusFacade'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { MigrationsValidator } from '../../lib/migrations/MigrationsValidator'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { printValidationErrors } from '../../lib/schema/SchemaValidationPrinter'\nimport { SystemClientProvider } from '../../lib/SystemClientProvider'\n\ntype Args = {\n\tmigration?: string\n}\n\ntype Options = {\n\tyes?: true\n\tforce: boolean\n}\n\nexport class MigrationAmendCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly systemApiClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationsStatusFacade: MigrationsStatusFacade,\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationCreator: MigrationCreator,\n\t\tprivate readonly migrationsValidator: MigrationsValidator,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t\tprivate readonly schemaMigrator: SchemaMigrator,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Amends latest migration')\n\t\tconfiguration.argument('migration').optional()\n\t\tconfiguration.option('force').description('Ignore migrations order and missing migrations (dev only)')\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst migrationName = input.getArgument('migration')\n\t\tconst amendMigration = migrationName\n\t\t\t? await this.migrationsResolver.findSchemaMigrationByVersion(migrationName)\n\t\t\t: await this.migrationsResolver.findLatestSchemaMigration()\n\t\tif (!amendMigration) {\n\t\t\tthrow 'No migration to amend'\n\t\t}\n\t\tconst force = input.getOption('force')\n\t\tconst status = await this.migrationsStatusFacade.resolveMigrationsStatus({ force })\n\t\tif (status.migrationsToExecute.length > 0) {\n\t\t\tthrow `Some migrations are not executed. Unable to amend.`\n\t\t}\n\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\ttry {\n\t\t\tconst initialSchema = await this.schemaVersionBuilder.buildSchema()\n\t\t\tconst intermediateResult = await this.migrationCreator.prepareMigration(initialSchema, schema, '')\n\t\t\tif (intermediateResult === null) {\n\t\t\t\tconsole.log('Nothing to do')\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tif (amendMigration.formatVersion !== intermediateResult.migration.formatVersion) {\n\t\t\t\tthrow 'Incompatible migration format version'\n\t\t\t}\n\t\t\tconst prevSchema = await this.schemaVersionBuilder.buildSchemaAdvanced(\n\t\t\t\temptySchema,\n\t\t\t\tversion => version < amendMigration.version,\n\t\t\t)\n\t\t\tconst newSchema = await this.schemaMigrator.applyModifications(\n\t\t\t\tprevSchema,\n\t\t\t\t[...amendMigration.modifications, ...intermediateResult.migration.modifications],\n\t\t\t\tamendMigration.formatVersion,\n\t\t\t)\n\t\t\tconst newMigrationResult = await this.migrationCreator.prepareMigration(prevSchema, newSchema, '')\n\t\t\tconst followingMigrations = (await this.migrationsResolver.getSchemaMigrations()).filter(\n\t\t\t\tit => it.version > amendMigration.version,\n\t\t\t)\n\n\t\t\tconst valid = await this.migrationsValidator.validate(\n\t\t\t\tprevSchema,\n\t\t\t\t[...(newMigrationResult ? [newMigrationResult.migration] : []), ...followingMigrations],\n\t\t\t)\n\t\t\tif (!valid) {\n\t\t\t\tthrow `Cannot amend migration`\n\t\t\t}\n\n\t\t\tthis.migrationPrinter.printMigrationDescription(\n\t\t\t\tintermediateResult.initialSchema,\n\t\t\t\tintermediateResult.migration,\n\t\t\t\t{ noSql: true },\n\t\t\t)\n\t\t\tconsole.log(`Amending ${amendMigration.name}`)\n\t\t\tif (!(await this.shouldContinue(input))) {\n\t\t\t\tconsole.log('Aborting')\n\t\t\t\treturn 1\n\t\t\t}\n\t\t\tconst systemClient = this.systemApiClientProvider.get()\n\t\t\tawait systemClient.migrate([intermediateResult.migration], force)\n\t\t\tawait systemClient.migrationDelete(intermediateResult.migration.version)\n\n\t\t\tif (!newMigrationResult && await this.shouldRemove()) {\n\t\t\t\tawait this.migrationCreator.removeMigration(amendMigration.name)\n\t\t\t\tawait systemClient.migrationDelete(amendMigration.version)\n\t\t\t\tconsole.log('Latest migration was removed')\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tconst newMigration = {\n\t\t\t\tname: amendMigration.name,\n\t\t\t\tversion: amendMigration.version,\n\t\t\t\tformatVersion: newMigrationResult?.migration.formatVersion ?? amendMigration.formatVersion,\n\t\t\t\tmodifications: newMigrationResult?.migration.modifications ?? [],\n\t\t\t}\n\t\t\tawait this.migrationCreator.saveMigration(newMigration)\n\t\t\tawait systemClient.migrationModify(amendMigration.version, newMigration)\n\n\t\t\treturn 0\n\t\t} catch (e) {\n\t\t\tif (e instanceof InvalidSchemaException) {\n\t\t\t\tprintValidationErrors(e.validationErrors, e.message)\n\t\t\t\treturn 1\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\t}\n\n\tprivate async shouldContinue(input: Input<{}, { yes?: true }>): Promise<boolean> {\n\t\tconst yes = input.getOption('yes')\n\t\tif (yes) {\n\t\t\treturn true\n\t\t}\n\t\tconst { action } = await prompts({\n\t\t\ttype: 'select',\n\t\t\tname: 'action',\n\t\t\tmessage: 'Do you want to continue?',\n\t\t\tchoices: [\n\t\t\t\t{ value: 'yes', title: 'Yes' },\n\t\t\t\t{ value: 'no', title: 'Abort' },\n\t\t\t],\n\t\t})\n\t\treturn action === 'yes'\n\t}\n\n\tprivate async shouldRemove(): Promise<boolean> {\n\t\tconst { action } = await prompts({\n\t\t\ttype: 'select',\n\t\t\tname: 'action',\n\t\t\tmessage: 'The amendment results in a no-op migration because the changes introduced by the latest migration were reverted.\\nYou can choose to remove the latest migration or to modify it so it is empty.',\n\t\t\tchoices: [\n\t\t\t\t{ value: 'remove', title: 'Remove latest migration' },\n\t\t\t\t{ value: 'keep', title: 'Keep latest migration and make it empty' },\n\t\t\t],\n\t\t})\n\t\treturn action === 'remove'\n\t}\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationBlankCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationBlankCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationCreator } from '@contember/migrations-client'\n\ntype Args = {\n\tmigrationName: string\n\tformat?: string\n}\n\ntype Options = {\n}\n\nexport class MigrationBlankCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationCreator: MigrationCreator,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates new blank migration file')\n\t\tconfiguration.argument('migrationName')\n\t\tconfiguration.argument('format').optional().validator(it => !it || ['js', 'ts', 'json'].includes(it))\n\t\t\t.description('Migration file format (js, ts, json), default is ts.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst migrationName = input.getArgument('migrationName')\n\t\tconst migrationFormat = input.getArgument('format') || 'ts'\n\t\tconst filename = await this.migrationCreator.createEmptyMigrationFile(migrationName, migrationFormat)\n\t\tconsole.log(`${filename} created`)\n\t\treturn 0\n\t}\n}\n\n"],"names":["Command"],"mappings":";;;AAWO,MAAM,8BAA8BA,UAAAA,QAAuB;AAAA,EACjE,YACkB,kBAChB;AACK;AAFW,SAAA,mBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"MigrationBlankCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationBlankCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationCreator } from '@contember/migrations-client'\n\ntype Args = {\n\tmigrationName: string\n\tformat?: string\n}\n\ntype Options = {\n}\n\nexport class MigrationBlankCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationCreator: MigrationCreator,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates new blank migration file')\n\t\tconfiguration.argument('migrationName')\n\t\tconfiguration.argument('format').optional().validator(it => !it || ['js', 'ts', 'json'].includes(it))\n\t\t\t.description('Migration file format (js, ts, json), default is ts.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst migrationName = input.getArgument('migrationName')\n\t\tconst migrationFormat = input.getArgument('format') || 'ts'\n\t\tconst filename = await this.migrationCreator.createEmptyMigrationFile(migrationName, migrationFormat)\n\t\tconsole.log(`${filename} created`)\n\t\treturn 0\n\t}\n}\n\n"],"names":["Command"],"mappings":";;;AAWO,MAAM,8BAA8BA,UAAAA,QAAuB;AAAA,EACjE,YACkB,kBAChB;AACK,UAAA;AAFW,SAAA,mBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,kCAAkC;AAC5D,kBAAc,SAAS,eAAe;AACtC,kBAAc,SAAS,QAAQ,EAAE,WAAW,UAAU,QAAM,CAAC,MAAM,CAAC,MAAM,MAAM,MAAM,EAAE,SAAS,EAAE,CAAC,EAClG,YAAY,sDAAsD;AAAA,EAAA;AAAA,EAGrE,MAAgB,QAAQ,OAA8C;AAC/D,UAAA,gBAAgB,MAAM,YAAY,eAAe;AACvD,UAAM,kBAAkB,MAAM,YAAY,QAAQ,KAAK;AACvD,UAAM,WAAW,MAAM,KAAK,iBAAiB,yBAAyB,eAAe,eAAe;AAC5F,YAAA,IAAI,GAAG,QAAQ,UAAU;AAC1B,WAAA;AAAA,EAAA;AAET;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationBlankCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationBlankCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationCreator } from '@contember/migrations-client'\n\ntype Args = {\n\tmigrationName: string\n\tformat?: string\n}\n\ntype Options = {\n}\n\nexport class MigrationBlankCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationCreator: MigrationCreator,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates new blank migration file')\n\t\tconfiguration.argument('migrationName')\n\t\tconfiguration.argument('format').optional().validator(it => !it || ['js', 'ts', 'json'].includes(it))\n\t\t\t.description('Migration file format (js, ts, json), default is ts.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst migrationName = input.getArgument('migrationName')\n\t\tconst migrationFormat = input.getArgument('format') || 'ts'\n\t\tconst filename = await this.migrationCreator.createEmptyMigrationFile(migrationName, migrationFormat)\n\t\tconsole.log(`${filename} created`)\n\t\treturn 0\n\t}\n}\n\n"],"names":[],"mappings":";AAWO,MAAM,8BAA8B,QAAuB;AAAA,EACjE,YACkB,kBAChB;AACK;AAFW,SAAA,mBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"MigrationBlankCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationBlankCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationCreator } from '@contember/migrations-client'\n\ntype Args = {\n\tmigrationName: string\n\tformat?: string\n}\n\ntype Options = {\n}\n\nexport class MigrationBlankCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationCreator: MigrationCreator,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates new blank migration file')\n\t\tconfiguration.argument('migrationName')\n\t\tconfiguration.argument('format').optional().validator(it => !it || ['js', 'ts', 'json'].includes(it))\n\t\t\t.description('Migration file format (js, ts, json), default is ts.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst migrationName = input.getArgument('migrationName')\n\t\tconst migrationFormat = input.getArgument('format') || 'ts'\n\t\tconst filename = await this.migrationCreator.createEmptyMigrationFile(migrationName, migrationFormat)\n\t\tconsole.log(`${filename} created`)\n\t\treturn 0\n\t}\n}\n\n"],"names":[],"mappings":";AAWO,MAAM,8BAA8B,QAAuB;AAAA,EACjE,YACkB,kBAChB;AACK,UAAA;AAFW,SAAA,mBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,kCAAkC;AAC5D,kBAAc,SAAS,eAAe;AACtC,kBAAc,SAAS,QAAQ,EAAE,WAAW,UAAU,QAAM,CAAC,MAAM,CAAC,MAAM,MAAM,MAAM,EAAE,SAAS,EAAE,CAAC,EAClG,YAAY,sDAAsD;AAAA,EAAA;AAAA,EAGrE,MAAgB,QAAQ,OAA8C;AAC/D,UAAA,gBAAgB,MAAM,YAAY,eAAe;AACvD,UAAM,kBAAkB,MAAM,YAAY,QAAQ,KAAK;AACvD,UAAM,WAAW,MAAM,KAAK,iBAAiB,yBAAyB,eAAe,eAAe;AAC5F,YAAA,IAAI,GAAG,QAAQ,UAAU;AAC1B,WAAA;AAAA,EAAA;AAET;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationDescribeCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationDescribeCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { MigrationsResolver, SchemaVersionBuilder } from '@contember/migrations-client'\n\ntype Args = {\n\tmigration?: string\n}\n\ntype Options = {\n\t['sql-only']: boolean\n\t['no-sql']: boolean\n}\n\n\nexport class MigrationDescribeCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Describes a migration')\n\t\tconfiguration.argument('migration').optional()\n\t\tconfiguration.option('sql-only').valueNone()\n\t\tconfiguration.option('no-sql').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst migrationArg = input.getArgument('migration')\n\t\tconst sqlOnly = input.getOption('sql-only')\n\t\tconst noSql = input.getOption('no-sql')\n\n\t\tconst migration = migrationArg\n\t\t\t? await this.migrationsResolver.findSchemaMigrationByVersion(migrationArg)\n\t\t\t: await this.migrationsResolver.findLatestSchemaMigration()\n\n\t\tif (!migration) {\n\t\t\tthrow 'Undefined migration'\n\t\t}\n\t\tconst schema = await this.schemaVersionBuilder.buildSchemaUntil(migration.version)\n\t\tthis.migrationPrinter.printMigrationDescription(schema, migration, { sqlOnly, noSql })\n\t}\n}\n"],"names":["Command"],"mappings":";;;AAcO,MAAM,iCAAiCA,UAAAA,QAAuB;AAAA,EACpE,YACkB,kBACA,sBACA,oBAChB;AACK;AAJW,SAAA,mBAAA;AACA,SAAA,uBAAA;AACA,SAAA,qBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"MigrationDescribeCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationDescribeCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { MigrationsResolver, SchemaVersionBuilder } from '@contember/migrations-client'\n\ntype Args = {\n\tmigration?: string\n}\n\ntype Options = {\n\t['sql-only']: boolean\n\t['no-sql']: boolean\n}\n\n\nexport class MigrationDescribeCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Describes a migration')\n\t\tconfiguration.argument('migration').optional()\n\t\tconfiguration.option('sql-only').valueNone()\n\t\tconfiguration.option('no-sql').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst migrationArg = input.getArgument('migration')\n\t\tconst sqlOnly = input.getOption('sql-only')\n\t\tconst noSql = input.getOption('no-sql')\n\n\t\tconst migration = migrationArg\n\t\t\t? await this.migrationsResolver.findSchemaMigrationByVersion(migrationArg)\n\t\t\t: await this.migrationsResolver.findLatestSchemaMigration()\n\n\t\tif (!migration) {\n\t\t\tthrow 'Undefined migration'\n\t\t}\n\t\tconst schema = await this.schemaVersionBuilder.buildSchemaUntil(migration.version)\n\t\tthis.migrationPrinter.printMigrationDescription(schema, migration, { sqlOnly, noSql })\n\t}\n}\n"],"names":["Command"],"mappings":";;;AAcO,MAAM,iCAAiCA,UAAAA,QAAuB;AAAA,EACpE,YACkB,kBACA,sBACA,oBAChB;AACK,UAAA;AAJW,SAAA,mBAAA;AACA,SAAA,uBAAA;AACA,SAAA,qBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,uBAAuB;AACnC,kBAAA,SAAS,WAAW,EAAE,SAAS;AAC/B,kBAAA,OAAO,UAAU,EAAE,UAAU;AAC7B,kBAAA,OAAO,QAAQ,EAAE,UAAU;AAAA,EAAA;AAAA,EAG1C,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,eAAe,MAAM,YAAY,WAAW;AAC5C,UAAA,UAAU,MAAM,UAAU,UAAU;AACpC,UAAA,QAAQ,MAAM,UAAU,QAAQ;AAEhC,UAAA,YAAY,eACf,MAAM,KAAK,mBAAmB,6BAA6B,YAAY,IACvE,MAAM,KAAK,mBAAmB,0BAA0B;AAE3D,QAAI,CAAC,WAAW;AACT,YAAA;AAAA,IAAA;AAEP,UAAM,SAAS,MAAM,KAAK,qBAAqB,iBAAiB,UAAU,OAAO;AACjF,SAAK,iBAAiB,0BAA0B,QAAQ,WAAW,EAAE,SAAS,OAAO;AAAA,EAAA;AAEvF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationDescribeCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationDescribeCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { MigrationsResolver, SchemaVersionBuilder } from '@contember/migrations-client'\n\ntype Args = {\n\tmigration?: string\n}\n\ntype Options = {\n\t['sql-only']: boolean\n\t['no-sql']: boolean\n}\n\n\nexport class MigrationDescribeCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Describes a migration')\n\t\tconfiguration.argument('migration').optional()\n\t\tconfiguration.option('sql-only').valueNone()\n\t\tconfiguration.option('no-sql').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst migrationArg = input.getArgument('migration')\n\t\tconst sqlOnly = input.getOption('sql-only')\n\t\tconst noSql = input.getOption('no-sql')\n\n\t\tconst migration = migrationArg\n\t\t\t? await this.migrationsResolver.findSchemaMigrationByVersion(migrationArg)\n\t\t\t: await this.migrationsResolver.findLatestSchemaMigration()\n\n\t\tif (!migration) {\n\t\t\tthrow 'Undefined migration'\n\t\t}\n\t\tconst schema = await this.schemaVersionBuilder.buildSchemaUntil(migration.version)\n\t\tthis.migrationPrinter.printMigrationDescription(schema, migration, { sqlOnly, noSql })\n\t}\n}\n"],"names":[],"mappings":";AAcO,MAAM,iCAAiC,QAAuB;AAAA,EACpE,YACkB,kBACA,sBACA,oBAChB;AACK;AAJW,SAAA,mBAAA;AACA,SAAA,uBAAA;AACA,SAAA,qBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"MigrationDescribeCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationDescribeCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { MigrationsResolver, SchemaVersionBuilder } from '@contember/migrations-client'\n\ntype Args = {\n\tmigration?: string\n}\n\ntype Options = {\n\t['sql-only']: boolean\n\t['no-sql']: boolean\n}\n\n\nexport class MigrationDescribeCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Describes a migration')\n\t\tconfiguration.argument('migration').optional()\n\t\tconfiguration.option('sql-only').valueNone()\n\t\tconfiguration.option('no-sql').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst migrationArg = input.getArgument('migration')\n\t\tconst sqlOnly = input.getOption('sql-only')\n\t\tconst noSql = input.getOption('no-sql')\n\n\t\tconst migration = migrationArg\n\t\t\t? await this.migrationsResolver.findSchemaMigrationByVersion(migrationArg)\n\t\t\t: await this.migrationsResolver.findLatestSchemaMigration()\n\n\t\tif (!migration) {\n\t\t\tthrow 'Undefined migration'\n\t\t}\n\t\tconst schema = await this.schemaVersionBuilder.buildSchemaUntil(migration.version)\n\t\tthis.migrationPrinter.printMigrationDescription(schema, migration, { sqlOnly, noSql })\n\t}\n}\n"],"names":[],"mappings":";AAcO,MAAM,iCAAiC,QAAuB;AAAA,EACpE,YACkB,kBACA,sBACA,oBAChB;AACK,UAAA;AAJW,SAAA,mBAAA;AACA,SAAA,uBAAA;AACA,SAAA,qBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,uBAAuB;AACnC,kBAAA,SAAS,WAAW,EAAE,SAAS;AAC/B,kBAAA,OAAO,UAAU,EAAE,UAAU;AAC7B,kBAAA,OAAO,QAAQ,EAAE,UAAU;AAAA,EAAA;AAAA,EAG1C,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,eAAe,MAAM,YAAY,WAAW;AAC5C,UAAA,UAAU,MAAM,UAAU,UAAU;AACpC,UAAA,QAAQ,MAAM,UAAU,QAAQ;AAEhC,UAAA,YAAY,eACf,MAAM,KAAK,mBAAmB,6BAA6B,YAAY,IACvE,MAAM,KAAK,mBAAmB,0BAA0B;AAE3D,QAAI,CAAC,WAAW;AACT,YAAA;AAAA,IAAA;AAEP,UAAM,SAAS,MAAM,KAAK,qBAAqB,iBAAiB,UAAU,OAAO;AACjF,SAAK,iBAAiB,0BAA0B,QAAQ,WAAW,EAAE,SAAS,OAAO;AAAA,EAAA;AAEvF;"}
|
|
@@ -67,7 +67,7 @@ class MigrationDiffCommand extends cliCommon.Command {
|
|
|
67
67
|
if (shouldExecute) {
|
|
68
68
|
await this.migrationExecutorFacade.execute({
|
|
69
69
|
force: false,
|
|
70
|
-
requireConfirmation: !yes
|
|
70
|
+
requireConfirmation: (migrations) => migrations.length !== 1 && !yes
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationDiffCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationDiffCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { InvalidSchemaException } from '@contember/schema-migrations'\nimport prompts from 'prompts'\nimport { MigrationCreator, SchemaVersionBuilder } from '@contember/migrations-client'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { MigrationExecutionFacade } from '../../lib/migrations/MigrationExecutionFacade'\nimport { printValidationErrors } from '../../lib/schema/SchemaValidationPrinter'\n\ntype Args = {\n\tmigrationName: string\n}\n\ntype Options = {\n\texecute?: true\n\tyes?: true\n\t'skip-initial-schema-validation'?: true\n}\n\nexport class MigrationDiffCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationCreator: MigrationCreator,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t\tprivate readonly migrationExecutorFacade: MigrationExecutionFacade,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates schema migration diff')\n\t\tconfiguration.argument('migrationName')\n\t\tconfiguration.option('execute').valueNone()\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\n\t\tconfiguration.option('skip-initial-schema-validation')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst migrationName = input.getArgument('migrationName')\n\t\tlet shouldExecute = input.getOption('execute')\n\t\tconst yes = input.getOption('yes')\n\t\tconst skipInitialSchemaValidation = input.getOption('skip-initial-schema-validation') === true\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\ttry {\n\t\t\tconst initialSchema = await this.schemaVersionBuilder.buildSchema()\n\t\t\tconst result = await this.migrationCreator.prepareMigration(initialSchema, schema, migrationName, {\n\t\t\t\tskipInitialSchemaValidation: skipInitialSchemaValidation,\n\t\t\t})\n\t\t\tif (result === null) {\n\t\t\t\tconsole.log('Nothing to do')\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.migrationPrinter.printMigrationDescription(result.initialSchema, result.migration, { noSql: true })\n\n\n\t\t\tif (!yes) {\n\t\t\t\tconst { action } = await prompts({\n\t\t\t\t\ttype: 'select',\n\t\t\t\t\tname: 'action',\n\t\t\t\t\tmessage: 'Do you want to continue?',\n\t\t\t\t\tchoices: [\n\t\t\t\t\t\t{ value: 'yes', title: 'Yes' },\n\t\t\t\t\t\t...(!shouldExecute ? [{ value: 'execute', title: 'Yes and execute immediately' }] : []),\n\t\t\t\t\t\t{ value: 'no', title: 'Abort' },\n\t\t\t\t\t],\n\t\t\t\t})\n\t\t\t\tif (!action || action === 'no') {\n\t\t\t\t\tconsole.log('Aborting')\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif (action === 'execute') {\n\t\t\t\t\tshouldExecute = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst filename = await this.migrationCreator.saveMigration(result.migration)\n\n\t\t\tconsole.log(`${filename} created`)\n\n\t\t} catch (e) {\n\t\t\tif (e instanceof InvalidSchemaException) {\n\t\t\t\tprintValidationErrors(e.validationErrors, e.message)\n\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\n\t\tif (shouldExecute) {\n\t\t\tawait this.migrationExecutorFacade.execute({\n\t\t\t\tforce: false,\n\t\t\t\trequireConfirmation: !yes,\n\t\t\t})\n\t\t}\n\t}\n}\n"],"names":["Command","InvalidSchemaException","printValidationErrors"],"mappings":";;;;;;AAmBO,MAAM,6BAA6BA,UAAAA,QAAuB;AAAA,EAChE,YACkB,cACA,sBACA,kBACA,kBACA,yBAChB;AACK;AANW,SAAA,eAAA;AACA,SAAA,uBAAA;AACA,SAAA,mBAAA;AACA,SAAA,mBAAA;AACA,SAAA,0BAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"MigrationDiffCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationDiffCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { InvalidSchemaException } from '@contember/schema-migrations'\nimport prompts from 'prompts'\nimport { MigrationCreator, SchemaVersionBuilder } from '@contember/migrations-client'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { MigrationExecutionFacade } from '../../lib/migrations/MigrationExecutionFacade'\nimport { printValidationErrors } from '../../lib/schema/SchemaValidationPrinter'\n\ntype Args = {\n\tmigrationName: string\n}\n\ntype Options = {\n\texecute?: true\n\tyes?: true\n\t'skip-initial-schema-validation'?: true\n}\n\nexport class MigrationDiffCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationCreator: MigrationCreator,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t\tprivate readonly migrationExecutorFacade: MigrationExecutionFacade,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates schema migration diff')\n\t\tconfiguration.argument('migrationName')\n\t\tconfiguration.option('execute').valueNone()\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\n\t\tconfiguration.option('skip-initial-schema-validation')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst migrationName = input.getArgument('migrationName')\n\t\tlet shouldExecute = input.getOption('execute')\n\t\tconst yes = input.getOption('yes')\n\t\tconst skipInitialSchemaValidation = input.getOption('skip-initial-schema-validation') === true\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\ttry {\n\t\t\tconst initialSchema = await this.schemaVersionBuilder.buildSchema()\n\t\t\tconst result = await this.migrationCreator.prepareMigration(initialSchema, schema, migrationName, {\n\t\t\t\tskipInitialSchemaValidation: skipInitialSchemaValidation,\n\t\t\t})\n\t\t\tif (result === null) {\n\t\t\t\tconsole.log('Nothing to do')\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.migrationPrinter.printMigrationDescription(result.initialSchema, result.migration, { noSql: true })\n\n\n\t\t\tif (!yes) {\n\t\t\t\tconst { action } = await prompts({\n\t\t\t\t\ttype: 'select',\n\t\t\t\t\tname: 'action',\n\t\t\t\t\tmessage: 'Do you want to continue?',\n\t\t\t\t\tchoices: [\n\t\t\t\t\t\t{ value: 'yes', title: 'Yes' },\n\t\t\t\t\t\t...(!shouldExecute ? [{ value: 'execute', title: 'Yes and execute immediately' }] : []),\n\t\t\t\t\t\t{ value: 'no', title: 'Abort' },\n\t\t\t\t\t],\n\t\t\t\t})\n\t\t\t\tif (!action || action === 'no') {\n\t\t\t\t\tconsole.log('Aborting')\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif (action === 'execute') {\n\t\t\t\t\tshouldExecute = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst filename = await this.migrationCreator.saveMigration(result.migration)\n\n\t\t\tconsole.log(`${filename} created`)\n\n\t\t} catch (e) {\n\t\t\tif (e instanceof InvalidSchemaException) {\n\t\t\t\tprintValidationErrors(e.validationErrors, e.message)\n\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\n\t\tif (shouldExecute) {\n\t\t\tawait this.migrationExecutorFacade.execute({\n\t\t\t\tforce: false,\n\t\t\t\trequireConfirmation: migrations => migrations.length !== 1 && !yes,\n\t\t\t})\n\t\t}\n\t}\n}\n"],"names":["Command","InvalidSchemaException","printValidationErrors"],"mappings":";;;;;;AAmBO,MAAM,6BAA6BA,UAAAA,QAAuB;AAAA,EAChE,YACkB,cACA,sBACA,kBACA,kBACA,yBAChB;AACK,UAAA;AANW,SAAA,eAAA;AACA,SAAA,uBAAA;AACA,SAAA,mBAAA;AACA,SAAA,mBAAA;AACA,SAAA,0BAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,+BAA+B;AACzD,kBAAc,SAAS,eAAe;AACxB,kBAAA,OAAO,SAAS,EAAE,UAAU;AAC1C,kBACE,OAAO,KAAK,EACZ,UAAU,EACV,YAAY,8BAA8B;AAE5C,kBAAc,OAAO,gCAAgC;AAAA,EAAA;AAAA,EAGtD,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,gBAAgB,MAAM,YAAY,eAAe;AACnD,QAAA,gBAAgB,MAAM,UAAU,SAAS;AACvC,UAAA,MAAM,MAAM,UAAU,KAAK;AACjC,UAAM,8BAA8B,MAAM,UAAU,gCAAgC,MAAM;AAE1F,UAAM,SAAS,MAAM,KAAK,aAAa,WAAW;AAC9C,QAAA;AACH,YAAM,gBAAgB,MAAM,KAAK,qBAAqB,YAAY;AAClE,YAAM,SAAS,MAAM,KAAK,iBAAiB,iBAAiB,eAAe,QAAQ,eAAe;AAAA,QACjG;AAAA,MAAA,CACA;AACD,UAAI,WAAW,MAAM;AACpB,gBAAQ,IAAI,eAAe;AAC3B;AAAA,MAAA;AAEI,WAAA,iBAAiB,0BAA0B,OAAO,eAAe,OAAO,WAAW,EAAE,OAAO,MAAM;AAGvG,UAAI,CAAC,KAAK;AACT,cAAM,EAAE,WAAW,MAAM,QAAQ;AAAA,UAChC,MAAM;AAAA,UACN,MAAM;AAAA,UACN,SAAS;AAAA,UACT,SAAS;AAAA,YACR,EAAE,OAAO,OAAO,OAAO,MAAM;AAAA,YAC7B,GAAI,CAAC,gBAAgB,CAAC,EAAE,OAAO,WAAW,OAAO,8BAA+B,CAAA,IAAI,CAAC;AAAA,YACrF,EAAE,OAAO,MAAM,OAAO,QAAQ;AAAA,UAAA;AAAA,QAC/B,CACA;AACG,YAAA,CAAC,UAAU,WAAW,MAAM;AAC/B,kBAAQ,IAAI,UAAU;AACtB;AAAA,QAAA;AAED,YAAI,WAAW,WAAW;AACT,0BAAA;AAAA,QAAA;AAAA,MACjB;AAGD,YAAM,WAAW,MAAM,KAAK,iBAAiB,cAAc,OAAO,SAAS;AAEnE,cAAA,IAAI,GAAG,QAAQ,UAAU;AAAA,aAEzB,GAAG;AACX,UAAI,aAAaC,iBAAAA,wBAAwB;AAClBC,gCAAAA,sBAAA,EAAE,kBAAkB,EAAE,OAAO;AAEnD;AAAA,MAAA;AAEK,YAAA;AAAA,IAAA;AAGP,QAAI,eAAe;AACZ,YAAA,KAAK,wBAAwB,QAAQ;AAAA,QAC1C,OAAO;AAAA,QACP,qBAAqB,CAAA,eAAc,WAAW,WAAW,KAAK,CAAC;AAAA,MAAA,CAC/D;AAAA,IAAA;AAAA,EACF;AAEF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationDiffCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationDiffCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { InvalidSchemaException } from '@contember/schema-migrations'\nimport prompts from 'prompts'\nimport { MigrationCreator, SchemaVersionBuilder } from '@contember/migrations-client'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { MigrationExecutionFacade } from '../../lib/migrations/MigrationExecutionFacade'\nimport { printValidationErrors } from '../../lib/schema/SchemaValidationPrinter'\n\ntype Args = {\n\tmigrationName: string\n}\n\ntype Options = {\n\texecute?: true\n\tyes?: true\n\t'skip-initial-schema-validation'?: true\n}\n\nexport class MigrationDiffCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationCreator: MigrationCreator,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t\tprivate readonly migrationExecutorFacade: MigrationExecutionFacade,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates schema migration diff')\n\t\tconfiguration.argument('migrationName')\n\t\tconfiguration.option('execute').valueNone()\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\n\t\tconfiguration.option('skip-initial-schema-validation')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst migrationName = input.getArgument('migrationName')\n\t\tlet shouldExecute = input.getOption('execute')\n\t\tconst yes = input.getOption('yes')\n\t\tconst skipInitialSchemaValidation = input.getOption('skip-initial-schema-validation') === true\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\ttry {\n\t\t\tconst initialSchema = await this.schemaVersionBuilder.buildSchema()\n\t\t\tconst result = await this.migrationCreator.prepareMigration(initialSchema, schema, migrationName, {\n\t\t\t\tskipInitialSchemaValidation: skipInitialSchemaValidation,\n\t\t\t})\n\t\t\tif (result === null) {\n\t\t\t\tconsole.log('Nothing to do')\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.migrationPrinter.printMigrationDescription(result.initialSchema, result.migration, { noSql: true })\n\n\n\t\t\tif (!yes) {\n\t\t\t\tconst { action } = await prompts({\n\t\t\t\t\ttype: 'select',\n\t\t\t\t\tname: 'action',\n\t\t\t\t\tmessage: 'Do you want to continue?',\n\t\t\t\t\tchoices: [\n\t\t\t\t\t\t{ value: 'yes', title: 'Yes' },\n\t\t\t\t\t\t...(!shouldExecute ? [{ value: 'execute', title: 'Yes and execute immediately' }] : []),\n\t\t\t\t\t\t{ value: 'no', title: 'Abort' },\n\t\t\t\t\t],\n\t\t\t\t})\n\t\t\t\tif (!action || action === 'no') {\n\t\t\t\t\tconsole.log('Aborting')\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif (action === 'execute') {\n\t\t\t\t\tshouldExecute = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst filename = await this.migrationCreator.saveMigration(result.migration)\n\n\t\t\tconsole.log(`${filename} created`)\n\n\t\t} catch (e) {\n\t\t\tif (e instanceof InvalidSchemaException) {\n\t\t\t\tprintValidationErrors(e.validationErrors, e.message)\n\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\n\t\tif (shouldExecute) {\n\t\t\tawait this.migrationExecutorFacade.execute({\n\t\t\t\tforce: false,\n\t\t\t\trequireConfirmation: !yes,\n\t\t\t})\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;AAmBO,MAAM,6BAA6B,QAAuB;AAAA,EAChE,YACkB,cACA,sBACA,kBACA,kBACA,yBAChB;AACK;AANW,SAAA,eAAA;AACA,SAAA,uBAAA;AACA,SAAA,mBAAA;AACA,SAAA,mBAAA;AACA,SAAA,0BAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"MigrationDiffCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationDiffCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { InvalidSchemaException } from '@contember/schema-migrations'\nimport prompts from 'prompts'\nimport { MigrationCreator, SchemaVersionBuilder } from '@contember/migrations-client'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { MigrationExecutionFacade } from '../../lib/migrations/MigrationExecutionFacade'\nimport { printValidationErrors } from '../../lib/schema/SchemaValidationPrinter'\n\ntype Args = {\n\tmigrationName: string\n}\n\ntype Options = {\n\texecute?: true\n\tyes?: true\n\t'skip-initial-schema-validation'?: true\n}\n\nexport class MigrationDiffCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly migrationCreator: MigrationCreator,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t\tprivate readonly migrationExecutorFacade: MigrationExecutionFacade,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates schema migration diff')\n\t\tconfiguration.argument('migrationName')\n\t\tconfiguration.option('execute').valueNone()\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\n\t\tconfiguration.option('skip-initial-schema-validation')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst migrationName = input.getArgument('migrationName')\n\t\tlet shouldExecute = input.getOption('execute')\n\t\tconst yes = input.getOption('yes')\n\t\tconst skipInitialSchemaValidation = input.getOption('skip-initial-schema-validation') === true\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\ttry {\n\t\t\tconst initialSchema = await this.schemaVersionBuilder.buildSchema()\n\t\t\tconst result = await this.migrationCreator.prepareMigration(initialSchema, schema, migrationName, {\n\t\t\t\tskipInitialSchemaValidation: skipInitialSchemaValidation,\n\t\t\t})\n\t\t\tif (result === null) {\n\t\t\t\tconsole.log('Nothing to do')\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.migrationPrinter.printMigrationDescription(result.initialSchema, result.migration, { noSql: true })\n\n\n\t\t\tif (!yes) {\n\t\t\t\tconst { action } = await prompts({\n\t\t\t\t\ttype: 'select',\n\t\t\t\t\tname: 'action',\n\t\t\t\t\tmessage: 'Do you want to continue?',\n\t\t\t\t\tchoices: [\n\t\t\t\t\t\t{ value: 'yes', title: 'Yes' },\n\t\t\t\t\t\t...(!shouldExecute ? [{ value: 'execute', title: 'Yes and execute immediately' }] : []),\n\t\t\t\t\t\t{ value: 'no', title: 'Abort' },\n\t\t\t\t\t],\n\t\t\t\t})\n\t\t\t\tif (!action || action === 'no') {\n\t\t\t\t\tconsole.log('Aborting')\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif (action === 'execute') {\n\t\t\t\t\tshouldExecute = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst filename = await this.migrationCreator.saveMigration(result.migration)\n\n\t\t\tconsole.log(`${filename} created`)\n\n\t\t} catch (e) {\n\t\t\tif (e instanceof InvalidSchemaException) {\n\t\t\t\tprintValidationErrors(e.validationErrors, e.message)\n\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\n\t\tif (shouldExecute) {\n\t\t\tawait this.migrationExecutorFacade.execute({\n\t\t\t\tforce: false,\n\t\t\t\trequireConfirmation: migrations => migrations.length !== 1 && !yes,\n\t\t\t})\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;AAmBO,MAAM,6BAA6B,QAAuB;AAAA,EAChE,YACkB,cACA,sBACA,kBACA,kBACA,yBAChB;AACK,UAAA;AANW,SAAA,eAAA;AACA,SAAA,uBAAA;AACA,SAAA,mBAAA;AACA,SAAA,mBAAA;AACA,SAAA,0BAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,+BAA+B;AACzD,kBAAc,SAAS,eAAe;AACxB,kBAAA,OAAO,SAAS,EAAE,UAAU;AAC1C,kBACE,OAAO,KAAK,EACZ,UAAU,EACV,YAAY,8BAA8B;AAE5C,kBAAc,OAAO,gCAAgC;AAAA,EAAA;AAAA,EAGtD,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,gBAAgB,MAAM,YAAY,eAAe;AACnD,QAAA,gBAAgB,MAAM,UAAU,SAAS;AACvC,UAAA,MAAM,MAAM,UAAU,KAAK;AACjC,UAAM,8BAA8B,MAAM,UAAU,gCAAgC,MAAM;AAE1F,UAAM,SAAS,MAAM,KAAK,aAAa,WAAW;AAC9C,QAAA;AACH,YAAM,gBAAgB,MAAM,KAAK,qBAAqB,YAAY;AAClE,YAAM,SAAS,MAAM,KAAK,iBAAiB,iBAAiB,eAAe,QAAQ,eAAe;AAAA,QACjG;AAAA,MAAA,CACA;AACD,UAAI,WAAW,MAAM;AACpB,gBAAQ,IAAI,eAAe;AAC3B;AAAA,MAAA;AAEI,WAAA,iBAAiB,0BAA0B,OAAO,eAAe,OAAO,WAAW,EAAE,OAAO,MAAM;AAGvG,UAAI,CAAC,KAAK;AACT,cAAM,EAAE,WAAW,MAAM,QAAQ;AAAA,UAChC,MAAM;AAAA,UACN,MAAM;AAAA,UACN,SAAS;AAAA,UACT,SAAS;AAAA,YACR,EAAE,OAAO,OAAO,OAAO,MAAM;AAAA,YAC7B,GAAI,CAAC,gBAAgB,CAAC,EAAE,OAAO,WAAW,OAAO,8BAA+B,CAAA,IAAI,CAAC;AAAA,YACrF,EAAE,OAAO,MAAM,OAAO,QAAQ;AAAA,UAAA;AAAA,QAC/B,CACA;AACG,YAAA,CAAC,UAAU,WAAW,MAAM;AAC/B,kBAAQ,IAAI,UAAU;AACtB;AAAA,QAAA;AAED,YAAI,WAAW,WAAW;AACT,0BAAA;AAAA,QAAA;AAAA,MACjB;AAGD,YAAM,WAAW,MAAM,KAAK,iBAAiB,cAAc,OAAO,SAAS;AAEnE,cAAA,IAAI,GAAG,QAAQ,UAAU;AAAA,aAEzB,GAAG;AACX,UAAI,aAAa,wBAAwB;AAClB,8BAAA,EAAE,kBAAkB,EAAE,OAAO;AAEnD;AAAA,MAAA;AAEK,YAAA;AAAA,IAAA;AAGP,QAAI,eAAe;AACZ,YAAA,KAAK,wBAAwB,QAAQ;AAAA,QAC1C,OAAO;AAAA,QACP,qBAAqB,CAAA,eAAc,WAAW,WAAW,KAAK,CAAC;AAAA,MAAA,CAC/D;AAAA,IAAA;AAAA,EACF;AAEF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationExecuteCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationExecuteCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationExecutionFacade } from '../../lib/migrations/MigrationExecutionFacade'\n\ntype Args = {\n}\n\ntype Options = {\n\tuntil?: string\n\tforce: boolean\n\tyes?: boolean\n}\n\nexport class MigrationExecuteCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationExecutorFacade: MigrationExecutionFacade,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Executes migrations on Contember server.')\n\t\tconfiguration.option('force')\n\t\t\t.description('Ignore migrations order and missing migrations (dev only)')\n\t\tconfiguration.option('until')\n\t\t\t.valueRequired()\n\t\t\t.description('Execute all migrations leading up to, and inclusive of, a specified migration')\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst force = input.getOption('force')\n\t\tconst until = input.getOption('until')\n\n\t\tawait this.migrationExecutorFacade.execute({\n\t\t\tforce,\n\t\t\tuntil,\n\t\t\trequireConfirmation: !input.getOption('yes'),\n\t\t})\n\t}\n}\n"],"names":["Command"],"mappings":";;;AAYO,MAAM,gCAAgCA,UAAAA,QAAuB;AAAA,EACnE,YACkB,yBAChB;AACK;AAFW,SAAA,0BAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"MigrationExecuteCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationExecuteCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationExecutionFacade } from '../../lib/migrations/MigrationExecutionFacade'\n\ntype Args = {\n}\n\ntype Options = {\n\tuntil?: string\n\tforce: boolean\n\tyes?: boolean\n}\n\nexport class MigrationExecuteCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationExecutorFacade: MigrationExecutionFacade,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Executes migrations on Contember server.')\n\t\tconfiguration.option('force')\n\t\t\t.description('Ignore migrations order and missing migrations (dev only)')\n\t\tconfiguration.option('until')\n\t\t\t.valueRequired()\n\t\t\t.description('Execute all migrations leading up to, and inclusive of, a specified migration')\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst force = input.getOption('force')\n\t\tconst until = input.getOption('until')\n\n\t\tawait this.migrationExecutorFacade.execute({\n\t\t\tforce,\n\t\t\tuntil,\n\t\t\trequireConfirmation: !input.getOption('yes'),\n\t\t})\n\t}\n}\n"],"names":["Command"],"mappings":";;;AAYO,MAAM,gCAAgCA,UAAAA,QAAuB;AAAA,EACnE,YACkB,yBAChB;AACK,UAAA;AAFW,SAAA,0BAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,0CAA0C;AACpE,kBAAc,OAAO,OAAO,EAC1B,YAAY,2DAA2D;AACzE,kBAAc,OAAO,OAAO,EAC1B,cAAc,EACd,YAAY,+EAA+E;AAC7F,kBACE,OAAO,KAAK,EACZ,UAAU,EACV,YAAY,8BAA8B;AAAA,EAAA;AAAA,EAG7C,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,QAAQ,MAAM,UAAU,OAAO;AAC/B,UAAA,QAAQ,MAAM,UAAU,OAAO;AAE/B,UAAA,KAAK,wBAAwB,QAAQ;AAAA,MAC1C;AAAA,MACA;AAAA,MACA,qBAAqB,CAAC,MAAM,UAAU,KAAK;AAAA,IAAA,CAC3C;AAAA,EAAA;AAEH;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationExecuteCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationExecuteCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationExecutionFacade } from '../../lib/migrations/MigrationExecutionFacade'\n\ntype Args = {\n}\n\ntype Options = {\n\tuntil?: string\n\tforce: boolean\n\tyes?: boolean\n}\n\nexport class MigrationExecuteCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationExecutorFacade: MigrationExecutionFacade,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Executes migrations on Contember server.')\n\t\tconfiguration.option('force')\n\t\t\t.description('Ignore migrations order and missing migrations (dev only)')\n\t\tconfiguration.option('until')\n\t\t\t.valueRequired()\n\t\t\t.description('Execute all migrations leading up to, and inclusive of, a specified migration')\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst force = input.getOption('force')\n\t\tconst until = input.getOption('until')\n\n\t\tawait this.migrationExecutorFacade.execute({\n\t\t\tforce,\n\t\t\tuntil,\n\t\t\trequireConfirmation: !input.getOption('yes'),\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";AAYO,MAAM,gCAAgC,QAAuB;AAAA,EACnE,YACkB,yBAChB;AACK;AAFW,SAAA,0BAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"MigrationExecuteCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationExecuteCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationExecutionFacade } from '../../lib/migrations/MigrationExecutionFacade'\n\ntype Args = {\n}\n\ntype Options = {\n\tuntil?: string\n\tforce: boolean\n\tyes?: boolean\n}\n\nexport class MigrationExecuteCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationExecutorFacade: MigrationExecutionFacade,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Executes migrations on Contember server.')\n\t\tconfiguration.option('force')\n\t\t\t.description('Ignore migrations order and missing migrations (dev only)')\n\t\tconfiguration.option('until')\n\t\t\t.valueRequired()\n\t\t\t.description('Execute all migrations leading up to, and inclusive of, a specified migration')\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst force = input.getOption('force')\n\t\tconst until = input.getOption('until')\n\n\t\tawait this.migrationExecutorFacade.execute({\n\t\t\tforce,\n\t\t\tuntil,\n\t\t\trequireConfirmation: !input.getOption('yes'),\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";AAYO,MAAM,gCAAgC,QAAuB;AAAA,EACnE,YACkB,yBAChB;AACK,UAAA;AAFW,SAAA,0BAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,0CAA0C;AACpE,kBAAc,OAAO,OAAO,EAC1B,YAAY,2DAA2D;AACzE,kBAAc,OAAO,OAAO,EAC1B,cAAc,EACd,YAAY,+EAA+E;AAC7F,kBACE,OAAO,KAAK,EACZ,UAAU,EACV,YAAY,8BAA8B;AAAA,EAAA;AAAA,EAG7C,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,QAAQ,MAAM,UAAU,OAAO;AAC/B,UAAA,QAAQ,MAAM,UAAU,OAAO;AAE/B,UAAA,KAAK,wBAAwB,QAAQ;AAAA,MAC1C;AAAA,MACA;AAAA,MACA,qBAAqB,CAAC,MAAM,UAAU,KAAK;AAAA,IAAA,CAC3C;AAAA,EAAA;AAEH;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationRebaseCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationRebaseCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { Migration, MigrationsResolver } from '@contember/migrations-client'\nimport { MigrationRebaseFacade } from '../../lib/migrations/MigrationRebaseFacade'\n\ntype Args = {\n\tmigration: string[]\n}\n\ntype Options = {\n\tyes?: true\n}\n\nexport class MigrationRebaseCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly migrationRebaseFacade: MigrationRebaseFacade,\n\t) {\n\t\tsuper()\n\t}\n\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Rebase migrations on filesystem and in local instance')\n\t\tconfiguration.argument('migration').variadic()\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\n\t\tconst migrationNames = input.getArgument('migration')\n\n\t\tconst migrations: Migration[] = []\n\t\tfor (const migrationName of migrationNames) {\n\t\t\tconst migration = await this.migrationsResolver.findSchemaMigrationByVersion(migrationName)\n\t\t\tif (!migration) {\n\t\t\t\tthrow `Migration ${migrationName} not found`\n\t\t\t}\n\t\t\tmigrations.push(migration)\n\t\t}\n\n\t\tconsole.log('Rebasing: ' + migrations.map(it => it.name).join(', '))\n\t\tawait this.migrationRebaseFacade.rebase(migrations)\n\t\tconsole.log('Done')\n\t}\n}\n"],"names":["Command"],"mappings":";;;AAYO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,oBACA,uBAChB;AACK;AAHW,SAAA,qBAAA;AACA,SAAA,wBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"MigrationRebaseCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationRebaseCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { Migration, MigrationsResolver } from '@contember/migrations-client'\nimport { MigrationRebaseFacade } from '../../lib/migrations/MigrationRebaseFacade'\n\ntype Args = {\n\tmigration: string[]\n}\n\ntype Options = {\n\tyes?: true\n}\n\nexport class MigrationRebaseCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly migrationRebaseFacade: MigrationRebaseFacade,\n\t) {\n\t\tsuper()\n\t}\n\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Rebase migrations on filesystem and in local instance')\n\t\tconfiguration.argument('migration').variadic()\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\n\t\tconst migrationNames = input.getArgument('migration')\n\n\t\tconst migrations: Migration[] = []\n\t\tfor (const migrationName of migrationNames) {\n\t\t\tconst migration = await this.migrationsResolver.findSchemaMigrationByVersion(migrationName)\n\t\t\tif (!migration) {\n\t\t\t\tthrow `Migration ${migrationName} not found`\n\t\t\t}\n\t\t\tmigrations.push(migration)\n\t\t}\n\n\t\tconsole.log('Rebasing: ' + migrations.map(it => it.name).join(', '))\n\t\tawait this.migrationRebaseFacade.rebase(migrations)\n\t\tconsole.log('Done')\n\t}\n}\n"],"names":["Command"],"mappings":";;;AAYO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,oBACA,uBAChB;AACK,UAAA;AAHW,SAAA,qBAAA;AACA,SAAA,wBAAA;AAAA,EAAA;AAAA,EAMR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,uDAAuD;AACnE,kBAAA,SAAS,WAAW,EAAE,SAAS;AAC7C,kBACE,OAAO,KAAK,EACZ,UAAU,EACV,YAAY,8BAA8B;AAAA,EAAA;AAAA,EAG7C,MAAgB,QAAQ,OAA4C;AAE7D,UAAA,iBAAiB,MAAM,YAAY,WAAW;AAEpD,UAAM,aAA0B,CAAC;AACjC,eAAW,iBAAiB,gBAAgB;AAC3C,YAAM,YAAY,MAAM,KAAK,mBAAmB,6BAA6B,aAAa;AAC1F,UAAI,CAAC,WAAW;AACf,cAAM,aAAa,aAAa;AAAA,MAAA;AAEjC,iBAAW,KAAK,SAAS;AAAA,IAAA;AAGlB,YAAA,IAAI,eAAe,WAAW,IAAI,CAAA,OAAM,GAAG,IAAI,EAAE,KAAK,IAAI,CAAC;AAC7D,UAAA,KAAK,sBAAsB,OAAO,UAAU;AAClD,YAAQ,IAAI,MAAM;AAAA,EAAA;AAEpB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationRebaseCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationRebaseCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { Migration, MigrationsResolver } from '@contember/migrations-client'\nimport { MigrationRebaseFacade } from '../../lib/migrations/MigrationRebaseFacade'\n\ntype Args = {\n\tmigration: string[]\n}\n\ntype Options = {\n\tyes?: true\n}\n\nexport class MigrationRebaseCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly migrationRebaseFacade: MigrationRebaseFacade,\n\t) {\n\t\tsuper()\n\t}\n\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Rebase migrations on filesystem and in local instance')\n\t\tconfiguration.argument('migration').variadic()\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\n\t\tconst migrationNames = input.getArgument('migration')\n\n\t\tconst migrations: Migration[] = []\n\t\tfor (const migrationName of migrationNames) {\n\t\t\tconst migration = await this.migrationsResolver.findSchemaMigrationByVersion(migrationName)\n\t\t\tif (!migration) {\n\t\t\t\tthrow `Migration ${migrationName} not found`\n\t\t\t}\n\t\t\tmigrations.push(migration)\n\t\t}\n\n\t\tconsole.log('Rebasing: ' + migrations.map(it => it.name).join(', '))\n\t\tawait this.migrationRebaseFacade.rebase(migrations)\n\t\tconsole.log('Done')\n\t}\n}\n"],"names":[],"mappings":";AAYO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,oBACA,uBAChB;AACK;AAHW,SAAA,qBAAA;AACA,SAAA,wBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"MigrationRebaseCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationRebaseCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { Migration, MigrationsResolver } from '@contember/migrations-client'\nimport { MigrationRebaseFacade } from '../../lib/migrations/MigrationRebaseFacade'\n\ntype Args = {\n\tmigration: string[]\n}\n\ntype Options = {\n\tyes?: true\n}\n\nexport class MigrationRebaseCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly migrationRebaseFacade: MigrationRebaseFacade,\n\t) {\n\t\tsuper()\n\t}\n\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Rebase migrations on filesystem and in local instance')\n\t\tconfiguration.argument('migration').variadic()\n\t\tconfiguration //\n\t\t\t.option('yes')\n\t\t\t.valueNone()\n\t\t\t.description('Do not ask for confirmation.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\n\t\tconst migrationNames = input.getArgument('migration')\n\n\t\tconst migrations: Migration[] = []\n\t\tfor (const migrationName of migrationNames) {\n\t\t\tconst migration = await this.migrationsResolver.findSchemaMigrationByVersion(migrationName)\n\t\t\tif (!migration) {\n\t\t\t\tthrow `Migration ${migrationName} not found`\n\t\t\t}\n\t\t\tmigrations.push(migration)\n\t\t}\n\n\t\tconsole.log('Rebasing: ' + migrations.map(it => it.name).join(', '))\n\t\tawait this.migrationRebaseFacade.rebase(migrations)\n\t\tconsole.log('Done')\n\t}\n}\n"],"names":[],"mappings":";AAYO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,oBACA,uBAChB;AACK,UAAA;AAHW,SAAA,qBAAA;AACA,SAAA,wBAAA;AAAA,EAAA;AAAA,EAMR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,uDAAuD;AACnE,kBAAA,SAAS,WAAW,EAAE,SAAS;AAC7C,kBACE,OAAO,KAAK,EACZ,UAAU,EACV,YAAY,8BAA8B;AAAA,EAAA;AAAA,EAG7C,MAAgB,QAAQ,OAA4C;AAE7D,UAAA,iBAAiB,MAAM,YAAY,WAAW;AAEpD,UAAM,aAA0B,CAAC;AACjC,eAAW,iBAAiB,gBAAgB;AAC3C,YAAM,YAAY,MAAM,KAAK,mBAAmB,6BAA6B,aAAa;AAC1F,UAAI,CAAC,WAAW;AACf,cAAM,aAAa,aAAa;AAAA,MAAA;AAEjC,iBAAW,KAAK,SAAS;AAAA,IAAA;AAGlB,YAAA,IAAI,eAAe,WAAW,IAAI,CAAA,OAAM,GAAG,IAAI,EAAE,KAAK,IAAI,CAAC;AAC7D,UAAA,KAAK,sBAAsB,OAAO,UAAU;AAClD,YAAQ,IAAI,MAAM;AAAA,EAAA;AAEpB;"}
|