@contember/cli 2.1.0-beta.2 → 2.2.0-alpha.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/CLAUDE.md +14 -1
- package/dist/development/index.cjs +5 -0
- package/dist/development/index.cjs.map +1 -0
- package/dist/development/index.js +5 -0
- package/dist/development/index.js.map +1 -0
- package/dist/development/run.cjs +3 -3
- package/dist/development/run.cjs.map +1 -1
- package/dist/development/run.js.map +1 -1
- package/dist/development/src/commands/actions/ActionsGetEventCommand.cjs.map +1 -1
- package/dist/development/src/commands/actions/ActionsGetEventCommand.js.map +1 -1
- package/dist/development/src/commands/actions/ActionsListFailedEventsCommand.cjs.map +1 -1
- package/dist/development/src/commands/actions/ActionsListFailedEventsCommand.js.map +1 -1
- package/dist/development/src/commands/actions/ActionsListVariablesCommand.cjs.map +1 -1
- package/dist/development/src/commands/actions/ActionsListVariablesCommand.js.map +1 -1
- package/dist/development/src/commands/actions/ActionsRetryEventCommand.cjs.map +1 -1
- package/dist/development/src/commands/actions/ActionsRetryEventCommand.js.map +1 -1
- package/dist/development/src/commands/actions/ActionsSetVariablesCommand.cjs.map +1 -1
- package/dist/development/src/commands/actions/ActionsSetVariablesCommand.js.map +1 -1
- package/dist/development/src/commands/actions/ActionsStopEventCommand.cjs.map +1 -1
- package/dist/development/src/commands/actions/ActionsStopEventCommand.js.map +1 -1
- package/dist/development/src/commands/deploy/DeployCommand.cjs +3 -1
- package/dist/development/src/commands/deploy/DeployCommand.cjs.map +1 -1
- package/dist/development/src/commands/deploy/DeployCommand.js +3 -1
- package/dist/development/src/commands/deploy/DeployCommand.js.map +1 -1
- package/dist/development/src/commands/migrations/MigrationAmendCommand.cjs +26 -4
- package/dist/development/src/commands/migrations/MigrationAmendCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationAmendCommand.js +26 -4
- package/dist/development/src/commands/migrations/MigrationAmendCommand.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 +39 -3
- package/dist/development/src/commands/migrations/MigrationDiffCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationDiffCommand.js +39 -3
- package/dist/development/src/commands/migrations/MigrationDiffCommand.js.map +1 -1
- package/dist/development/src/commands/migrations/MigrationExecuteCommand.cjs +3 -1
- package/dist/development/src/commands/migrations/MigrationExecuteCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationExecuteCommand.js +3 -1
- package/dist/development/src/commands/migrations/MigrationExecuteCommand.js.map +1 -1
- package/dist/development/src/commands/migrations/MigrationInitStateCommand.cjs +26 -0
- package/dist/development/src/commands/migrations/MigrationInitStateCommand.cjs.map +1 -0
- package/dist/development/src/commands/migrations/MigrationInitStateCommand.js +26 -0
- package/dist/development/src/commands/migrations/MigrationInitStateCommand.js.map +1 -0
- 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/MigrationSnapshotCommand.cjs +28 -0
- package/dist/development/src/commands/migrations/MigrationSnapshotCommand.cjs.map +1 -0
- package/dist/development/src/commands/migrations/MigrationSnapshotCommand.js +28 -0
- package/dist/development/src/commands/migrations/MigrationSnapshotCommand.js.map +1 -0
- 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/migrations/MigrationVerifySnapshotCommand.cjs +23 -0
- package/dist/development/src/commands/migrations/MigrationVerifySnapshotCommand.cjs.map +1 -0
- package/dist/development/src/commands/migrations/MigrationVerifySnapshotCommand.js +23 -0
- package/dist/development/src/commands/migrations/MigrationVerifySnapshotCommand.js.map +1 -0
- package/dist/development/src/commands/project/ProjectGenerateDocumentationCommand.cjs +2 -2
- 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.map +1 -1
- 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/tenant/TenantApplyCommand.cjs +39 -0
- package/dist/development/src/commands/tenant/TenantApplyCommand.cjs.map +1 -0
- package/dist/development/src/commands/tenant/TenantApplyCommand.js +39 -0
- package/dist/development/src/commands/tenant/TenantApplyCommand.js.map +1 -0
- package/dist/development/src/commands/transfer/ExportCommand.cjs.map +1 -1
- 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.map +1 -1
- package/dist/development/src/commands/transfer/TransferCommand.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 +2 -2
- package/dist/development/src/consts.cjs.map +1 -1
- package/dist/development/src/dic.cjs +60 -10
- package/dist/development/src/dic.cjs.map +1 -1
- package/dist/development/src/dic.js +61 -11
- 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 +2 -2
- 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.map +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/fs/DockerComposeManager.cjs +10 -10
- 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/YamlHandler.cjs.map +1 -1
- package/dist/development/src/lib/fs/YamlHandler.js.map +1 -1
- package/dist/development/src/lib/js/EsBuildBuilder.cjs.map +1 -1
- package/dist/development/src/lib/js/EsBuildBuilder.js.map +1 -1
- package/dist/development/src/lib/js/EvalExecutor.cjs.map +1 -1
- 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 +78 -18
- package/dist/development/src/lib/migrations/MigrationExecutionFacade.cjs.map +1 -1
- package/dist/development/src/lib/migrations/MigrationExecutionFacade.js +79 -19
- 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 +5 -1
- package/dist/development/src/lib/migrations/MigrationRebaseFacade.cjs.map +1 -1
- package/dist/development/src/lib/migrations/MigrationRebaseFacade.js +5 -1
- package/dist/development/src/lib/migrations/MigrationRebaseFacade.js.map +1 -1
- package/dist/development/src/lib/migrations/MigrationSnapshotFacade.cjs +171 -0
- package/dist/development/src/lib/migrations/MigrationSnapshotFacade.cjs.map +1 -0
- package/dist/development/src/lib/migrations/MigrationSnapshotFacade.js +171 -0
- package/dist/development/src/lib/migrations/MigrationSnapshotFacade.js.map +1 -0
- 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/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.map +1 -1
- 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/EntityLink.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/components/EntityLink.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/projectDescribe.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/projectDescribe.js.map +1 -1
- package/dist/development/src/lib/schema/SchemaLoader.cjs +5 -5
- 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/SchemaValidationHelper.js.map +1 -1
- package/dist/development/src/lib/tenant/TenantClient.cjs +75 -12
- package/dist/development/src/lib/tenant/TenantClient.cjs.map +1 -1
- package/dist/development/src/lib/tenant/TenantClient.js +75 -12
- package/dist/development/src/lib/tenant/TenantClient.js.map +1 -1
- package/dist/development/src/lib/tenant/TenantConfigApplier.cjs +55 -0
- package/dist/development/src/lib/tenant/TenantConfigApplier.cjs.map +1 -0
- package/dist/development/src/lib/tenant/TenantConfigApplier.js +55 -0
- package/dist/development/src/lib/tenant/TenantConfigApplier.js.map +1 -0
- package/dist/development/src/lib/tenant/TenantConfigLoader.cjs +32 -0
- package/dist/development/src/lib/tenant/TenantConfigLoader.cjs.map +1 -0
- package/dist/development/src/lib/tenant/TenantConfigLoader.js +32 -0
- package/dist/development/src/lib/tenant/TenantConfigLoader.js.map +1 -0
- package/dist/development/src/lib/tenant/tenantConfig.cjs +5 -0
- package/dist/development/src/lib/tenant/tenantConfig.cjs.map +1 -0
- package/dist/development/src/lib/tenant/tenantConfig.js +5 -0
- package/dist/development/src/lib/tenant/tenantConfig.js.map +1 -0
- package/dist/development/src/lib/transfer/DataTransferClient.cjs.map +1 -1
- package/dist/development/src/lib/transfer/DataTransferClient.js.map +1 -1
- package/dist/development/src/lib/workspace/WorkspaceResolver.cjs +6 -6
- 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/index.cjs +5 -0
- package/dist/production/index.cjs.map +1 -0
- package/dist/production/index.js +5 -0
- package/dist/production/index.js.map +1 -0
- package/dist/production/run.cjs +3 -3
- package/dist/production/run.cjs.map +1 -1
- package/dist/production/run.js.map +1 -1
- package/dist/production/src/commands/actions/ActionsGetEventCommand.cjs.map +1 -1
- package/dist/production/src/commands/actions/ActionsGetEventCommand.js.map +1 -1
- package/dist/production/src/commands/actions/ActionsListFailedEventsCommand.cjs.map +1 -1
- package/dist/production/src/commands/actions/ActionsListFailedEventsCommand.js.map +1 -1
- package/dist/production/src/commands/actions/ActionsListVariablesCommand.cjs.map +1 -1
- package/dist/production/src/commands/actions/ActionsListVariablesCommand.js.map +1 -1
- package/dist/production/src/commands/actions/ActionsRetryEventCommand.cjs.map +1 -1
- package/dist/production/src/commands/actions/ActionsRetryEventCommand.js.map +1 -1
- package/dist/production/src/commands/actions/ActionsSetVariablesCommand.cjs.map +1 -1
- package/dist/production/src/commands/actions/ActionsSetVariablesCommand.js.map +1 -1
- package/dist/production/src/commands/actions/ActionsStopEventCommand.cjs.map +1 -1
- package/dist/production/src/commands/actions/ActionsStopEventCommand.js.map +1 -1
- package/dist/production/src/commands/deploy/DeployCommand.cjs +3 -1
- package/dist/production/src/commands/deploy/DeployCommand.cjs.map +1 -1
- package/dist/production/src/commands/deploy/DeployCommand.js +3 -1
- package/dist/production/src/commands/deploy/DeployCommand.js.map +1 -1
- package/dist/production/src/commands/migrations/MigrationAmendCommand.cjs +26 -4
- package/dist/production/src/commands/migrations/MigrationAmendCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationAmendCommand.js +26 -4
- package/dist/production/src/commands/migrations/MigrationAmendCommand.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 +39 -3
- package/dist/production/src/commands/migrations/MigrationDiffCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationDiffCommand.js +39 -3
- package/dist/production/src/commands/migrations/MigrationDiffCommand.js.map +1 -1
- package/dist/production/src/commands/migrations/MigrationExecuteCommand.cjs +3 -1
- package/dist/production/src/commands/migrations/MigrationExecuteCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationExecuteCommand.js +3 -1
- package/dist/production/src/commands/migrations/MigrationExecuteCommand.js.map +1 -1
- package/dist/production/src/commands/migrations/MigrationInitStateCommand.cjs +26 -0
- package/dist/production/src/commands/migrations/MigrationInitStateCommand.cjs.map +1 -0
- package/dist/production/src/commands/migrations/MigrationInitStateCommand.js +26 -0
- package/dist/production/src/commands/migrations/MigrationInitStateCommand.js.map +1 -0
- 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/MigrationSnapshotCommand.cjs +28 -0
- package/dist/production/src/commands/migrations/MigrationSnapshotCommand.cjs.map +1 -0
- package/dist/production/src/commands/migrations/MigrationSnapshotCommand.js +28 -0
- package/dist/production/src/commands/migrations/MigrationSnapshotCommand.js.map +1 -0
- 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/migrations/MigrationVerifySnapshotCommand.cjs +23 -0
- package/dist/production/src/commands/migrations/MigrationVerifySnapshotCommand.cjs.map +1 -0
- package/dist/production/src/commands/migrations/MigrationVerifySnapshotCommand.js +23 -0
- package/dist/production/src/commands/migrations/MigrationVerifySnapshotCommand.js.map +1 -0
- package/dist/production/src/commands/project/ProjectGenerateDocumentationCommand.cjs +2 -2
- 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.map +1 -1
- 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/tenant/TenantApplyCommand.cjs +39 -0
- package/dist/production/src/commands/tenant/TenantApplyCommand.cjs.map +1 -0
- package/dist/production/src/commands/tenant/TenantApplyCommand.js +39 -0
- package/dist/production/src/commands/tenant/TenantApplyCommand.js.map +1 -0
- package/dist/production/src/commands/transfer/ExportCommand.cjs.map +1 -1
- 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.map +1 -1
- package/dist/production/src/commands/transfer/TransferCommand.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 +2 -2
- package/dist/production/src/consts.cjs.map +1 -1
- package/dist/production/src/dic.cjs +60 -10
- package/dist/production/src/dic.cjs.map +1 -1
- package/dist/production/src/dic.js +61 -11
- 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 +2 -2
- 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.map +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/fs/DockerComposeManager.cjs +10 -10
- 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/YamlHandler.cjs.map +1 -1
- package/dist/production/src/lib/fs/YamlHandler.js.map +1 -1
- package/dist/production/src/lib/js/EsBuildBuilder.cjs.map +1 -1
- package/dist/production/src/lib/js/EsBuildBuilder.js.map +1 -1
- package/dist/production/src/lib/js/EvalExecutor.cjs.map +1 -1
- 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 +78 -18
- package/dist/production/src/lib/migrations/MigrationExecutionFacade.cjs.map +1 -1
- package/dist/production/src/lib/migrations/MigrationExecutionFacade.js +79 -19
- 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 +5 -1
- package/dist/production/src/lib/migrations/MigrationRebaseFacade.cjs.map +1 -1
- package/dist/production/src/lib/migrations/MigrationRebaseFacade.js +5 -1
- package/dist/production/src/lib/migrations/MigrationRebaseFacade.js.map +1 -1
- package/dist/production/src/lib/migrations/MigrationSnapshotFacade.cjs +171 -0
- package/dist/production/src/lib/migrations/MigrationSnapshotFacade.cjs.map +1 -0
- package/dist/production/src/lib/migrations/MigrationSnapshotFacade.js +171 -0
- package/dist/production/src/lib/migrations/MigrationSnapshotFacade.js.map +1 -0
- 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/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.map +1 -1
- 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/EntityLink.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/components/EntityLink.js.map +1 -1
- package/dist/production/src/lib/project/docs/components/FieldLink.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/components/FieldLink.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/projectDescribe.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/projectDescribe.js.map +1 -1
- package/dist/production/src/lib/schema/SchemaLoader.cjs +5 -5
- 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/SchemaValidationHelper.js.map +1 -1
- package/dist/production/src/lib/tenant/TenantClient.cjs +75 -12
- package/dist/production/src/lib/tenant/TenantClient.cjs.map +1 -1
- package/dist/production/src/lib/tenant/TenantClient.js +75 -12
- package/dist/production/src/lib/tenant/TenantClient.js.map +1 -1
- package/dist/production/src/lib/tenant/TenantConfigApplier.cjs +55 -0
- package/dist/production/src/lib/tenant/TenantConfigApplier.cjs.map +1 -0
- package/dist/production/src/lib/tenant/TenantConfigApplier.js +55 -0
- package/dist/production/src/lib/tenant/TenantConfigApplier.js.map +1 -0
- package/dist/production/src/lib/tenant/TenantConfigLoader.cjs +32 -0
- package/dist/production/src/lib/tenant/TenantConfigLoader.cjs.map +1 -0
- package/dist/production/src/lib/tenant/TenantConfigLoader.js +32 -0
- package/dist/production/src/lib/tenant/TenantConfigLoader.js.map +1 -0
- package/dist/production/src/lib/tenant/tenantConfig.cjs +5 -0
- package/dist/production/src/lib/tenant/tenantConfig.cjs.map +1 -0
- package/dist/production/src/lib/tenant/tenantConfig.js +5 -0
- package/dist/production/src/lib/tenant/tenantConfig.js.map +1 -0
- package/dist/production/src/lib/transfer/DataTransferClient.cjs.map +1 -1
- package/dist/production/src/lib/transfer/DataTransferClient.js.map +1 -1
- package/dist/production/src/lib/workspace/WorkspaceResolver.cjs +6 -6
- 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/actions/ActionsGetEventCommand.d.ts +1 -1
- package/dist/types/commands/actions/ActionsGetEventCommand.d.ts.map +1 -1
- package/dist/types/commands/actions/ActionsListFailedEventsCommand.d.ts +1 -1
- package/dist/types/commands/actions/ActionsListFailedEventsCommand.d.ts.map +1 -1
- package/dist/types/commands/actions/ActionsListVariablesCommand.d.ts +1 -1
- package/dist/types/commands/actions/ActionsListVariablesCommand.d.ts.map +1 -1
- package/dist/types/commands/actions/ActionsRetryEventCommand.d.ts +1 -1
- package/dist/types/commands/actions/ActionsRetryEventCommand.d.ts.map +1 -1
- package/dist/types/commands/actions/ActionsSetVariablesCommand.d.ts +1 -1
- package/dist/types/commands/actions/ActionsSetVariablesCommand.d.ts.map +1 -1
- package/dist/types/commands/actions/ActionsStopEventCommand.d.ts +1 -1
- package/dist/types/commands/actions/ActionsStopEventCommand.d.ts.map +1 -1
- package/dist/types/commands/deploy/DeployCommand.d.ts +7 -6
- package/dist/types/commands/deploy/DeployCommand.d.ts.map +1 -1
- package/dist/types/commands/deploy/index.d.ts +1 -1
- package/dist/types/commands/deploy/index.d.ts.map +1 -1
- package/dist/types/commands/index.d.ts +6 -5
- package/dist/types/commands/index.d.ts.map +1 -1
- package/dist/types/commands/migrations/MigrationAmendCommand.d.ts +8 -7
- package/dist/types/commands/migrations/MigrationAmendCommand.d.ts.map +1 -1
- package/dist/types/commands/migrations/MigrationDescribeCommand.d.ts +1 -1
- package/dist/types/commands/migrations/MigrationDescribeCommand.d.ts.map +1 -1
- package/dist/types/commands/migrations/MigrationDiffCommand.d.ts +8 -5
- package/dist/types/commands/migrations/MigrationDiffCommand.d.ts.map +1 -1
- package/dist/types/commands/migrations/MigrationExecuteCommand.d.ts +2 -1
- package/dist/types/commands/migrations/MigrationExecuteCommand.d.ts.map +1 -1
- package/dist/types/commands/migrations/MigrationInitStateCommand.d.ts +14 -0
- package/dist/types/commands/migrations/MigrationInitStateCommand.d.ts.map +1 -0
- package/dist/types/commands/migrations/MigrationRebaseCommand.d.ts +1 -1
- package/dist/types/commands/migrations/MigrationRebaseCommand.d.ts.map +1 -1
- package/dist/types/commands/migrations/MigrationSnapshotCommand.d.ts +12 -0
- package/dist/types/commands/migrations/MigrationSnapshotCommand.d.ts.map +1 -0
- package/dist/types/commands/migrations/MigrationStatusCommand.d.ts +3 -3
- package/dist/types/commands/migrations/MigrationStatusCommand.d.ts.map +1 -1
- package/dist/types/commands/migrations/MigrationVerifySnapshotCommand.d.ts +12 -0
- package/dist/types/commands/migrations/MigrationVerifySnapshotCommand.d.ts.map +1 -0
- package/dist/types/commands/migrations/index.d.ts +10 -7
- package/dist/types/commands/migrations/index.d.ts.map +1 -1
- package/dist/types/commands/misc/index.d.ts +1 -1
- package/dist/types/commands/misc/index.d.ts.map +1 -1
- package/dist/types/commands/project/ProjectGenerateDocumentationCommand.d.ts +1 -1
- package/dist/types/commands/project/ProjectGenerateDocumentationCommand.d.ts.map +1 -1
- package/dist/types/commands/project/ProjectPrintSchemaCommand.d.ts +1 -1
- package/dist/types/commands/project/ProjectPrintSchemaCommand.d.ts.map +1 -1
- package/dist/types/commands/project/ProjectValidateCommand.d.ts +2 -2
- package/dist/types/commands/project/ProjectValidateCommand.d.ts.map +1 -1
- package/dist/types/commands/project/index.d.ts +3 -3
- package/dist/types/commands/project/index.d.ts.map +1 -1
- package/dist/types/commands/tenant/TenantApplyCommand.d.ts +21 -0
- package/dist/types/commands/tenant/TenantApplyCommand.d.ts.map +1 -0
- package/dist/types/commands/tenant/index.d.ts +2 -0
- package/dist/types/commands/tenant/index.d.ts.map +1 -0
- package/dist/types/commands/transfer/ExportCommand.d.ts +2 -2
- package/dist/types/commands/transfer/ExportCommand.d.ts.map +1 -1
- package/dist/types/commands/transfer/ImportCommand.d.ts +2 -2
- package/dist/types/commands/transfer/ImportCommand.d.ts.map +1 -1
- package/dist/types/commands/transfer/TransferCommand.d.ts +2 -2
- package/dist/types/commands/transfer/TransferCommand.d.ts.map +1 -1
- package/dist/types/commands/transfer/index.d.ts +3 -3
- package/dist/types/commands/transfer/index.d.ts.map +1 -1
- package/dist/types/commands/workspace/WorkspaceUpdateApiCommand.d.ts +1 -1
- package/dist/types/commands/workspace/WorkspaceUpdateApiCommand.d.ts.map +1 -1
- package/dist/types/commands/workspace/index.d.ts +1 -1
- package/dist/types/commands/workspace/index.d.ts.map +1 -1
- package/dist/types/dic.d.ts +54 -32
- package/dist/types/dic.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/SystemClientProvider.d.ts +1 -1
- package/dist/types/lib/SystemClientProvider.d.ts.map +1 -1
- package/dist/types/lib/TenantClientProvider.d.ts +2 -2
- package/dist/types/lib/TenantClientProvider.d.ts.map +1 -1
- package/dist/types/lib/VersionChecker.d.ts +1 -1
- package/dist/types/lib/VersionChecker.d.ts.map +1 -1
- package/dist/types/lib/admin/AdminClient.d.ts +1 -1
- package/dist/types/lib/admin/AdminClient.d.ts.map +1 -1
- package/dist/types/lib/admin/AdminDeployer.d.ts +3 -3
- package/dist/types/lib/admin/AdminDeployer.d.ts.map +1 -1
- package/dist/types/lib/fs/DockerComposeManager.d.ts +2 -2
- package/dist/types/lib/fs/DockerComposeManager.d.ts.map +1 -1
- package/dist/types/lib/fs/YamlHandler.d.ts +2 -2
- package/dist/types/lib/fs/YamlHandler.d.ts.map +1 -1
- package/dist/types/lib/js/EsBuildBuilder.d.ts +1 -1
- package/dist/types/lib/js/EsBuildBuilder.d.ts.map +1 -1
- package/dist/types/lib/js/EvalExecutor.d.ts +1 -1
- package/dist/types/lib/js/EvalExecutor.d.ts.map +1 -1
- package/dist/types/lib/js/JsCodeRunner.d.ts +2 -2
- package/dist/types/lib/js/JsCodeRunner.d.ts.map +1 -1
- package/dist/types/lib/migrations/MigrationExecutionFacade.d.ts +13 -8
- package/dist/types/lib/migrations/MigrationExecutionFacade.d.ts.map +1 -1
- package/dist/types/lib/migrations/MigrationRebaseFacade.d.ts +5 -4
- package/dist/types/lib/migrations/MigrationRebaseFacade.d.ts.map +1 -1
- package/dist/types/lib/migrations/MigrationSnapshotFacade.d.ts +28 -0
- package/dist/types/lib/migrations/MigrationSnapshotFacade.d.ts.map +1 -0
- package/dist/types/lib/migrations/MigrationsStatusFacade.d.ts +2 -2
- package/dist/types/lib/migrations/MigrationsStatusFacade.d.ts.map +1 -1
- package/dist/types/lib/project/RemoteProjectProvider.d.ts +1 -1
- package/dist/types/lib/project/RemoteProjectProvider.d.ts.map +1 -1
- package/dist/types/lib/project/RemoteProjectResolver.d.ts +2 -2
- package/dist/types/lib/project/RemoteProjectResolver.d.ts.map +1 -1
- package/dist/types/lib/project/docs/components/EntityInfo.d.ts +1 -1
- package/dist/types/lib/project/docs/components/EntityInfo.d.ts.map +1 -1
- package/dist/types/lib/project/docs/components/OnDelete.d.ts +1 -1
- package/dist/types/lib/project/docs/components/OnDelete.d.ts.map +1 -1
- package/dist/types/lib/schema/SchemaLoader.d.ts +2 -2
- package/dist/types/lib/schema/SchemaLoader.d.ts.map +1 -1
- package/dist/types/lib/tenant/TenantClient.d.ts +15 -0
- package/dist/types/lib/tenant/TenantClient.d.ts.map +1 -1
- package/dist/types/lib/tenant/TenantConfigApplier.d.ts +18 -0
- package/dist/types/lib/tenant/TenantConfigApplier.d.ts.map +1 -0
- package/dist/types/lib/tenant/TenantConfigLoader.d.ts +16 -0
- package/dist/types/lib/tenant/TenantConfigLoader.d.ts.map +1 -0
- package/dist/types/lib/tenant/tenantConfig.d.ts +74 -0
- package/dist/types/lib/tenant/tenantConfig.d.ts.map +1 -0
- package/dist/types/lib/transfer/DataTransferClient.d.ts +1 -1
- package/dist/types/lib/transfer/DataTransferClient.d.ts.map +1 -1
- package/dist/types/lib/workspace/WorkspaceResolver.d.ts +2 -2
- package/dist/types/lib/workspace/WorkspaceResolver.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +33 -15
- package/src/commands/actions/ActionsGetEventCommand.ts +2 -2
- package/src/commands/actions/ActionsListFailedEventsCommand.ts +2 -2
- package/src/commands/actions/ActionsListVariablesCommand.ts +2 -2
- package/src/commands/actions/ActionsRetryEventCommand.ts +2 -2
- package/src/commands/actions/ActionsSetVariablesCommand.ts +2 -2
- package/src/commands/actions/ActionsStopEventCommand.ts +2 -2
- package/src/commands/deploy/DeployCommand.ts +13 -8
- package/src/commands/deploy/index.ts +1 -1
- package/src/commands/index.ts +6 -5
- package/src/commands/migrations/MigrationAmendCommand.ts +38 -10
- package/src/commands/migrations/MigrationDescribeCommand.ts +1 -1
- package/src/commands/migrations/MigrationDiffCommand.ts +50 -6
- package/src/commands/migrations/MigrationExecuteCommand.ts +6 -1
- package/src/commands/migrations/MigrationInitStateCommand.ts +34 -0
- package/src/commands/migrations/MigrationRebaseCommand.ts +1 -1
- package/src/commands/migrations/MigrationSnapshotCommand.ts +34 -0
- package/src/commands/migrations/MigrationStatusCommand.ts +3 -3
- package/src/commands/migrations/MigrationVerifySnapshotCommand.ts +28 -0
- package/src/commands/migrations/index.ts +10 -7
- package/src/commands/misc/index.ts +1 -1
- package/src/commands/project/ProjectGenerateDocumentationCommand.ts +3 -3
- package/src/commands/project/ProjectPrintSchemaCommand.ts +2 -2
- package/src/commands/project/ProjectValidateCommand.ts +3 -3
- package/src/commands/project/index.ts +3 -3
- package/src/commands/tenant/TenantApplyCommand.ts +57 -0
- package/src/commands/tenant/index.ts +1 -0
- package/src/commands/transfer/ExportCommand.ts +4 -4
- package/src/commands/transfer/ImportCommand.ts +6 -6
- package/src/commands/transfer/TransferCommand.ts +6 -6
- package/src/commands/transfer/index.ts +3 -3
- package/src/commands/workspace/WorkspaceUpdateApiCommand.ts +2 -2
- package/src/commands/workspace/index.ts +1 -1
- package/src/dic.ts +103 -37
- package/src/index.ts +1 -0
- package/src/lib/SystemClientProvider.ts +1 -1
- package/src/lib/TenantClientProvider.ts +2 -2
- package/src/lib/VersionChecker.ts +2 -2
- package/src/lib/admin/AdminClient.ts +2 -2
- package/src/lib/admin/AdminDeployer.ts +3 -3
- package/src/lib/fs/DockerComposeManager.ts +2 -2
- package/src/lib/fs/YamlHandler.ts +2 -2
- package/src/lib/js/EsBuildBuilder.ts +1 -1
- package/src/lib/js/EvalExecutor.ts +1 -1
- package/src/lib/js/JsCodeRunner.ts +2 -2
- package/src/lib/migrations/MigrationExecutionFacade.ts +117 -23
- package/src/lib/migrations/MigrationPrinter.ts +1 -1
- package/src/lib/migrations/MigrationRebaseFacade.ts +10 -3
- package/src/lib/migrations/MigrationSnapshotFacade.ts +218 -0
- package/src/lib/migrations/MigrationsStatusFacade.ts +2 -2
- package/src/lib/migrations/MigrationsValidator.ts +1 -1
- package/src/lib/project/RemoteProjectProvider.ts +1 -1
- package/src/lib/project/RemoteProjectResolver.ts +3 -3
- package/src/lib/project/docs/components/EntityInfo.tsx +6 -6
- package/src/lib/project/docs/components/EntityLink.tsx +1 -1
- package/src/lib/project/docs/components/FieldLink.tsx +2 -2
- package/src/lib/project/docs/components/FieldPermissions.tsx +1 -1
- package/src/lib/project/docs/components/FieldType.tsx +2 -2
- package/src/lib/project/docs/components/OnDelete.tsx +3 -3
- package/src/lib/project/docs/components/ProjectInfo.tsx +3 -3
- package/src/lib/project/docs/projectDescribe.tsx +2 -2
- package/src/lib/schema/SchemaLoader.ts +2 -2
- package/src/lib/schema/SchemaValidationHelper.ts +1 -1
- package/src/lib/tenant/TenantClient.ts +123 -14
- package/src/lib/tenant/TenantConfigApplier.ts +72 -0
- package/src/lib/tenant/TenantConfigLoader.ts +41 -0
- package/src/lib/tenant/tenantConfig.ts +101 -0
- package/src/lib/transfer/DataTransferClient.ts +2 -2
- package/src/lib/workspace/WorkspaceResolver.ts +2 -2
- package/src/run.ts +6 -6
- package/src/tsconfig.json +1 -0
- package/tenant.config.example.ts +64 -0
- package/tests/cases/unit/MigrationAmendCommand.test.ts +156 -0
- package/tests/cases/unit/MigrationExecutionFacade.test.ts +81 -0
- package/tests/cases/unit/MigrationRebaseFacade.test.ts +87 -0
- package/tests/cases/unit/MigrationSnapshotFacade.test.ts +243 -0
- package/tests/tenantConfigApplier.test.ts +87 -0
|
@@ -8,6 +8,7 @@ class MigrationExecuteCommand extends Command {
|
|
|
8
8
|
configuration.description("Executes migrations on Contember server.");
|
|
9
9
|
configuration.option("force").description("Ignore migrations order and missing migrations (dev only)");
|
|
10
10
|
configuration.option("until").valueRequired().description("Execute all migrations leading up to, and inclusive of, a specified migration");
|
|
11
|
+
configuration.option("no-snapshot").valueNone().description("Do not bootstrap a fresh database from snapshot.json; replay every migration instead");
|
|
11
12
|
configuration.option("yes").valueNone().description("Do not ask for confirmation.");
|
|
12
13
|
}
|
|
13
14
|
async execute(input) {
|
|
@@ -16,7 +17,8 @@ class MigrationExecuteCommand extends Command {
|
|
|
16
17
|
await this.migrationExecutorFacade.execute({
|
|
17
18
|
force,
|
|
18
19
|
until,
|
|
19
|
-
requireConfirmation: !input.getOption("yes")
|
|
20
|
+
requireConfirmation: !input.getOption("yes"),
|
|
21
|
+
useSnapshot: input.getOption("no-snapshot") !== true
|
|
20
22
|
});
|
|
21
23
|
}
|
|
22
24
|
}
|
|
@@ -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\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":";
|
|
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.js'\n\ntype Args = {}\n\ntype Options = {\n\tuntil?: string\n\tforce: boolean\n\tyes?: boolean\n\t['no-snapshot']?: 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.option('no-snapshot')\n\t\t\t.valueNone()\n\t\t\t.description('Do not bootstrap a fresh database from snapshot.json; replay every migration instead')\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\tuseSnapshot: input.getOption('no-snapshot') !== true,\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";AAYO,MAAM,gCAAgC,QAAuB;AAAA,EACnE,YACkB,yBAChB;AACD,UAAA;AAFiB,SAAA,0BAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,0CAA0C;AACpE,kBAAc,OAAO,OAAO,EAC1B,YAAY,2DAA2D;AACzE,kBAAc,OAAO,OAAO,EAC1B,cAAA,EACA,YAAY,+EAA+E;AAC7F,kBAAc,OAAO,aAAa,EAChC,UAAA,EACA,YAAY,sFAAsF;AACpG,kBACE,OAAO,KAAK,EACZ,UAAA,EACA,YAAY,8BAA8B;AAAA,EAC7C;AAAA,EAEA,MAAgB,QAAQ,OAA4C;AACnE,UAAM,QAAQ,MAAM,UAAU,OAAO;AACrC,UAAM,QAAQ,MAAM,UAAU,OAAO;AAErC,UAAM,KAAK,wBAAwB,QAAQ;AAAA,MAC1C;AAAA,MACA;AAAA,MACA,qBAAqB,CAAC,MAAM,UAAU,KAAK;AAAA,MAC3C,aAAa,MAAM,UAAU,aAAa,MAAM;AAAA,IAAA,CAChD;AAAA,EACF;AACD;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const cliCommon = require("@contember/cli-common");
|
|
4
|
+
class MigrationInitStateCommand extends cliCommon.Command {
|
|
5
|
+
constructor(schemaLoader, schemaStateManager) {
|
|
6
|
+
super();
|
|
7
|
+
this.schemaLoader = schemaLoader;
|
|
8
|
+
this.schemaStateManager = schemaStateManager;
|
|
9
|
+
}
|
|
10
|
+
configure(configuration) {
|
|
11
|
+
configuration.description("Enables schema state mode by extracting ACL, validation, actions and settings into the state/ directory");
|
|
12
|
+
}
|
|
13
|
+
async execute() {
|
|
14
|
+
if (await this.schemaStateManager.isStateMode()) {
|
|
15
|
+
console.log("Schema state mode is already enabled");
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
18
|
+
const schema = await this.schemaLoader.loadSchema();
|
|
19
|
+
await this.schemaStateManager.extractState(schema);
|
|
20
|
+
console.log("Schema state mode enabled. ACL, validation, actions and settings are now managed in the state/ directory.");
|
|
21
|
+
console.log("These parts of the schema will no longer be written into migrations.");
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.MigrationInitStateCommand = MigrationInitStateCommand;
|
|
26
|
+
//# sourceMappingURL=MigrationInitStateCommand.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationInitStateCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationInitStateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { SchemaStateManager } from '@contember/migrations-client'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader.js'\n\ntype Args = {}\n\ntype Options = {}\n\nexport class MigrationInitStateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaStateManager: SchemaStateManager,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Enables schema state mode by extracting ACL, validation, actions and settings into the state/ directory')\n\t}\n\n\tprotected async execute(): Promise<number> {\n\t\tif (await this.schemaStateManager.isStateMode()) {\n\t\t\tconsole.log('Schema state mode is already enabled')\n\t\t\treturn 0\n\t\t}\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\tawait this.schemaStateManager.extractState(schema)\n\n\t\tconsole.log('Schema state mode enabled. ACL, validation, actions and settings are now managed in the state/ directory.')\n\t\tconsole.log('These parts of the schema will no longer be written into migrations.')\n\t\treturn 0\n\t}\n}\n"],"names":["Command"],"mappings":";;;AAQO,MAAM,kCAAkCA,UAAAA,QAAuB;AAAA,EACrE,YACkB,cACA,oBAChB;AACD,UAAA;AAHiB,SAAA,eAAA;AACA,SAAA,qBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,yGAAyG;AAAA,EACpI;AAAA,EAEA,MAAgB,UAA2B;AAC1C,QAAI,MAAM,KAAK,mBAAmB,eAAe;AAChD,cAAQ,IAAI,sCAAsC;AAClD,aAAO;AAAA,IACR;AAEA,UAAM,SAAS,MAAM,KAAK,aAAa,WAAA;AACvC,UAAM,KAAK,mBAAmB,aAAa,MAAM;AAEjD,YAAQ,IAAI,2GAA2G;AACvH,YAAQ,IAAI,sEAAsE;AAClF,WAAO;AAAA,EACR;AACD;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Command } from "@contember/cli-common";
|
|
2
|
+
class MigrationInitStateCommand extends Command {
|
|
3
|
+
constructor(schemaLoader, schemaStateManager) {
|
|
4
|
+
super();
|
|
5
|
+
this.schemaLoader = schemaLoader;
|
|
6
|
+
this.schemaStateManager = schemaStateManager;
|
|
7
|
+
}
|
|
8
|
+
configure(configuration) {
|
|
9
|
+
configuration.description("Enables schema state mode by extracting ACL, validation, actions and settings into the state/ directory");
|
|
10
|
+
}
|
|
11
|
+
async execute() {
|
|
12
|
+
if (await this.schemaStateManager.isStateMode()) {
|
|
13
|
+
console.log("Schema state mode is already enabled");
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
const schema = await this.schemaLoader.loadSchema();
|
|
17
|
+
await this.schemaStateManager.extractState(schema);
|
|
18
|
+
console.log("Schema state mode enabled. ACL, validation, actions and settings are now managed in the state/ directory.");
|
|
19
|
+
console.log("These parts of the schema will no longer be written into migrations.");
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
MigrationInitStateCommand
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=MigrationInitStateCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationInitStateCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationInitStateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { SchemaStateManager } from '@contember/migrations-client'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader.js'\n\ntype Args = {}\n\ntype Options = {}\n\nexport class MigrationInitStateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaStateManager: SchemaStateManager,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Enables schema state mode by extracting ACL, validation, actions and settings into the state/ directory')\n\t}\n\n\tprotected async execute(): Promise<number> {\n\t\tif (await this.schemaStateManager.isStateMode()) {\n\t\t\tconsole.log('Schema state mode is already enabled')\n\t\t\treturn 0\n\t\t}\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\tawait this.schemaStateManager.extractState(schema)\n\n\t\tconsole.log('Schema state mode enabled. ACL, validation, actions and settings are now managed in the state/ directory.')\n\t\tconsole.log('These parts of the schema will no longer be written into migrations.')\n\t\treturn 0\n\t}\n}\n"],"names":[],"mappings":";AAQO,MAAM,kCAAkC,QAAuB;AAAA,EACrE,YACkB,cACA,oBAChB;AACD,UAAA;AAHiB,SAAA,eAAA;AACA,SAAA,qBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,yGAAyG;AAAA,EACpI;AAAA,EAEA,MAAgB,UAA2B;AAC1C,QAAI,MAAM,KAAK,mBAAmB,eAAe;AAChD,cAAQ,IAAI,sCAAsC;AAClD,aAAO;AAAA,IACR;AAEA,UAAM,SAAS,MAAM,KAAK,aAAa,WAAA;AACvC,UAAM,KAAK,mBAAmB,aAAa,MAAM;AAEjD,YAAQ,IAAI,2GAA2G;AACvH,YAAQ,IAAI,sEAAsE;AAClF,WAAO;AAAA,EACR;AACD;"}
|
|
@@ -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\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\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;AACD,UAAA;AAHiB,SAAA,qBAAA;AACA,SAAA,wBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,uDAAuD;AACjF,kBAAc,SAAS,WAAW,EAAE,SAAA;AACpC,kBACE,OAAO,KAAK,EACZ,UAAA,EACA,YAAY,8BAA8B;AAAA,EAC7C;AAAA,EAEA,MAAgB,QAAQ,OAA4C;AACnE,UAAM,iBAAiB,MAAM,YAAY,WAAW;AAEpD,UAAM,aAA0B,CAAA;AAChC,eAAW,iBAAiB,gBAAgB;AAC3C,YAAM,YAAY,MAAM,KAAK,mBAAmB,6BAA6B,aAAa;AAC1F,UAAI,CAAC,WAAW;AACf,cAAM,aAAa,aAAa;AAAA,MACjC;AACA,iBAAW,KAAK,SAAS;AAAA,IAC1B;AAEA,YAAQ,IAAI,eAAe,WAAW,IAAI,CAAA,OAAM,GAAG,IAAI,EAAE,KAAK,IAAI,CAAC;AACnE,UAAM,KAAK,sBAAsB,OAAO,UAAU;AAClD,YAAQ,IAAI,MAAM;AAAA,EACnB;AACD;;"}
|
|
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.js'\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\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\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;AACD,UAAA;AAHiB,SAAA,qBAAA;AACA,SAAA,wBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,uDAAuD;AACjF,kBAAc,SAAS,WAAW,EAAE,SAAA;AACpC,kBACE,OAAO,KAAK,EACZ,UAAA,EACA,YAAY,8BAA8B;AAAA,EAC7C;AAAA,EAEA,MAAgB,QAAQ,OAA4C;AACnE,UAAM,iBAAiB,MAAM,YAAY,WAAW;AAEpD,UAAM,aAA0B,CAAA;AAChC,eAAW,iBAAiB,gBAAgB;AAC3C,YAAM,YAAY,MAAM,KAAK,mBAAmB,6BAA6B,aAAa;AAC1F,UAAI,CAAC,WAAW;AACf,cAAM,aAAa,aAAa;AAAA,MACjC;AACA,iBAAW,KAAK,SAAS;AAAA,IAC1B;AAEA,YAAQ,IAAI,eAAe,WAAW,IAAI,CAAA,OAAM,GAAG,IAAI,EAAE,KAAK,IAAI,CAAC;AACnE,UAAM,KAAK,sBAAsB,OAAO,UAAU;AAClD,YAAQ,IAAI,MAAM;AAAA,EACnB;AACD;;"}
|
|
@@ -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\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\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;AACD,UAAA;AAHiB,SAAA,qBAAA;AACA,SAAA,wBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,uDAAuD;AACjF,kBAAc,SAAS,WAAW,EAAE,SAAA;AACpC,kBACE,OAAO,KAAK,EACZ,UAAA,EACA,YAAY,8BAA8B;AAAA,EAC7C;AAAA,EAEA,MAAgB,QAAQ,OAA4C;AACnE,UAAM,iBAAiB,MAAM,YAAY,WAAW;AAEpD,UAAM,aAA0B,CAAA;AAChC,eAAW,iBAAiB,gBAAgB;AAC3C,YAAM,YAAY,MAAM,KAAK,mBAAmB,6BAA6B,aAAa;AAC1F,UAAI,CAAC,WAAW;AACf,cAAM,aAAa,aAAa;AAAA,MACjC;AACA,iBAAW,KAAK,SAAS;AAAA,IAC1B;AAEA,YAAQ,IAAI,eAAe,WAAW,IAAI,CAAA,OAAM,GAAG,IAAI,EAAE,KAAK,IAAI,CAAC;AACnE,UAAM,KAAK,sBAAsB,OAAO,UAAU;AAClD,YAAQ,IAAI,MAAM;AAAA,EACnB;AACD;"}
|
|
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.js'\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\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\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;AACD,UAAA;AAHiB,SAAA,qBAAA;AACA,SAAA,wBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,uDAAuD;AACjF,kBAAc,SAAS,WAAW,EAAE,SAAA;AACpC,kBACE,OAAO,KAAK,EACZ,UAAA,EACA,YAAY,8BAA8B;AAAA,EAC7C;AAAA,EAEA,MAAgB,QAAQ,OAA4C;AACnE,UAAM,iBAAiB,MAAM,YAAY,WAAW;AAEpD,UAAM,aAA0B,CAAA;AAChC,eAAW,iBAAiB,gBAAgB;AAC3C,YAAM,YAAY,MAAM,KAAK,mBAAmB,6BAA6B,aAAa;AAC1F,UAAI,CAAC,WAAW;AACf,cAAM,aAAa,aAAa;AAAA,MACjC;AACA,iBAAW,KAAK,SAAS;AAAA,IAC1B;AAEA,YAAQ,IAAI,eAAe,WAAW,IAAI,CAAA,OAAM,GAAG,IAAI,EAAE,KAAK,IAAI,CAAC;AACnE,UAAM,KAAK,sBAAsB,OAAO,UAAU;AAClD,YAAQ,IAAI,MAAM;AAAA,EACnB;AACD;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const cliCommon = require("@contember/cli-common");
|
|
4
|
+
class MigrationSnapshotCommand extends cliCommon.Command {
|
|
5
|
+
constructor(migrationSnapshotFacade) {
|
|
6
|
+
super();
|
|
7
|
+
this.migrationSnapshotFacade = migrationSnapshotFacade;
|
|
8
|
+
}
|
|
9
|
+
configure(configuration) {
|
|
10
|
+
configuration.description(
|
|
11
|
+
"Creates a schema snapshot (snapshot.json) that bootstraps a fresh database in one step instead of replaying every migration"
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
async execute(input) {
|
|
15
|
+
const snapshot = await this.migrationSnapshotFacade.create();
|
|
16
|
+
console.log(`Snapshot created: ${snapshot.covers.length} migrations collapsed up to ${snapshot.version}.`);
|
|
17
|
+
if (snapshot.contentMigrations.length > 0) {
|
|
18
|
+
console.warn("");
|
|
19
|
+
console.warn(`Warning: ${snapshot.contentMigrations.length} content (data) migration(s) are covered by this snapshot:`);
|
|
20
|
+
snapshot.contentMigrations.forEach((version) => console.warn(` - ${version}`));
|
|
21
|
+
console.warn("Their data effects are NOT reproduced when bootstrapping from the snapshot.");
|
|
22
|
+
console.warn("Seed any required data manually for local development.");
|
|
23
|
+
}
|
|
24
|
+
return 0;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.MigrationSnapshotCommand = MigrationSnapshotCommand;
|
|
28
|
+
//# sourceMappingURL=MigrationSnapshotCommand.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationSnapshotCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationSnapshotCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationSnapshotFacade } from '../../lib/migrations/MigrationSnapshotFacade.js'\n\ntype Args = {}\n\ntype Options = {}\n\nexport class MigrationSnapshotCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationSnapshotFacade: MigrationSnapshotFacade,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description(\n\t\t\t'Creates a schema snapshot (snapshot.json) that bootstraps a fresh database in one step instead of replaying every migration',\n\t\t)\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst snapshot = await this.migrationSnapshotFacade.create()\n\t\tconsole.log(`Snapshot created: ${snapshot.covers.length} migrations collapsed up to ${snapshot.version}.`)\n\n\t\tif (snapshot.contentMigrations.length > 0) {\n\t\t\tconsole.warn('')\n\t\t\tconsole.warn(`Warning: ${snapshot.contentMigrations.length} content (data) migration(s) are covered by this snapshot:`)\n\t\t\tsnapshot.contentMigrations.forEach(version => console.warn(` - ${version}`))\n\t\t\tconsole.warn('Their data effects are NOT reproduced when bootstrapping from the snapshot.')\n\t\t\tconsole.warn('Seed any required data manually for local development.')\n\t\t}\n\t\treturn 0\n\t}\n}\n"],"names":["Command"],"mappings":";;;AAOO,MAAM,iCAAiCA,UAAAA,QAAuB;AAAA,EACpE,YACkB,yBAChB;AACD,UAAA;AAFiB,SAAA,0BAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc;AAAA,MACb;AAAA,IAAA;AAAA,EAEF;AAAA,EAEA,MAAgB,QAAQ,OAA8C;AACrE,UAAM,WAAW,MAAM,KAAK,wBAAwB,OAAA;AACpD,YAAQ,IAAI,qBAAqB,SAAS,OAAO,MAAM,+BAA+B,SAAS,OAAO,GAAG;AAEzG,QAAI,SAAS,kBAAkB,SAAS,GAAG;AAC1C,cAAQ,KAAK,EAAE;AACf,cAAQ,KAAK,YAAY,SAAS,kBAAkB,MAAM,4DAA4D;AACtH,eAAS,kBAAkB,QAAQ,CAAA,YAAW,QAAQ,KAAK,OAAO,OAAO,EAAE,CAAC;AAC5E,cAAQ,KAAK,6EAA6E;AAC1F,cAAQ,KAAK,wDAAwD;AAAA,IACtE;AACA,WAAO;AAAA,EACR;AACD;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Command } from "@contember/cli-common";
|
|
2
|
+
class MigrationSnapshotCommand extends Command {
|
|
3
|
+
constructor(migrationSnapshotFacade) {
|
|
4
|
+
super();
|
|
5
|
+
this.migrationSnapshotFacade = migrationSnapshotFacade;
|
|
6
|
+
}
|
|
7
|
+
configure(configuration) {
|
|
8
|
+
configuration.description(
|
|
9
|
+
"Creates a schema snapshot (snapshot.json) that bootstraps a fresh database in one step instead of replaying every migration"
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
async execute(input) {
|
|
13
|
+
const snapshot = await this.migrationSnapshotFacade.create();
|
|
14
|
+
console.log(`Snapshot created: ${snapshot.covers.length} migrations collapsed up to ${snapshot.version}.`);
|
|
15
|
+
if (snapshot.contentMigrations.length > 0) {
|
|
16
|
+
console.warn("");
|
|
17
|
+
console.warn(`Warning: ${snapshot.contentMigrations.length} content (data) migration(s) are covered by this snapshot:`);
|
|
18
|
+
snapshot.contentMigrations.forEach((version) => console.warn(` - ${version}`));
|
|
19
|
+
console.warn("Their data effects are NOT reproduced when bootstrapping from the snapshot.");
|
|
20
|
+
console.warn("Seed any required data manually for local development.");
|
|
21
|
+
}
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
MigrationSnapshotCommand
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=MigrationSnapshotCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationSnapshotCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationSnapshotCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationSnapshotFacade } from '../../lib/migrations/MigrationSnapshotFacade.js'\n\ntype Args = {}\n\ntype Options = {}\n\nexport class MigrationSnapshotCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationSnapshotFacade: MigrationSnapshotFacade,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description(\n\t\t\t'Creates a schema snapshot (snapshot.json) that bootstraps a fresh database in one step instead of replaying every migration',\n\t\t)\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst snapshot = await this.migrationSnapshotFacade.create()\n\t\tconsole.log(`Snapshot created: ${snapshot.covers.length} migrations collapsed up to ${snapshot.version}.`)\n\n\t\tif (snapshot.contentMigrations.length > 0) {\n\t\t\tconsole.warn('')\n\t\t\tconsole.warn(`Warning: ${snapshot.contentMigrations.length} content (data) migration(s) are covered by this snapshot:`)\n\t\t\tsnapshot.contentMigrations.forEach(version => console.warn(` - ${version}`))\n\t\t\tconsole.warn('Their data effects are NOT reproduced when bootstrapping from the snapshot.')\n\t\t\tconsole.warn('Seed any required data manually for local development.')\n\t\t}\n\t\treturn 0\n\t}\n}\n"],"names":[],"mappings":";AAOO,MAAM,iCAAiC,QAAuB;AAAA,EACpE,YACkB,yBAChB;AACD,UAAA;AAFiB,SAAA,0BAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc;AAAA,MACb;AAAA,IAAA;AAAA,EAEF;AAAA,EAEA,MAAgB,QAAQ,OAA8C;AACrE,UAAM,WAAW,MAAM,KAAK,wBAAwB,OAAA;AACpD,YAAQ,IAAI,qBAAqB,SAAS,OAAO,MAAM,+BAA+B,SAAS,OAAO,GAAG;AAEzG,QAAI,SAAS,kBAAkB,SAAS,GAAG;AAC1C,cAAQ,KAAK,EAAE;AACf,cAAQ,KAAK,YAAY,SAAS,kBAAkB,MAAM,4DAA4D;AACtH,eAAS,kBAAkB,QAAQ,CAAA,YAAW,QAAQ,KAAK,OAAO,OAAO,EAAE,CAAC;AAC5E,cAAQ,KAAK,6EAA6E;AAC1F,cAAQ,KAAK,wDAAwD;AAAA,IACtE;AACA,WAAO;AAAA,EACR;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationStatusCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationStatusCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationFilesManager, MigrationState, sortMigrations, SystemClient } from '@contember/migrations-client'\nimport chalk from 'chalk'\nimport { MigrationsStatusFacade } from '../../lib/migrations/MigrationsStatusFacade'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { SystemClientProvider } from '../../lib/SystemClientProvider'\n\ntype Args = {}\n\ntype Options = {\n\t['only-to-execute']?: true\n\t['only-errors']?: true\n\t['restore-missing']?: true\n}\n\nexport class MigrationStatusCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationsStatusFacade: MigrationsStatusFacade,\n\t\tprivate readonly migrationFilesManager: MigrationFilesManager,\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Shows status of executed migrations on an instance & sync status')\n\t\tconfiguration //\n\t\t\t.option('only-errors')\n\t\t\t.valueNone()\n\t\t\t.description('Show only migrations with an error.')\n\t\tconfiguration //\n\t\t\t.option('only-to-execute')\n\t\t\t.valueNone()\n\t\t\t.description('Show only migrations to execute.')\n\t\tconfiguration //\n\t\t\t.option('restore-missing')\n\t\t\t.valueNone()\n\t\t\t.description('Restores migrations locally missing')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst onlyErrors = input.getOption('only-errors')\n\t\tconst onlyToExecute = input.getOption('only-to-execute')\n\t\tconst restoreMissing = input.getOption('restore-missing')\n\n\t\tlet status = await this.migrationsStatusFacade.resolveMigrationsStatus({ allowError: true })\n\n\t\tif (restoreMissing) {\n\t\t\tconst missing = status.errorMigrations.filter(it => it.state === MigrationState.EXECUTED_MISSING)\n\t\t\tfor (const migration of missing) {\n\t\t\t\tconsole.log(`Restoring migration ${migration.name}`)\n\t\t\t\tconst fullMigration = await this.systemClientProvider.get().getExecutedMigration(migration.version)\n\t\t\t\tawait this.migrationFilesManager.createFile(\n\t\t\t\t\tJSON.stringify(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformatVersion: fullMigration.formatVersion,\n\t\t\t\t\t\t\tmodifications: fullMigration.modifications,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t'\\t',\n\t\t\t\t\t) + '\\n',\n\t\t\t\t\tfullMigration.name,\n\t\t\t\t)\n\t\t\t}\n\t\t\tstatus = await this.migrationsStatusFacade.resolveMigrationsStatus({})\n\t\t}\n\n\t\tconst filtered = onlyErrors || onlyToExecute\n\t\t\t? sortMigrations([\n\t\t\t\t...(onlyErrors ? status.errorMigrations : []),\n\t\t\t\t...(onlyToExecute ? status.migrationsToExecute : []),\n\t\t\t])\n\t\t\t: status.allMigrations\n\n\t\tconsole.log(this.migrationPrinter.printStatusTable(filtered))\n\n\t\tconst hasErrors = status.errorMigrations.length > 0\n\n\t\tif (hasErrors) {\n\t\t\tconsole.error(chalk.redBright('Some migrations are broken'))\n\t\t}\n\n\t\treturn hasErrors ? 1 : 0\n\t}\n}\n"],"names":["Command","MigrationState","sortMigrations"],"mappings":";;;;;AAeO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,wBACA,uBACA,sBACA,kBAChB;AACD,UAAA;AALiB,SAAA,yBAAA;AACA,SAAA,wBAAA;AACA,SAAA,uBAAA;AACA,SAAA,mBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,kEAAkE;AAC5F,kBACE,OAAO,aAAa,EACpB,UAAA,EACA,YAAY,qCAAqC;AACnD,kBACE,OAAO,iBAAiB,EACxB,UAAA,EACA,YAAY,kCAAkC;AAChD,kBACE,OAAO,iBAAiB,EACxB,UAAA,EACA,YAAY,qCAAqC;AAAA,EACpD;AAAA,EAEA,MAAgB,QAAQ,OAA8C;AACrE,UAAM,aAAa,MAAM,UAAU,aAAa;AAChD,UAAM,gBAAgB,MAAM,UAAU,iBAAiB;AACvD,UAAM,iBAAiB,MAAM,UAAU,iBAAiB;AAExD,QAAI,SAAS,MAAM,KAAK,uBAAuB,wBAAwB,EAAE,YAAY,MAAM;AAE3F,QAAI,gBAAgB;AACnB,YAAM,UAAU,OAAO,gBAAgB,OAAO,QAAM,GAAG,UAAUC,iBAAAA,eAAe,gBAAgB;AAChG,iBAAW,aAAa,SAAS;AAChC,gBAAQ,IAAI,uBAAuB,UAAU,IAAI,EAAE;AACnD,cAAM,gBAAgB,MAAM,KAAK,qBAAqB,MAAM,qBAAqB,UAAU,OAAO;AAClG,cAAM,KAAK,sBAAsB;AAAA,UAChC,KAAK;AAAA,YACJ;AAAA,cACC,eAAe,cAAc;AAAA,cAC7B,eAAe,cAAc;AAAA,YAAA;AAAA,YAE9B;AAAA,YACA;AAAA,UAAA,IACG;AAAA,UACJ,cAAc;AAAA,QAAA;AAAA,MAEhB;AACA,eAAS,MAAM,KAAK,uBAAuB,wBAAwB,CAAA,CAAE;AAAA,IACtE;AAEA,UAAM,WAAW,cAAc,gBAC5BC,gCAAe;AAAA,MAChB,GAAI,aAAa,OAAO,kBAAkB,CAAA;AAAA,MAC1C,GAAI,gBAAgB,OAAO,sBAAsB,CAAA;AAAA,IAAC,CAClD,IACC,OAAO;AAEV,YAAQ,IAAI,KAAK,iBAAiB,iBAAiB,QAAQ,CAAC;AAE5D,UAAM,YAAY,OAAO,gBAAgB,SAAS;AAElD,QAAI,WAAW;AACd,cAAQ,MAAM,MAAM,UAAU,4BAA4B,CAAC;AAAA,IAC5D;AAEA,WAAO,YAAY,IAAI;AAAA,EACxB;AACD;;"}
|
|
1
|
+
{"version":3,"file":"MigrationStatusCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationStatusCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationFilesManager, MigrationState, sortMigrations, SystemClient } from '@contember/migrations-client'\nimport chalk from 'chalk'\nimport { MigrationsStatusFacade } from '../../lib/migrations/MigrationsStatusFacade.js'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter.js'\nimport { SystemClientProvider } from '../../lib/SystemClientProvider.js'\n\ntype Args = {}\n\ntype Options = {\n\t['only-to-execute']?: true\n\t['only-errors']?: true\n\t['restore-missing']?: true\n}\n\nexport class MigrationStatusCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationsStatusFacade: MigrationsStatusFacade,\n\t\tprivate readonly migrationFilesManager: MigrationFilesManager,\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Shows status of executed migrations on an instance & sync status')\n\t\tconfiguration //\n\t\t\t.option('only-errors')\n\t\t\t.valueNone()\n\t\t\t.description('Show only migrations with an error.')\n\t\tconfiguration //\n\t\t\t.option('only-to-execute')\n\t\t\t.valueNone()\n\t\t\t.description('Show only migrations to execute.')\n\t\tconfiguration //\n\t\t\t.option('restore-missing')\n\t\t\t.valueNone()\n\t\t\t.description('Restores migrations locally missing')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst onlyErrors = input.getOption('only-errors')\n\t\tconst onlyToExecute = input.getOption('only-to-execute')\n\t\tconst restoreMissing = input.getOption('restore-missing')\n\n\t\tlet status = await this.migrationsStatusFacade.resolveMigrationsStatus({ allowError: true })\n\n\t\tif (restoreMissing) {\n\t\t\tconst missing = status.errorMigrations.filter(it => it.state === MigrationState.EXECUTED_MISSING)\n\t\t\tfor (const migration of missing) {\n\t\t\t\tconsole.log(`Restoring migration ${migration.name}`)\n\t\t\t\tconst fullMigration = await this.systemClientProvider.get().getExecutedMigration(migration.version)\n\t\t\t\tawait this.migrationFilesManager.createFile(\n\t\t\t\t\tJSON.stringify(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformatVersion: fullMigration.formatVersion,\n\t\t\t\t\t\t\tmodifications: fullMigration.modifications,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t'\\t',\n\t\t\t\t\t) + '\\n',\n\t\t\t\t\tfullMigration.name,\n\t\t\t\t)\n\t\t\t}\n\t\t\tstatus = await this.migrationsStatusFacade.resolveMigrationsStatus({})\n\t\t}\n\n\t\tconst filtered = onlyErrors || onlyToExecute\n\t\t\t? sortMigrations([\n\t\t\t\t...(onlyErrors ? status.errorMigrations : []),\n\t\t\t\t...(onlyToExecute ? status.migrationsToExecute : []),\n\t\t\t])\n\t\t\t: status.allMigrations\n\n\t\tconsole.log(this.migrationPrinter.printStatusTable(filtered))\n\n\t\tconst hasErrors = status.errorMigrations.length > 0\n\n\t\tif (hasErrors) {\n\t\t\tconsole.error(chalk.redBright('Some migrations are broken'))\n\t\t}\n\n\t\treturn hasErrors ? 1 : 0\n\t}\n}\n"],"names":["Command","MigrationState","sortMigrations"],"mappings":";;;;;AAeO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,wBACA,uBACA,sBACA,kBAChB;AACD,UAAA;AALiB,SAAA,yBAAA;AACA,SAAA,wBAAA;AACA,SAAA,uBAAA;AACA,SAAA,mBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,kEAAkE;AAC5F,kBACE,OAAO,aAAa,EACpB,UAAA,EACA,YAAY,qCAAqC;AACnD,kBACE,OAAO,iBAAiB,EACxB,UAAA,EACA,YAAY,kCAAkC;AAChD,kBACE,OAAO,iBAAiB,EACxB,UAAA,EACA,YAAY,qCAAqC;AAAA,EACpD;AAAA,EAEA,MAAgB,QAAQ,OAA8C;AACrE,UAAM,aAAa,MAAM,UAAU,aAAa;AAChD,UAAM,gBAAgB,MAAM,UAAU,iBAAiB;AACvD,UAAM,iBAAiB,MAAM,UAAU,iBAAiB;AAExD,QAAI,SAAS,MAAM,KAAK,uBAAuB,wBAAwB,EAAE,YAAY,MAAM;AAE3F,QAAI,gBAAgB;AACnB,YAAM,UAAU,OAAO,gBAAgB,OAAO,QAAM,GAAG,UAAUC,iBAAAA,eAAe,gBAAgB;AAChG,iBAAW,aAAa,SAAS;AAChC,gBAAQ,IAAI,uBAAuB,UAAU,IAAI,EAAE;AACnD,cAAM,gBAAgB,MAAM,KAAK,qBAAqB,MAAM,qBAAqB,UAAU,OAAO;AAClG,cAAM,KAAK,sBAAsB;AAAA,UAChC,KAAK;AAAA,YACJ;AAAA,cACC,eAAe,cAAc;AAAA,cAC7B,eAAe,cAAc;AAAA,YAAA;AAAA,YAE9B;AAAA,YACA;AAAA,UAAA,IACG;AAAA,UACJ,cAAc;AAAA,QAAA;AAAA,MAEhB;AACA,eAAS,MAAM,KAAK,uBAAuB,wBAAwB,CAAA,CAAE;AAAA,IACtE;AAEA,UAAM,WAAW,cAAc,gBAC5BC,gCAAe;AAAA,MAChB,GAAI,aAAa,OAAO,kBAAkB,CAAA;AAAA,MAC1C,GAAI,gBAAgB,OAAO,sBAAsB,CAAA;AAAA,IAAC,CAClD,IACC,OAAO;AAEV,YAAQ,IAAI,KAAK,iBAAiB,iBAAiB,QAAQ,CAAC;AAE5D,UAAM,YAAY,OAAO,gBAAgB,SAAS;AAElD,QAAI,WAAW;AACd,cAAQ,MAAM,MAAM,UAAU,4BAA4B,CAAC;AAAA,IAC5D;AAEA,WAAO,YAAY,IAAI;AAAA,EACxB;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationStatusCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationStatusCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationFilesManager, MigrationState, sortMigrations, SystemClient } from '@contember/migrations-client'\nimport chalk from 'chalk'\nimport { MigrationsStatusFacade } from '../../lib/migrations/MigrationsStatusFacade'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { SystemClientProvider } from '../../lib/SystemClientProvider'\n\ntype Args = {}\n\ntype Options = {\n\t['only-to-execute']?: true\n\t['only-errors']?: true\n\t['restore-missing']?: true\n}\n\nexport class MigrationStatusCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationsStatusFacade: MigrationsStatusFacade,\n\t\tprivate readonly migrationFilesManager: MigrationFilesManager,\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Shows status of executed migrations on an instance & sync status')\n\t\tconfiguration //\n\t\t\t.option('only-errors')\n\t\t\t.valueNone()\n\t\t\t.description('Show only migrations with an error.')\n\t\tconfiguration //\n\t\t\t.option('only-to-execute')\n\t\t\t.valueNone()\n\t\t\t.description('Show only migrations to execute.')\n\t\tconfiguration //\n\t\t\t.option('restore-missing')\n\t\t\t.valueNone()\n\t\t\t.description('Restores migrations locally missing')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst onlyErrors = input.getOption('only-errors')\n\t\tconst onlyToExecute = input.getOption('only-to-execute')\n\t\tconst restoreMissing = input.getOption('restore-missing')\n\n\t\tlet status = await this.migrationsStatusFacade.resolveMigrationsStatus({ allowError: true })\n\n\t\tif (restoreMissing) {\n\t\t\tconst missing = status.errorMigrations.filter(it => it.state === MigrationState.EXECUTED_MISSING)\n\t\t\tfor (const migration of missing) {\n\t\t\t\tconsole.log(`Restoring migration ${migration.name}`)\n\t\t\t\tconst fullMigration = await this.systemClientProvider.get().getExecutedMigration(migration.version)\n\t\t\t\tawait this.migrationFilesManager.createFile(\n\t\t\t\t\tJSON.stringify(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformatVersion: fullMigration.formatVersion,\n\t\t\t\t\t\t\tmodifications: fullMigration.modifications,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t'\\t',\n\t\t\t\t\t) + '\\n',\n\t\t\t\t\tfullMigration.name,\n\t\t\t\t)\n\t\t\t}\n\t\t\tstatus = await this.migrationsStatusFacade.resolveMigrationsStatus({})\n\t\t}\n\n\t\tconst filtered = onlyErrors || onlyToExecute\n\t\t\t? sortMigrations([\n\t\t\t\t...(onlyErrors ? status.errorMigrations : []),\n\t\t\t\t...(onlyToExecute ? status.migrationsToExecute : []),\n\t\t\t])\n\t\t\t: status.allMigrations\n\n\t\tconsole.log(this.migrationPrinter.printStatusTable(filtered))\n\n\t\tconst hasErrors = status.errorMigrations.length > 0\n\n\t\tif (hasErrors) {\n\t\t\tconsole.error(chalk.redBright('Some migrations are broken'))\n\t\t}\n\n\t\treturn hasErrors ? 1 : 0\n\t}\n}\n"],"names":[],"mappings":";;;AAeO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,wBACA,uBACA,sBACA,kBAChB;AACD,UAAA;AALiB,SAAA,yBAAA;AACA,SAAA,wBAAA;AACA,SAAA,uBAAA;AACA,SAAA,mBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,kEAAkE;AAC5F,kBACE,OAAO,aAAa,EACpB,UAAA,EACA,YAAY,qCAAqC;AACnD,kBACE,OAAO,iBAAiB,EACxB,UAAA,EACA,YAAY,kCAAkC;AAChD,kBACE,OAAO,iBAAiB,EACxB,UAAA,EACA,YAAY,qCAAqC;AAAA,EACpD;AAAA,EAEA,MAAgB,QAAQ,OAA8C;AACrE,UAAM,aAAa,MAAM,UAAU,aAAa;AAChD,UAAM,gBAAgB,MAAM,UAAU,iBAAiB;AACvD,UAAM,iBAAiB,MAAM,UAAU,iBAAiB;AAExD,QAAI,SAAS,MAAM,KAAK,uBAAuB,wBAAwB,EAAE,YAAY,MAAM;AAE3F,QAAI,gBAAgB;AACnB,YAAM,UAAU,OAAO,gBAAgB,OAAO,QAAM,GAAG,UAAU,eAAe,gBAAgB;AAChG,iBAAW,aAAa,SAAS;AAChC,gBAAQ,IAAI,uBAAuB,UAAU,IAAI,EAAE;AACnD,cAAM,gBAAgB,MAAM,KAAK,qBAAqB,MAAM,qBAAqB,UAAU,OAAO;AAClG,cAAM,KAAK,sBAAsB;AAAA,UAChC,KAAK;AAAA,YACJ;AAAA,cACC,eAAe,cAAc;AAAA,cAC7B,eAAe,cAAc;AAAA,YAAA;AAAA,YAE9B;AAAA,YACA;AAAA,UAAA,IACG;AAAA,UACJ,cAAc;AAAA,QAAA;AAAA,MAEhB;AACA,eAAS,MAAM,KAAK,uBAAuB,wBAAwB,CAAA,CAAE;AAAA,IACtE;AAEA,UAAM,WAAW,cAAc,gBAC5B,eAAe;AAAA,MAChB,GAAI,aAAa,OAAO,kBAAkB,CAAA;AAAA,MAC1C,GAAI,gBAAgB,OAAO,sBAAsB,CAAA;AAAA,IAAC,CAClD,IACC,OAAO;AAEV,YAAQ,IAAI,KAAK,iBAAiB,iBAAiB,QAAQ,CAAC;AAE5D,UAAM,YAAY,OAAO,gBAAgB,SAAS;AAElD,QAAI,WAAW;AACd,cAAQ,MAAM,MAAM,UAAU,4BAA4B,CAAC;AAAA,IAC5D;AAEA,WAAO,YAAY,IAAI;AAAA,EACxB;AACD;"}
|
|
1
|
+
{"version":3,"file":"MigrationStatusCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationStatusCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationFilesManager, MigrationState, sortMigrations, SystemClient } from '@contember/migrations-client'\nimport chalk from 'chalk'\nimport { MigrationsStatusFacade } from '../../lib/migrations/MigrationsStatusFacade.js'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter.js'\nimport { SystemClientProvider } from '../../lib/SystemClientProvider.js'\n\ntype Args = {}\n\ntype Options = {\n\t['only-to-execute']?: true\n\t['only-errors']?: true\n\t['restore-missing']?: true\n}\n\nexport class MigrationStatusCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationsStatusFacade: MigrationsStatusFacade,\n\t\tprivate readonly migrationFilesManager: MigrationFilesManager,\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Shows status of executed migrations on an instance & sync status')\n\t\tconfiguration //\n\t\t\t.option('only-errors')\n\t\t\t.valueNone()\n\t\t\t.description('Show only migrations with an error.')\n\t\tconfiguration //\n\t\t\t.option('only-to-execute')\n\t\t\t.valueNone()\n\t\t\t.description('Show only migrations to execute.')\n\t\tconfiguration //\n\t\t\t.option('restore-missing')\n\t\t\t.valueNone()\n\t\t\t.description('Restores migrations locally missing')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst onlyErrors = input.getOption('only-errors')\n\t\tconst onlyToExecute = input.getOption('only-to-execute')\n\t\tconst restoreMissing = input.getOption('restore-missing')\n\n\t\tlet status = await this.migrationsStatusFacade.resolveMigrationsStatus({ allowError: true })\n\n\t\tif (restoreMissing) {\n\t\t\tconst missing = status.errorMigrations.filter(it => it.state === MigrationState.EXECUTED_MISSING)\n\t\t\tfor (const migration of missing) {\n\t\t\t\tconsole.log(`Restoring migration ${migration.name}`)\n\t\t\t\tconst fullMigration = await this.systemClientProvider.get().getExecutedMigration(migration.version)\n\t\t\t\tawait this.migrationFilesManager.createFile(\n\t\t\t\t\tJSON.stringify(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformatVersion: fullMigration.formatVersion,\n\t\t\t\t\t\t\tmodifications: fullMigration.modifications,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t'\\t',\n\t\t\t\t\t) + '\\n',\n\t\t\t\t\tfullMigration.name,\n\t\t\t\t)\n\t\t\t}\n\t\t\tstatus = await this.migrationsStatusFacade.resolveMigrationsStatus({})\n\t\t}\n\n\t\tconst filtered = onlyErrors || onlyToExecute\n\t\t\t? sortMigrations([\n\t\t\t\t...(onlyErrors ? status.errorMigrations : []),\n\t\t\t\t...(onlyToExecute ? status.migrationsToExecute : []),\n\t\t\t])\n\t\t\t: status.allMigrations\n\n\t\tconsole.log(this.migrationPrinter.printStatusTable(filtered))\n\n\t\tconst hasErrors = status.errorMigrations.length > 0\n\n\t\tif (hasErrors) {\n\t\t\tconsole.error(chalk.redBright('Some migrations are broken'))\n\t\t}\n\n\t\treturn hasErrors ? 1 : 0\n\t}\n}\n"],"names":[],"mappings":";;;AAeO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,wBACA,uBACA,sBACA,kBAChB;AACD,UAAA;AALiB,SAAA,yBAAA;AACA,SAAA,wBAAA;AACA,SAAA,uBAAA;AACA,SAAA,mBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,kEAAkE;AAC5F,kBACE,OAAO,aAAa,EACpB,UAAA,EACA,YAAY,qCAAqC;AACnD,kBACE,OAAO,iBAAiB,EACxB,UAAA,EACA,YAAY,kCAAkC;AAChD,kBACE,OAAO,iBAAiB,EACxB,UAAA,EACA,YAAY,qCAAqC;AAAA,EACpD;AAAA,EAEA,MAAgB,QAAQ,OAA8C;AACrE,UAAM,aAAa,MAAM,UAAU,aAAa;AAChD,UAAM,gBAAgB,MAAM,UAAU,iBAAiB;AACvD,UAAM,iBAAiB,MAAM,UAAU,iBAAiB;AAExD,QAAI,SAAS,MAAM,KAAK,uBAAuB,wBAAwB,EAAE,YAAY,MAAM;AAE3F,QAAI,gBAAgB;AACnB,YAAM,UAAU,OAAO,gBAAgB,OAAO,QAAM,GAAG,UAAU,eAAe,gBAAgB;AAChG,iBAAW,aAAa,SAAS;AAChC,gBAAQ,IAAI,uBAAuB,UAAU,IAAI,EAAE;AACnD,cAAM,gBAAgB,MAAM,KAAK,qBAAqB,MAAM,qBAAqB,UAAU,OAAO;AAClG,cAAM,KAAK,sBAAsB;AAAA,UAChC,KAAK;AAAA,YACJ;AAAA,cACC,eAAe,cAAc;AAAA,cAC7B,eAAe,cAAc;AAAA,YAAA;AAAA,YAE9B;AAAA,YACA;AAAA,UAAA,IACG;AAAA,UACJ,cAAc;AAAA,QAAA;AAAA,MAEhB;AACA,eAAS,MAAM,KAAK,uBAAuB,wBAAwB,CAAA,CAAE;AAAA,IACtE;AAEA,UAAM,WAAW,cAAc,gBAC5B,eAAe;AAAA,MAChB,GAAI,aAAa,OAAO,kBAAkB,CAAA;AAAA,MAC1C,GAAI,gBAAgB,OAAO,sBAAsB,CAAA;AAAA,IAAC,CAClD,IACC,OAAO;AAEV,YAAQ,IAAI,KAAK,iBAAiB,iBAAiB,QAAQ,CAAC;AAE5D,UAAM,YAAY,OAAO,gBAAgB,SAAS;AAElD,QAAI,WAAW;AACd,cAAQ,MAAM,MAAM,UAAU,4BAA4B,CAAC;AAAA,IAC5D;AAEA,WAAO,YAAY,IAAI;AAAA,EACxB;AACD;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const cliCommon = require("@contember/cli-common");
|
|
4
|
+
class MigrationVerifySnapshotCommand extends cliCommon.Command {
|
|
5
|
+
constructor(migrationSnapshotFacade) {
|
|
6
|
+
super();
|
|
7
|
+
this.migrationSnapshotFacade = migrationSnapshotFacade;
|
|
8
|
+
}
|
|
9
|
+
configure(configuration) {
|
|
10
|
+
configuration.description("Verifies that snapshot.json still matches a full replay of all migrations");
|
|
11
|
+
}
|
|
12
|
+
async execute(input) {
|
|
13
|
+
const result = await this.migrationSnapshotFacade.verify();
|
|
14
|
+
if (result.ok) {
|
|
15
|
+
console.log(result.message);
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
18
|
+
console.error(result.message);
|
|
19
|
+
return 1;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.MigrationVerifySnapshotCommand = MigrationVerifySnapshotCommand;
|
|
23
|
+
//# sourceMappingURL=MigrationVerifySnapshotCommand.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationVerifySnapshotCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationVerifySnapshotCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationSnapshotFacade } from '../../lib/migrations/MigrationSnapshotFacade.js'\n\ntype Args = {}\n\ntype Options = {}\n\nexport class MigrationVerifySnapshotCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationSnapshotFacade: MigrationSnapshotFacade,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Verifies that snapshot.json still matches a full replay of all migrations')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst result = await this.migrationSnapshotFacade.verify()\n\t\tif (result.ok) {\n\t\t\tconsole.log(result.message)\n\t\t\treturn 0\n\t\t}\n\t\tconsole.error(result.message)\n\t\treturn 1\n\t}\n}\n"],"names":["Command"],"mappings":";;;AAOO,MAAM,uCAAuCA,UAAAA,QAAuB;AAAA,EAC1E,YACkB,yBAChB;AACD,UAAA;AAFiB,SAAA,0BAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,2EAA2E;AAAA,EACtG;AAAA,EAEA,MAAgB,QAAQ,OAA8C;AACrE,UAAM,SAAS,MAAM,KAAK,wBAAwB,OAAA;AAClD,QAAI,OAAO,IAAI;AACd,cAAQ,IAAI,OAAO,OAAO;AAC1B,aAAO;AAAA,IACR;AACA,YAAQ,MAAM,OAAO,OAAO;AAC5B,WAAO;AAAA,EACR;AACD;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Command } from "@contember/cli-common";
|
|
2
|
+
class MigrationVerifySnapshotCommand extends Command {
|
|
3
|
+
constructor(migrationSnapshotFacade) {
|
|
4
|
+
super();
|
|
5
|
+
this.migrationSnapshotFacade = migrationSnapshotFacade;
|
|
6
|
+
}
|
|
7
|
+
configure(configuration) {
|
|
8
|
+
configuration.description("Verifies that snapshot.json still matches a full replay of all migrations");
|
|
9
|
+
}
|
|
10
|
+
async execute(input) {
|
|
11
|
+
const result = await this.migrationSnapshotFacade.verify();
|
|
12
|
+
if (result.ok) {
|
|
13
|
+
console.log(result.message);
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
console.error(result.message);
|
|
17
|
+
return 1;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
MigrationVerifySnapshotCommand
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=MigrationVerifySnapshotCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationVerifySnapshotCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationVerifySnapshotCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationSnapshotFacade } from '../../lib/migrations/MigrationSnapshotFacade.js'\n\ntype Args = {}\n\ntype Options = {}\n\nexport class MigrationVerifySnapshotCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationSnapshotFacade: MigrationSnapshotFacade,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Verifies that snapshot.json still matches a full replay of all migrations')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst result = await this.migrationSnapshotFacade.verify()\n\t\tif (result.ok) {\n\t\t\tconsole.log(result.message)\n\t\t\treturn 0\n\t\t}\n\t\tconsole.error(result.message)\n\t\treturn 1\n\t}\n}\n"],"names":[],"mappings":";AAOO,MAAM,uCAAuC,QAAuB;AAAA,EAC1E,YACkB,yBAChB;AACD,UAAA;AAFiB,SAAA,0BAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,2EAA2E;AAAA,EACtG;AAAA,EAEA,MAAgB,QAAQ,OAA8C;AACrE,UAAM,SAAS,MAAM,KAAK,wBAAwB,OAAA;AAClD,QAAI,OAAO,IAAI;AACd,cAAQ,IAAI,OAAO,OAAO;AAC1B,aAAO;AAAA,IACR;AACA,YAAQ,MAAM,OAAO,OAAO;AAC5B,WAAO;AAAA,EACR;AACD;"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const cliCommon = require("@contember/cli-common");
|
|
4
4
|
const projectDescribe = require("../../lib/project/docs/projectDescribe.cjs");
|
|
5
5
|
const fs = require("node:fs/promises");
|
|
6
|
-
const
|
|
6
|
+
const path = require("node:path");
|
|
7
7
|
const SchemaValidationHelper = require("../../lib/schema/SchemaValidationHelper.cjs");
|
|
8
8
|
class ProjectGenerateDocumentationCommand extends cliCommon.Command {
|
|
9
9
|
constructor(schemaLoader, schemaVersionBuilder) {
|
|
@@ -29,7 +29,7 @@ class ProjectGenerateDocumentationCommand extends cliCommon.Command {
|
|
|
29
29
|
console.log(html);
|
|
30
30
|
} else {
|
|
31
31
|
console.log(`Documentation saved to ${output}`);
|
|
32
|
-
await fs.writeFile(
|
|
32
|
+
await fs.writeFile(path.join(process.cwd(), output), html);
|
|
33
33
|
}
|
|
34
34
|
return 0;
|
|
35
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectGenerateDocumentationCommand.cjs","sources":["../../../../../../packages/cli/src/commands/project/ProjectGenerateDocumentationCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { renderProjectInfoHtml } from '../../lib/project/docs/projectDescribe'\nimport { writeFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\nimport { SchemaVersionBuilder } from '@contember/migrations-client'\n\ntype Args = {}\n\ntype Options = {\n\tsource?: 'migrations' | 'definition'\n\tname?: string\n\toutput?: string\n}\n\nexport class ProjectGenerateDocumentationCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Generates HTML documentation from project schema')\n\t\tconfiguration.option('source').valueRequired().description('migrations|definition')\n\t\tconfiguration.option('output').valueRequired().description('file name or \"-\" for stdout')\n\t\tconfiguration.option('name').valueRequired().description('project name (for the title)')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst schema = input.getOption('source') === 'migrations'\n\t\t\t? await this.schemaVersionBuilder.buildSchema()\n\t\t\t: await this.schemaLoader.loadSchema()\n\t\tif (!validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')) {\n\t\t\treturn 1\n\t\t}\n\t\tconst name = input.getOption('name') ?? 'Contember project'\n\n\t\tconst html = await renderProjectInfoHtml(schema, name)\n\t\tconst output = input.getOption('output') ?? `${name.toLowerCase().replace(/\\s+/g, '-')}.html`\n\t\tif (output === '-') {\n\t\t\tconsole.log(html)\n\t\t} else {\n\t\t\tconsole.log(`Documentation saved to ${output}`)\n\t\t\tawait writeFile(join(process.cwd(), output), html)\n\t\t}\n\n\t\treturn 0\n\t}\n}\n"],"names":["Command","validateSchemaAndPrintErrors","renderProjectInfoHtml","writeFile","join"],"mappings":";;;;;;;AAgBO,MAAM,4CAA4CA,UAAAA,QAAuB;AAAA,EAC/E,YACkB,cACA,sBAChB;AACD,UAAA;AAHiB,SAAA,eAAA;AACA,SAAA,uBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,kDAAkD;AAC5E,kBAAc,OAAO,QAAQ,EAAE,cAAA,EAAgB,YAAY,uBAAuB;AAClF,kBAAc,OAAO,QAAQ,EAAE,cAAA,EAAgB,YAAY,6BAA6B;AACxF,kBAAc,OAAO,MAAM,EAAE,cAAA,EAAgB,YAAY,8BAA8B;AAAA,EACxF;AAAA,EAEA,MAAgB,QAAQ,OAA8C;AACrE,UAAM,SAAS,MAAM,UAAU,QAAQ,MAAM,eAC1C,MAAM,KAAK,qBAAqB,YAAA,IAChC,MAAM,KAAK,aAAa,WAAA;AAC3B,QAAI,CAACC,uBAAAA,6BAA6B,QAAQ,4BAA4B,GAAG;AACxE,aAAO;AAAA,IACR;AACA,UAAM,OAAO,MAAM,UAAU,MAAM,KAAK;AAExC,UAAM,OAAO,MAAMC,sCAAsB,QAAQ,IAAI;AACrD,UAAM,SAAS,MAAM,UAAU,QAAQ,KAAK,GAAG,KAAK,YAAA,EAAc,QAAQ,QAAQ,GAAG,CAAC;AACtF,QAAI,WAAW,KAAK;AACnB,cAAQ,IAAI,IAAI;AAAA,IACjB,OAAO;AACN,cAAQ,IAAI,0BAA0B,MAAM,EAAE;AAC9C,YAAMC,GAAAA,UAAUC,
|
|
1
|
+
{"version":3,"file":"ProjectGenerateDocumentationCommand.cjs","sources":["../../../../../../packages/cli/src/commands/project/ProjectGenerateDocumentationCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { renderProjectInfoHtml } from '../../lib/project/docs/projectDescribe.js'\nimport { writeFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader.js'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper.js'\nimport { SchemaVersionBuilder } from '@contember/migrations-client'\n\ntype Args = {}\n\ntype Options = {\n\tsource?: 'migrations' | 'definition'\n\tname?: string\n\toutput?: string\n}\n\nexport class ProjectGenerateDocumentationCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Generates HTML documentation from project schema')\n\t\tconfiguration.option('source').valueRequired().description('migrations|definition')\n\t\tconfiguration.option('output').valueRequired().description('file name or \"-\" for stdout')\n\t\tconfiguration.option('name').valueRequired().description('project name (for the title)')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst schema = input.getOption('source') === 'migrations'\n\t\t\t? await this.schemaVersionBuilder.buildSchema()\n\t\t\t: await this.schemaLoader.loadSchema()\n\t\tif (!validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')) {\n\t\t\treturn 1\n\t\t}\n\t\tconst name = input.getOption('name') ?? 'Contember project'\n\n\t\tconst html = await renderProjectInfoHtml(schema, name)\n\t\tconst output = input.getOption('output') ?? `${name.toLowerCase().replace(/\\s+/g, '-')}.html`\n\t\tif (output === '-') {\n\t\t\tconsole.log(html)\n\t\t} else {\n\t\t\tconsole.log(`Documentation saved to ${output}`)\n\t\t\tawait writeFile(join(process.cwd(), output), html)\n\t\t}\n\n\t\treturn 0\n\t}\n}\n"],"names":["Command","validateSchemaAndPrintErrors","renderProjectInfoHtml","writeFile","join"],"mappings":";;;;;;;AAgBO,MAAM,4CAA4CA,UAAAA,QAAuB;AAAA,EAC/E,YACkB,cACA,sBAChB;AACD,UAAA;AAHiB,SAAA,eAAA;AACA,SAAA,uBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,kDAAkD;AAC5E,kBAAc,OAAO,QAAQ,EAAE,cAAA,EAAgB,YAAY,uBAAuB;AAClF,kBAAc,OAAO,QAAQ,EAAE,cAAA,EAAgB,YAAY,6BAA6B;AACxF,kBAAc,OAAO,MAAM,EAAE,cAAA,EAAgB,YAAY,8BAA8B;AAAA,EACxF;AAAA,EAEA,MAAgB,QAAQ,OAA8C;AACrE,UAAM,SAAS,MAAM,UAAU,QAAQ,MAAM,eAC1C,MAAM,KAAK,qBAAqB,YAAA,IAChC,MAAM,KAAK,aAAa,WAAA;AAC3B,QAAI,CAACC,uBAAAA,6BAA6B,QAAQ,4BAA4B,GAAG;AACxE,aAAO;AAAA,IACR;AACA,UAAM,OAAO,MAAM,UAAU,MAAM,KAAK;AAExC,UAAM,OAAO,MAAMC,sCAAsB,QAAQ,IAAI;AACrD,UAAM,SAAS,MAAM,UAAU,QAAQ,KAAK,GAAG,KAAK,YAAA,EAAc,QAAQ,QAAQ,GAAG,CAAC;AACtF,QAAI,WAAW,KAAK;AACnB,cAAQ,IAAI,IAAI;AAAA,IACjB,OAAO;AACN,cAAQ,IAAI,0BAA0B,MAAM,EAAE;AAC9C,YAAMC,GAAAA,UAAUC,KAAAA,KAAK,QAAQ,OAAO,MAAM,GAAG,IAAI;AAAA,IAClD;AAEA,WAAO;AAAA,EACR;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectGenerateDocumentationCommand.js","sources":["../../../../../../packages/cli/src/commands/project/ProjectGenerateDocumentationCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { renderProjectInfoHtml } from '../../lib/project/docs/projectDescribe'\nimport { writeFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\nimport { SchemaVersionBuilder } from '@contember/migrations-client'\n\ntype Args = {}\n\ntype Options = {\n\tsource?: 'migrations' | 'definition'\n\tname?: string\n\toutput?: string\n}\n\nexport class ProjectGenerateDocumentationCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Generates HTML documentation from project schema')\n\t\tconfiguration.option('source').valueRequired().description('migrations|definition')\n\t\tconfiguration.option('output').valueRequired().description('file name or \"-\" for stdout')\n\t\tconfiguration.option('name').valueRequired().description('project name (for the title)')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst schema = input.getOption('source') === 'migrations'\n\t\t\t? await this.schemaVersionBuilder.buildSchema()\n\t\t\t: await this.schemaLoader.loadSchema()\n\t\tif (!validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')) {\n\t\t\treturn 1\n\t\t}\n\t\tconst name = input.getOption('name') ?? 'Contember project'\n\n\t\tconst html = await renderProjectInfoHtml(schema, name)\n\t\tconst output = input.getOption('output') ?? `${name.toLowerCase().replace(/\\s+/g, '-')}.html`\n\t\tif (output === '-') {\n\t\t\tconsole.log(html)\n\t\t} else {\n\t\t\tconsole.log(`Documentation saved to ${output}`)\n\t\t\tawait writeFile(join(process.cwd(), output), html)\n\t\t}\n\n\t\treturn 0\n\t}\n}\n"],"names":[],"mappings":";;;;;AAgBO,MAAM,4CAA4C,QAAuB;AAAA,EAC/E,YACkB,cACA,sBAChB;AACD,UAAA;AAHiB,SAAA,eAAA;AACA,SAAA,uBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,kDAAkD;AAC5E,kBAAc,OAAO,QAAQ,EAAE,cAAA,EAAgB,YAAY,uBAAuB;AAClF,kBAAc,OAAO,QAAQ,EAAE,cAAA,EAAgB,YAAY,6BAA6B;AACxF,kBAAc,OAAO,MAAM,EAAE,cAAA,EAAgB,YAAY,8BAA8B;AAAA,EACxF;AAAA,EAEA,MAAgB,QAAQ,OAA8C;AACrE,UAAM,SAAS,MAAM,UAAU,QAAQ,MAAM,eAC1C,MAAM,KAAK,qBAAqB,YAAA,IAChC,MAAM,KAAK,aAAa,WAAA;AAC3B,QAAI,CAAC,6BAA6B,QAAQ,4BAA4B,GAAG;AACxE,aAAO;AAAA,IACR;AACA,UAAM,OAAO,MAAM,UAAU,MAAM,KAAK;AAExC,UAAM,OAAO,MAAM,sBAAsB,QAAQ,IAAI;AACrD,UAAM,SAAS,MAAM,UAAU,QAAQ,KAAK,GAAG,KAAK,YAAA,EAAc,QAAQ,QAAQ,GAAG,CAAC;AACtF,QAAI,WAAW,KAAK;AACnB,cAAQ,IAAI,IAAI;AAAA,IACjB,OAAO;AACN,cAAQ,IAAI,0BAA0B,MAAM,EAAE;AAC9C,YAAM,UAAU,KAAK,QAAQ,OAAO,MAAM,GAAG,IAAI;AAAA,IAClD;AAEA,WAAO;AAAA,EACR;AACD;"}
|
|
1
|
+
{"version":3,"file":"ProjectGenerateDocumentationCommand.js","sources":["../../../../../../packages/cli/src/commands/project/ProjectGenerateDocumentationCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { renderProjectInfoHtml } from '../../lib/project/docs/projectDescribe.js'\nimport { writeFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader.js'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper.js'\nimport { SchemaVersionBuilder } from '@contember/migrations-client'\n\ntype Args = {}\n\ntype Options = {\n\tsource?: 'migrations' | 'definition'\n\tname?: string\n\toutput?: string\n}\n\nexport class ProjectGenerateDocumentationCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Generates HTML documentation from project schema')\n\t\tconfiguration.option('source').valueRequired().description('migrations|definition')\n\t\tconfiguration.option('output').valueRequired().description('file name or \"-\" for stdout')\n\t\tconfiguration.option('name').valueRequired().description('project name (for the title)')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst schema = input.getOption('source') === 'migrations'\n\t\t\t? await this.schemaVersionBuilder.buildSchema()\n\t\t\t: await this.schemaLoader.loadSchema()\n\t\tif (!validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')) {\n\t\t\treturn 1\n\t\t}\n\t\tconst name = input.getOption('name') ?? 'Contember project'\n\n\t\tconst html = await renderProjectInfoHtml(schema, name)\n\t\tconst output = input.getOption('output') ?? `${name.toLowerCase().replace(/\\s+/g, '-')}.html`\n\t\tif (output === '-') {\n\t\t\tconsole.log(html)\n\t\t} else {\n\t\t\tconsole.log(`Documentation saved to ${output}`)\n\t\t\tawait writeFile(join(process.cwd(), output), html)\n\t\t}\n\n\t\treturn 0\n\t}\n}\n"],"names":[],"mappings":";;;;;AAgBO,MAAM,4CAA4C,QAAuB;AAAA,EAC/E,YACkB,cACA,sBAChB;AACD,UAAA;AAHiB,SAAA,eAAA;AACA,SAAA,uBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,kDAAkD;AAC5E,kBAAc,OAAO,QAAQ,EAAE,cAAA,EAAgB,YAAY,uBAAuB;AAClF,kBAAc,OAAO,QAAQ,EAAE,cAAA,EAAgB,YAAY,6BAA6B;AACxF,kBAAc,OAAO,MAAM,EAAE,cAAA,EAAgB,YAAY,8BAA8B;AAAA,EACxF;AAAA,EAEA,MAAgB,QAAQ,OAA8C;AACrE,UAAM,SAAS,MAAM,UAAU,QAAQ,MAAM,eAC1C,MAAM,KAAK,qBAAqB,YAAA,IAChC,MAAM,KAAK,aAAa,WAAA;AAC3B,QAAI,CAAC,6BAA6B,QAAQ,4BAA4B,GAAG;AACxE,aAAO;AAAA,IACR;AACA,UAAM,OAAO,MAAM,UAAU,MAAM,KAAK;AAExC,UAAM,OAAO,MAAM,sBAAsB,QAAQ,IAAI;AACrD,UAAM,SAAS,MAAM,UAAU,QAAQ,KAAK,GAAG,KAAK,YAAA,EAAc,QAAQ,QAAQ,GAAG,CAAC;AACtF,QAAI,WAAW,KAAK;AACnB,cAAQ,IAAI,IAAI;AAAA,IACjB,OAAO;AACN,cAAQ,IAAI,0BAA0B,MAAM,EAAE;AAC9C,YAAM,UAAU,KAAK,QAAQ,OAAO,MAAM,GAAG,IAAI;AAAA,IAClD;AAEA,WAAO;AAAA,EACR;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectPrintSchemaCommand.cjs","sources":["../../../../../../packages/cli/src/commands/project/ProjectPrintSchemaCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport {\n\tAuthorizator,\n\tEntityRulesResolver,\n\tGraphQlSchemaBuilderFactory,\n\tIntrospectionSchemaDefinitionFactory,\n\tIntrospectionSchemaFactory,\n\tPermissionFactory,\n} from '@contember/engine-content-api'\nimport { printSchema } from 'graphql'\nimport { mergeSchemas } from '@graphql-tools/schema'\nimport { emptySchema, normalizeSchema } from '@contember/schema-utils'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { SchemaVersionBuilder } from '@contember/migrations-client'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\n\ntype Args = {}\n\ntype Options = {\n\trole?: string[]\n\tnormalize?: boolean\n\tformat?: 'graphql' | 'introspection' | 'schema'\n\tsource?: 'migrations' | 'definition'\n\t['omit-acl']?: boolean\n\t['omit-validation']?: boolean\n\t['omit-actions']?: boolean\n\t['omit-settings']?: boolean\n}\n\nexport class ProjectPrintSchemaCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Prints project schema')\n\t\tconfiguration.option('format').valueRequired().description('graphql|introspection|schema')\n\t\tconfiguration.option('source').valueRequired().description('migrations|definition')\n\t\tconfiguration.option('role').valueArray()\n\t\tconfiguration.option('normalize').valueNone()\n\t\tconfiguration.option('omit-acl').valueNone()\n\t\tconfiguration.option('omit-validation').valueNone()\n\t\tconfiguration.option('omit-actions').valueNone()\n\t\tconfiguration.option('omit-settings').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst format = input.getOption('format') || 'graphql'\n\n\t\tconst schema = input.getOption('source') === 'migrations'\n\t\t\t? await this.schemaVersionBuilder.buildSchema()\n\t\t\t: await this.schemaLoader.loadSchema()\n\n\t\tconst filteredSchema = {\n\t\t\tmodel: schema.model,\n\t\t\tacl: input.getOption('omit-acl') ? emptySchema.acl : schema.acl,\n\t\t\tvalidation: input.getOption('omit-validation') ? emptySchema.validation : schema.validation,\n\t\t\tactions: input.getOption('omit-actions') ? emptySchema.actions : schema.actions,\n\t\t\tsettings: input.getOption('omit-settings') ? emptySchema.settings : schema.settings,\n\t\t}\n\n\t\tif (!validateSchemaAndPrintErrors(filteredSchema, 'Defined schema is invalid:')) {\n\t\t\treturn 1\n\t\t}\n\n\t\tconst permissionFactory = new PermissionFactory()\n\t\tconst inputRoles = input.getOption('role')\n\t\tconst schemaNormalized = input.getOption('normalize') ? normalizeSchema(filteredSchema) : filteredSchema\n\t\tconst permissions = permissionFactory.create(schemaNormalized, inputRoles || ['admin'])\n\t\tconst schemaBuilderFactory = new GraphQlSchemaBuilderFactory()\n\t\tconst authorizator = new Authorizator(\n\t\t\tpermissions,\n\t\t\tschemaNormalized.acl.customPrimary ?? false,\n\t\t\tObject.values(schemaNormalized.acl.roles).some(it => it.content?.refreshMaterializedView),\n\t\t)\n\t\tconst introspection = new IntrospectionSchemaFactory(\n\t\t\tschemaNormalized.model,\n\t\t\tnew EntityRulesResolver(schemaNormalized.validation, schemaNormalized.model),\n\t\t\tauthorizator,\n\t\t)\n\n\t\tconst printByLine = (out: string) => {\n\t\t\tout.split('\\n').forEach(line => {\n\t\t\t\tprocess.stdout.write(line + '\\n')\n\t\t\t})\n\t\t}\n\t\tif (format === 'schema') {\n\t\t\tif (inputRoles) {\n\t\t\t\tthrow `--roles option is not supported for \"schema\" format`\n\t\t\t}\n\t\t\tconst jsonString = JSON.stringify(schemaNormalized, null, '\\t')\n\t\t\tprintByLine(jsonString)\n\t\t} else if (format === 'introspection') {\n\t\t\tprintByLine(JSON.stringify(introspection.create(), null, '\\t'))\n\t\t} else if (format === 'graphql') {\n\t\t\tconst contentSchema = schemaBuilderFactory.create(schemaNormalized.model, authorizator).build()\n\t\t\tconst introspectionSchemaFactory = new IntrospectionSchemaDefinitionFactory(introspection)\n\t\t\tconst introspectionSchema = introspectionSchemaFactory.create()\n\t\t\tconst gqlSchema = mergeSchemas({\n\t\t\t\tschemas: [contentSchema, introspectionSchema],\n\t\t\t})\n\t\t\tgqlSchema.description = '' // this enforces schema definition print\n\t\t\tconst printedSchema = printSchema(gqlSchema).replace('\"\"\"\"\"\"\\n', '') // remove empty comment\n\t\t\tprintByLine(printedSchema)\n\t\t} else {\n\t\t\tthrow `Unknown format ${format}`\n\t\t}\n\n\t\treturn 0\n\t}\n}\n"],"names":["Command","schema","emptySchema","validateSchemaAndPrintErrors","PermissionFactory","normalizeSchema","GraphQlSchemaBuilderFactory","Authorizator","IntrospectionSchemaFactory","EntityRulesResolver","IntrospectionSchemaDefinitionFactory","mergeSchemas","printSchema"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"ProjectPrintSchemaCommand.cjs","sources":["../../../../../../packages/cli/src/commands/project/ProjectPrintSchemaCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport {\n\tAuthorizator,\n\tEntityRulesResolver,\n\tGraphQlSchemaBuilderFactory,\n\tIntrospectionSchemaDefinitionFactory,\n\tIntrospectionSchemaFactory,\n\tPermissionFactory,\n} from '@contember/engine-content-api'\nimport { printSchema } from 'graphql'\nimport { mergeSchemas } from '@graphql-tools/schema'\nimport { emptySchema, normalizeSchema } from '@contember/schema-utils'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader.js'\nimport { SchemaVersionBuilder } from '@contember/migrations-client'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper.js'\n\ntype Args = {}\n\ntype Options = {\n\trole?: string[]\n\tnormalize?: boolean\n\tformat?: 'graphql' | 'introspection' | 'schema'\n\tsource?: 'migrations' | 'definition'\n\t['omit-acl']?: boolean\n\t['omit-validation']?: boolean\n\t['omit-actions']?: boolean\n\t['omit-settings']?: boolean\n}\n\nexport class ProjectPrintSchemaCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Prints project schema')\n\t\tconfiguration.option('format').valueRequired().description('graphql|introspection|schema')\n\t\tconfiguration.option('source').valueRequired().description('migrations|definition')\n\t\tconfiguration.option('role').valueArray()\n\t\tconfiguration.option('normalize').valueNone()\n\t\tconfiguration.option('omit-acl').valueNone()\n\t\tconfiguration.option('omit-validation').valueNone()\n\t\tconfiguration.option('omit-actions').valueNone()\n\t\tconfiguration.option('omit-settings').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst format = input.getOption('format') || 'graphql'\n\n\t\tconst schema = input.getOption('source') === 'migrations'\n\t\t\t? await this.schemaVersionBuilder.buildSchema()\n\t\t\t: await this.schemaLoader.loadSchema()\n\n\t\tconst filteredSchema = {\n\t\t\tmodel: schema.model,\n\t\t\tacl: input.getOption('omit-acl') ? emptySchema.acl : schema.acl,\n\t\t\tvalidation: input.getOption('omit-validation') ? emptySchema.validation : schema.validation,\n\t\t\tactions: input.getOption('omit-actions') ? emptySchema.actions : schema.actions,\n\t\t\tsettings: input.getOption('omit-settings') ? emptySchema.settings : schema.settings,\n\t\t}\n\n\t\tif (!validateSchemaAndPrintErrors(filteredSchema, 'Defined schema is invalid:')) {\n\t\t\treturn 1\n\t\t}\n\n\t\tconst permissionFactory = new PermissionFactory()\n\t\tconst inputRoles = input.getOption('role')\n\t\tconst schemaNormalized = input.getOption('normalize') ? normalizeSchema(filteredSchema) : filteredSchema\n\t\tconst permissions = permissionFactory.create(schemaNormalized, inputRoles || ['admin'])\n\t\tconst schemaBuilderFactory = new GraphQlSchemaBuilderFactory()\n\t\tconst authorizator = new Authorizator(\n\t\t\tpermissions,\n\t\t\tschemaNormalized.acl.customPrimary ?? false,\n\t\t\tObject.values(schemaNormalized.acl.roles).some(it => it.content?.refreshMaterializedView),\n\t\t)\n\t\tconst introspection = new IntrospectionSchemaFactory(\n\t\t\tschemaNormalized.model,\n\t\t\tnew EntityRulesResolver(schemaNormalized.validation, schemaNormalized.model),\n\t\t\tauthorizator,\n\t\t)\n\n\t\tconst printByLine = (out: string) => {\n\t\t\tout.split('\\n').forEach(line => {\n\t\t\t\tprocess.stdout.write(line + '\\n')\n\t\t\t})\n\t\t}\n\t\tif (format === 'schema') {\n\t\t\tif (inputRoles) {\n\t\t\t\tthrow `--roles option is not supported for \"schema\" format`\n\t\t\t}\n\t\t\tconst jsonString = JSON.stringify(schemaNormalized, null, '\\t')\n\t\t\tprintByLine(jsonString)\n\t\t} else if (format === 'introspection') {\n\t\t\tprintByLine(JSON.stringify(introspection.create(), null, '\\t'))\n\t\t} else if (format === 'graphql') {\n\t\t\tconst contentSchema = schemaBuilderFactory.create(schemaNormalized.model, authorizator).build()\n\t\t\tconst introspectionSchemaFactory = new IntrospectionSchemaDefinitionFactory(introspection)\n\t\t\tconst introspectionSchema = introspectionSchemaFactory.create()\n\t\t\tconst gqlSchema = mergeSchemas({\n\t\t\t\tschemas: [contentSchema, introspectionSchema],\n\t\t\t})\n\t\t\tgqlSchema.description = '' // this enforces schema definition print\n\t\t\tconst printedSchema = printSchema(gqlSchema).replace('\"\"\"\"\"\"\\n', '') // remove empty comment\n\t\t\tprintByLine(printedSchema)\n\t\t} else {\n\t\t\tthrow `Unknown format ${format}`\n\t\t}\n\n\t\treturn 0\n\t}\n}\n"],"names":["Command","schema","emptySchema","validateSchemaAndPrintErrors","PermissionFactory","normalizeSchema","GraphQlSchemaBuilderFactory","Authorizator","IntrospectionSchemaFactory","EntityRulesResolver","IntrospectionSchemaDefinitionFactory","mergeSchemas","printSchema"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectPrintSchemaCommand.js","sources":["../../../../../../packages/cli/src/commands/project/ProjectPrintSchemaCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport {\n\tAuthorizator,\n\tEntityRulesResolver,\n\tGraphQlSchemaBuilderFactory,\n\tIntrospectionSchemaDefinitionFactory,\n\tIntrospectionSchemaFactory,\n\tPermissionFactory,\n} from '@contember/engine-content-api'\nimport { printSchema } from 'graphql'\nimport { mergeSchemas } from '@graphql-tools/schema'\nimport { emptySchema, normalizeSchema } from '@contember/schema-utils'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { SchemaVersionBuilder } from '@contember/migrations-client'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\n\ntype Args = {}\n\ntype Options = {\n\trole?: string[]\n\tnormalize?: boolean\n\tformat?: 'graphql' | 'introspection' | 'schema'\n\tsource?: 'migrations' | 'definition'\n\t['omit-acl']?: boolean\n\t['omit-validation']?: boolean\n\t['omit-actions']?: boolean\n\t['omit-settings']?: boolean\n}\n\nexport class ProjectPrintSchemaCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Prints project schema')\n\t\tconfiguration.option('format').valueRequired().description('graphql|introspection|schema')\n\t\tconfiguration.option('source').valueRequired().description('migrations|definition')\n\t\tconfiguration.option('role').valueArray()\n\t\tconfiguration.option('normalize').valueNone()\n\t\tconfiguration.option('omit-acl').valueNone()\n\t\tconfiguration.option('omit-validation').valueNone()\n\t\tconfiguration.option('omit-actions').valueNone()\n\t\tconfiguration.option('omit-settings').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst format = input.getOption('format') || 'graphql'\n\n\t\tconst schema = input.getOption('source') === 'migrations'\n\t\t\t? await this.schemaVersionBuilder.buildSchema()\n\t\t\t: await this.schemaLoader.loadSchema()\n\n\t\tconst filteredSchema = {\n\t\t\tmodel: schema.model,\n\t\t\tacl: input.getOption('omit-acl') ? emptySchema.acl : schema.acl,\n\t\t\tvalidation: input.getOption('omit-validation') ? emptySchema.validation : schema.validation,\n\t\t\tactions: input.getOption('omit-actions') ? emptySchema.actions : schema.actions,\n\t\t\tsettings: input.getOption('omit-settings') ? emptySchema.settings : schema.settings,\n\t\t}\n\n\t\tif (!validateSchemaAndPrintErrors(filteredSchema, 'Defined schema is invalid:')) {\n\t\t\treturn 1\n\t\t}\n\n\t\tconst permissionFactory = new PermissionFactory()\n\t\tconst inputRoles = input.getOption('role')\n\t\tconst schemaNormalized = input.getOption('normalize') ? normalizeSchema(filteredSchema) : filteredSchema\n\t\tconst permissions = permissionFactory.create(schemaNormalized, inputRoles || ['admin'])\n\t\tconst schemaBuilderFactory = new GraphQlSchemaBuilderFactory()\n\t\tconst authorizator = new Authorizator(\n\t\t\tpermissions,\n\t\t\tschemaNormalized.acl.customPrimary ?? false,\n\t\t\tObject.values(schemaNormalized.acl.roles).some(it => it.content?.refreshMaterializedView),\n\t\t)\n\t\tconst introspection = new IntrospectionSchemaFactory(\n\t\t\tschemaNormalized.model,\n\t\t\tnew EntityRulesResolver(schemaNormalized.validation, schemaNormalized.model),\n\t\t\tauthorizator,\n\t\t)\n\n\t\tconst printByLine = (out: string) => {\n\t\t\tout.split('\\n').forEach(line => {\n\t\t\t\tprocess.stdout.write(line + '\\n')\n\t\t\t})\n\t\t}\n\t\tif (format === 'schema') {\n\t\t\tif (inputRoles) {\n\t\t\t\tthrow `--roles option is not supported for \"schema\" format`\n\t\t\t}\n\t\t\tconst jsonString = JSON.stringify(schemaNormalized, null, '\\t')\n\t\t\tprintByLine(jsonString)\n\t\t} else if (format === 'introspection') {\n\t\t\tprintByLine(JSON.stringify(introspection.create(), null, '\\t'))\n\t\t} else if (format === 'graphql') {\n\t\t\tconst contentSchema = schemaBuilderFactory.create(schemaNormalized.model, authorizator).build()\n\t\t\tconst introspectionSchemaFactory = new IntrospectionSchemaDefinitionFactory(introspection)\n\t\t\tconst introspectionSchema = introspectionSchemaFactory.create()\n\t\t\tconst gqlSchema = mergeSchemas({\n\t\t\t\tschemas: [contentSchema, introspectionSchema],\n\t\t\t})\n\t\t\tgqlSchema.description = '' // this enforces schema definition print\n\t\t\tconst printedSchema = printSchema(gqlSchema).replace('\"\"\"\"\"\"\\n', '') // remove empty comment\n\t\t\tprintByLine(printedSchema)\n\t\t} else {\n\t\t\tthrow `Unknown format ${format}`\n\t\t}\n\n\t\treturn 0\n\t}\n}\n"],"names":[],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"ProjectPrintSchemaCommand.js","sources":["../../../../../../packages/cli/src/commands/project/ProjectPrintSchemaCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport {\n\tAuthorizator,\n\tEntityRulesResolver,\n\tGraphQlSchemaBuilderFactory,\n\tIntrospectionSchemaDefinitionFactory,\n\tIntrospectionSchemaFactory,\n\tPermissionFactory,\n} from '@contember/engine-content-api'\nimport { printSchema } from 'graphql'\nimport { mergeSchemas } from '@graphql-tools/schema'\nimport { emptySchema, normalizeSchema } from '@contember/schema-utils'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader.js'\nimport { SchemaVersionBuilder } from '@contember/migrations-client'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper.js'\n\ntype Args = {}\n\ntype Options = {\n\trole?: string[]\n\tnormalize?: boolean\n\tformat?: 'graphql' | 'introspection' | 'schema'\n\tsource?: 'migrations' | 'definition'\n\t['omit-acl']?: boolean\n\t['omit-validation']?: boolean\n\t['omit-actions']?: boolean\n\t['omit-settings']?: boolean\n}\n\nexport class ProjectPrintSchemaCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Prints project schema')\n\t\tconfiguration.option('format').valueRequired().description('graphql|introspection|schema')\n\t\tconfiguration.option('source').valueRequired().description('migrations|definition')\n\t\tconfiguration.option('role').valueArray()\n\t\tconfiguration.option('normalize').valueNone()\n\t\tconfiguration.option('omit-acl').valueNone()\n\t\tconfiguration.option('omit-validation').valueNone()\n\t\tconfiguration.option('omit-actions').valueNone()\n\t\tconfiguration.option('omit-settings').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst format = input.getOption('format') || 'graphql'\n\n\t\tconst schema = input.getOption('source') === 'migrations'\n\t\t\t? await this.schemaVersionBuilder.buildSchema()\n\t\t\t: await this.schemaLoader.loadSchema()\n\n\t\tconst filteredSchema = {\n\t\t\tmodel: schema.model,\n\t\t\tacl: input.getOption('omit-acl') ? emptySchema.acl : schema.acl,\n\t\t\tvalidation: input.getOption('omit-validation') ? emptySchema.validation : schema.validation,\n\t\t\tactions: input.getOption('omit-actions') ? emptySchema.actions : schema.actions,\n\t\t\tsettings: input.getOption('omit-settings') ? emptySchema.settings : schema.settings,\n\t\t}\n\n\t\tif (!validateSchemaAndPrintErrors(filteredSchema, 'Defined schema is invalid:')) {\n\t\t\treturn 1\n\t\t}\n\n\t\tconst permissionFactory = new PermissionFactory()\n\t\tconst inputRoles = input.getOption('role')\n\t\tconst schemaNormalized = input.getOption('normalize') ? normalizeSchema(filteredSchema) : filteredSchema\n\t\tconst permissions = permissionFactory.create(schemaNormalized, inputRoles || ['admin'])\n\t\tconst schemaBuilderFactory = new GraphQlSchemaBuilderFactory()\n\t\tconst authorizator = new Authorizator(\n\t\t\tpermissions,\n\t\t\tschemaNormalized.acl.customPrimary ?? false,\n\t\t\tObject.values(schemaNormalized.acl.roles).some(it => it.content?.refreshMaterializedView),\n\t\t)\n\t\tconst introspection = new IntrospectionSchemaFactory(\n\t\t\tschemaNormalized.model,\n\t\t\tnew EntityRulesResolver(schemaNormalized.validation, schemaNormalized.model),\n\t\t\tauthorizator,\n\t\t)\n\n\t\tconst printByLine = (out: string) => {\n\t\t\tout.split('\\n').forEach(line => {\n\t\t\t\tprocess.stdout.write(line + '\\n')\n\t\t\t})\n\t\t}\n\t\tif (format === 'schema') {\n\t\t\tif (inputRoles) {\n\t\t\t\tthrow `--roles option is not supported for \"schema\" format`\n\t\t\t}\n\t\t\tconst jsonString = JSON.stringify(schemaNormalized, null, '\\t')\n\t\t\tprintByLine(jsonString)\n\t\t} else if (format === 'introspection') {\n\t\t\tprintByLine(JSON.stringify(introspection.create(), null, '\\t'))\n\t\t} else if (format === 'graphql') {\n\t\t\tconst contentSchema = schemaBuilderFactory.create(schemaNormalized.model, authorizator).build()\n\t\t\tconst introspectionSchemaFactory = new IntrospectionSchemaDefinitionFactory(introspection)\n\t\t\tconst introspectionSchema = introspectionSchemaFactory.create()\n\t\t\tconst gqlSchema = mergeSchemas({\n\t\t\t\tschemas: [contentSchema, introspectionSchema],\n\t\t\t})\n\t\t\tgqlSchema.description = '' // this enforces schema definition print\n\t\t\tconst printedSchema = printSchema(gqlSchema).replace('\"\"\"\"\"\"\\n', '') // remove empty comment\n\t\t\tprintByLine(printedSchema)\n\t\t} else {\n\t\t\tthrow `Unknown format ${format}`\n\t\t}\n\n\t\treturn 0\n\t}\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectValidateCommand.cjs","sources":["../../../../../../packages/cli/src/commands/project/ProjectValidateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration } from '@contember/cli-common'\nimport { emptySchema } from '@contember/schema-utils'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\nimport { MigrationsValidator } from '../../lib/migrations/MigrationsValidator'\nimport { MigrationsResolver, SchemaVersionBuilder } from '@contember/migrations-client'\nimport { SchemaDiffer } from '@contember/schema-migrations'\n\ntype Args = {}\n\ntype Options = {}\n\nexport class ProjectValidateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly migrationValidator: MigrationsValidator,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly schemaDiffer: SchemaDiffer,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Validates project schema')\n\t}\n\n\tprotected async execute(): Promise<number> {\n\t\tlet projectValid = true\n\n\t\tconst migrations = await this.migrationsResolver.getSchemaMigrations()\n\t\tprojectValid = this.migrationValidator.validate(emptySchema, migrations)\n\t\t\t&& projectValid\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\tprojectValid = validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')\n\t\t\t&& projectValid\n\n\t\tconst builtSchema = await this.schemaVersionBuilder.buildSchema()\n\t\tprojectValid = validateSchemaAndPrintErrors(builtSchema, 'Schema built from migrations is invalid:')\n\t\t\t&& projectValid\n\n\t\tif (projectValid) {\n\t\t\tconst diff = await this.schemaDiffer.diffSchemas(builtSchema, schema)\n\t\t\tif (diff.length > 0) {\n\t\t\t\tconsole.log('Migrations are not in sync with a defined schema')\n\t\t\t\tprojectValid = false\n\t\t\t}\n\t\t}\n\n\t\tif (projectValid) {\n\t\t\tconsole.log('Project schema is valid')\n\t\t}\n\n\t\treturn projectValid ? 0 : 1\n\t}\n}\n"],"names":["Command","emptySchema","validateSchemaAndPrintErrors"],"mappings":";;;;;AAYO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,cACA,oBACA,oBACA,cACA,sBAChB;AACD,UAAA;AANiB,SAAA,eAAA;AACA,SAAA,qBAAA;AACA,SAAA,qBAAA;AACA,SAAA,eAAA;AACA,SAAA,uBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,0BAA0B;AAAA,EACrD;AAAA,EAEA,MAAgB,UAA2B;AAC1C,QAAI,eAAe;AAEnB,UAAM,aAAa,MAAM,KAAK,mBAAmB,oBAAA;AACjD,mBAAe,KAAK,mBAAmB,SAASC,YAAAA,aAAa,UAAU,KACnE;AAEJ,UAAM,SAAS,MAAM,KAAK,aAAa,WAAA;AACvC,mBAAeC,uBAAAA,6BAA6B,QAAQ,4BAA4B,KAC5E;AAEJ,UAAM,cAAc,MAAM,KAAK,qBAAqB,YAAA;AACpD,mBAAeA,uBAAAA,6BAA6B,aAAa,0CAA0C,KAC/F;AAEJ,QAAI,cAAc;AACjB,YAAM,OAAO,MAAM,KAAK,aAAa,YAAY,aAAa,MAAM;AACpE,UAAI,KAAK,SAAS,GAAG;AACpB,gBAAQ,IAAI,kDAAkD;AAC9D,uBAAe;AAAA,MAChB;AAAA,IACD;AAEA,QAAI,cAAc;AACjB,cAAQ,IAAI,yBAAyB;AAAA,IACtC;AAEA,WAAO,eAAe,IAAI;AAAA,EAC3B;AACD;;"}
|
|
1
|
+
{"version":3,"file":"ProjectValidateCommand.cjs","sources":["../../../../../../packages/cli/src/commands/project/ProjectValidateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration } from '@contember/cli-common'\nimport { emptySchema } from '@contember/schema-utils'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader.js'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper.js'\nimport { MigrationsValidator } from '../../lib/migrations/MigrationsValidator.js'\nimport { MigrationsResolver, SchemaVersionBuilder } from '@contember/migrations-client'\nimport { SchemaDiffer } from '@contember/schema-migrations'\n\ntype Args = {}\n\ntype Options = {}\n\nexport class ProjectValidateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly migrationValidator: MigrationsValidator,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly schemaDiffer: SchemaDiffer,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Validates project schema')\n\t}\n\n\tprotected async execute(): Promise<number> {\n\t\tlet projectValid = true\n\n\t\tconst migrations = await this.migrationsResolver.getSchemaMigrations()\n\t\tprojectValid = this.migrationValidator.validate(emptySchema, migrations)\n\t\t\t&& projectValid\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\tprojectValid = validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')\n\t\t\t&& projectValid\n\n\t\tconst builtSchema = await this.schemaVersionBuilder.buildSchema()\n\t\tprojectValid = validateSchemaAndPrintErrors(builtSchema, 'Schema built from migrations is invalid:')\n\t\t\t&& projectValid\n\n\t\tif (projectValid) {\n\t\t\tconst diff = await this.schemaDiffer.diffSchemas(builtSchema, schema)\n\t\t\tif (diff.length > 0) {\n\t\t\t\tconsole.log('Migrations are not in sync with a defined schema')\n\t\t\t\tprojectValid = false\n\t\t\t}\n\t\t}\n\n\t\tif (projectValid) {\n\t\t\tconsole.log('Project schema is valid')\n\t\t}\n\n\t\treturn projectValid ? 0 : 1\n\t}\n}\n"],"names":["Command","emptySchema","validateSchemaAndPrintErrors"],"mappings":";;;;;AAYO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,cACA,oBACA,oBACA,cACA,sBAChB;AACD,UAAA;AANiB,SAAA,eAAA;AACA,SAAA,qBAAA;AACA,SAAA,qBAAA;AACA,SAAA,eAAA;AACA,SAAA,uBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,0BAA0B;AAAA,EACrD;AAAA,EAEA,MAAgB,UAA2B;AAC1C,QAAI,eAAe;AAEnB,UAAM,aAAa,MAAM,KAAK,mBAAmB,oBAAA;AACjD,mBAAe,KAAK,mBAAmB,SAASC,YAAAA,aAAa,UAAU,KACnE;AAEJ,UAAM,SAAS,MAAM,KAAK,aAAa,WAAA;AACvC,mBAAeC,uBAAAA,6BAA6B,QAAQ,4BAA4B,KAC5E;AAEJ,UAAM,cAAc,MAAM,KAAK,qBAAqB,YAAA;AACpD,mBAAeA,uBAAAA,6BAA6B,aAAa,0CAA0C,KAC/F;AAEJ,QAAI,cAAc;AACjB,YAAM,OAAO,MAAM,KAAK,aAAa,YAAY,aAAa,MAAM;AACpE,UAAI,KAAK,SAAS,GAAG;AACpB,gBAAQ,IAAI,kDAAkD;AAC9D,uBAAe;AAAA,MAChB;AAAA,IACD;AAEA,QAAI,cAAc;AACjB,cAAQ,IAAI,yBAAyB;AAAA,IACtC;AAEA,WAAO,eAAe,IAAI;AAAA,EAC3B;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectValidateCommand.js","sources":["../../../../../../packages/cli/src/commands/project/ProjectValidateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration } from '@contember/cli-common'\nimport { emptySchema } from '@contember/schema-utils'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\nimport { MigrationsValidator } from '../../lib/migrations/MigrationsValidator'\nimport { MigrationsResolver, SchemaVersionBuilder } from '@contember/migrations-client'\nimport { SchemaDiffer } from '@contember/schema-migrations'\n\ntype Args = {}\n\ntype Options = {}\n\nexport class ProjectValidateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly migrationValidator: MigrationsValidator,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly schemaDiffer: SchemaDiffer,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Validates project schema')\n\t}\n\n\tprotected async execute(): Promise<number> {\n\t\tlet projectValid = true\n\n\t\tconst migrations = await this.migrationsResolver.getSchemaMigrations()\n\t\tprojectValid = this.migrationValidator.validate(emptySchema, migrations)\n\t\t\t&& projectValid\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\tprojectValid = validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')\n\t\t\t&& projectValid\n\n\t\tconst builtSchema = await this.schemaVersionBuilder.buildSchema()\n\t\tprojectValid = validateSchemaAndPrintErrors(builtSchema, 'Schema built from migrations is invalid:')\n\t\t\t&& projectValid\n\n\t\tif (projectValid) {\n\t\t\tconst diff = await this.schemaDiffer.diffSchemas(builtSchema, schema)\n\t\t\tif (diff.length > 0) {\n\t\t\t\tconsole.log('Migrations are not in sync with a defined schema')\n\t\t\t\tprojectValid = false\n\t\t\t}\n\t\t}\n\n\t\tif (projectValid) {\n\t\t\tconsole.log('Project schema is valid')\n\t\t}\n\n\t\treturn projectValid ? 0 : 1\n\t}\n}\n"],"names":[],"mappings":";;;AAYO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,cACA,oBACA,oBACA,cACA,sBAChB;AACD,UAAA;AANiB,SAAA,eAAA;AACA,SAAA,qBAAA;AACA,SAAA,qBAAA;AACA,SAAA,eAAA;AACA,SAAA,uBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,0BAA0B;AAAA,EACrD;AAAA,EAEA,MAAgB,UAA2B;AAC1C,QAAI,eAAe;AAEnB,UAAM,aAAa,MAAM,KAAK,mBAAmB,oBAAA;AACjD,mBAAe,KAAK,mBAAmB,SAAS,aAAa,UAAU,KACnE;AAEJ,UAAM,SAAS,MAAM,KAAK,aAAa,WAAA;AACvC,mBAAe,6BAA6B,QAAQ,4BAA4B,KAC5E;AAEJ,UAAM,cAAc,MAAM,KAAK,qBAAqB,YAAA;AACpD,mBAAe,6BAA6B,aAAa,0CAA0C,KAC/F;AAEJ,QAAI,cAAc;AACjB,YAAM,OAAO,MAAM,KAAK,aAAa,YAAY,aAAa,MAAM;AACpE,UAAI,KAAK,SAAS,GAAG;AACpB,gBAAQ,IAAI,kDAAkD;AAC9D,uBAAe;AAAA,MAChB;AAAA,IACD;AAEA,QAAI,cAAc;AACjB,cAAQ,IAAI,yBAAyB;AAAA,IACtC;AAEA,WAAO,eAAe,IAAI;AAAA,EAC3B;AACD;"}
|
|
1
|
+
{"version":3,"file":"ProjectValidateCommand.js","sources":["../../../../../../packages/cli/src/commands/project/ProjectValidateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration } from '@contember/cli-common'\nimport { emptySchema } from '@contember/schema-utils'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader.js'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper.js'\nimport { MigrationsValidator } from '../../lib/migrations/MigrationsValidator.js'\nimport { MigrationsResolver, SchemaVersionBuilder } from '@contember/migrations-client'\nimport { SchemaDiffer } from '@contember/schema-migrations'\n\ntype Args = {}\n\ntype Options = {}\n\nexport class ProjectValidateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly migrationValidator: MigrationsValidator,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly schemaDiffer: SchemaDiffer,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Validates project schema')\n\t}\n\n\tprotected async execute(): Promise<number> {\n\t\tlet projectValid = true\n\n\t\tconst migrations = await this.migrationsResolver.getSchemaMigrations()\n\t\tprojectValid = this.migrationValidator.validate(emptySchema, migrations)\n\t\t\t&& projectValid\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\tprojectValid = validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')\n\t\t\t&& projectValid\n\n\t\tconst builtSchema = await this.schemaVersionBuilder.buildSchema()\n\t\tprojectValid = validateSchemaAndPrintErrors(builtSchema, 'Schema built from migrations is invalid:')\n\t\t\t&& projectValid\n\n\t\tif (projectValid) {\n\t\t\tconst diff = await this.schemaDiffer.diffSchemas(builtSchema, schema)\n\t\t\tif (diff.length > 0) {\n\t\t\t\tconsole.log('Migrations are not in sync with a defined schema')\n\t\t\t\tprojectValid = false\n\t\t\t}\n\t\t}\n\n\t\tif (projectValid) {\n\t\t\tconsole.log('Project schema is valid')\n\t\t}\n\n\t\treturn projectValid ? 0 : 1\n\t}\n}\n"],"names":[],"mappings":";;;AAYO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,cACA,oBACA,oBACA,cACA,sBAChB;AACD,UAAA;AANiB,SAAA,eAAA;AACA,SAAA,qBAAA;AACA,SAAA,qBAAA;AACA,SAAA,eAAA;AACA,SAAA,uBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,0BAA0B;AAAA,EACrD;AAAA,EAEA,MAAgB,UAA2B;AAC1C,QAAI,eAAe;AAEnB,UAAM,aAAa,MAAM,KAAK,mBAAmB,oBAAA;AACjD,mBAAe,KAAK,mBAAmB,SAAS,aAAa,UAAU,KACnE;AAEJ,UAAM,SAAS,MAAM,KAAK,aAAa,WAAA;AACvC,mBAAe,6BAA6B,QAAQ,4BAA4B,KAC5E;AAEJ,UAAM,cAAc,MAAM,KAAK,qBAAqB,YAAA;AACpD,mBAAe,6BAA6B,aAAa,0CAA0C,KAC/F;AAEJ,QAAI,cAAc;AACjB,YAAM,OAAO,MAAM,KAAK,aAAa,YAAY,aAAa,MAAM;AACpE,UAAI,KAAK,SAAS,GAAG;AACpB,gBAAQ,IAAI,kDAAkD;AAC9D,uBAAe;AAAA,MAChB;AAAA,IACD;AAEA,QAAI,cAAc;AACjB,cAAQ,IAAI,yBAAyB;AAAA,IACtC;AAEA,WAAO,eAAe,IAAI;AAAA,EAC3B;AACD;"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const cliCommon = require("@contember/cli-common");
|
|
4
|
+
const TenantClient = require("../../lib/tenant/TenantClient.cjs");
|
|
5
|
+
const DEFAULT_CONFIG_PATH = "tenant.config.ts";
|
|
6
|
+
class TenantApplyCommand extends cliCommon.Command {
|
|
7
|
+
constructor(remoteProjectResolver, tenantConfigLoader, tenantConfigApplier) {
|
|
8
|
+
super();
|
|
9
|
+
this.remoteProjectResolver = remoteProjectResolver;
|
|
10
|
+
this.tenantConfigLoader = tenantConfigLoader;
|
|
11
|
+
this.tenantConfigApplier = tenantConfigApplier;
|
|
12
|
+
}
|
|
13
|
+
configure(configuration) {
|
|
14
|
+
configuration.description("Apply declarative tenant configuration (global config, identity providers, mail templates)");
|
|
15
|
+
configuration.argument("config").optional().description(`Path to the tenant config file (default: ${DEFAULT_CONFIG_PATH})`);
|
|
16
|
+
configuration.option("dsn").valueRequired().description("Project DSN. Falls back to CONTEMBER_* environment variables.");
|
|
17
|
+
configuration.option("dry-run").valueNone().description("Print the actions that would be performed without executing them.");
|
|
18
|
+
}
|
|
19
|
+
async execute(input) {
|
|
20
|
+
const configPath = input.getArgument("config") ?? DEFAULT_CONFIG_PATH;
|
|
21
|
+
const dsn = input.getOption("dsn");
|
|
22
|
+
const dryRun = input.getOption("dry-run") === true;
|
|
23
|
+
const remoteProject = this.remoteProjectResolver.resolve(dsn);
|
|
24
|
+
if (!remoteProject) {
|
|
25
|
+
throw `Project not defined. Please provide a DSN (--dsn) or set CONTEMBER_* environment variables.`;
|
|
26
|
+
}
|
|
27
|
+
const config = await this.tenantConfigLoader.loadConfig(configPath);
|
|
28
|
+
const client = TenantClient.TenantClient.create(remoteProject.endpoint, remoteProject.token);
|
|
29
|
+
console.log(`Applying tenant config from ${configPath}`);
|
|
30
|
+
console.log(`API URL: ${remoteProject.endpoint}`);
|
|
31
|
+
console.log("");
|
|
32
|
+
await this.tenantConfigApplier.apply(client, config, { dryRun });
|
|
33
|
+
console.log("");
|
|
34
|
+
console.log(dryRun ? "Dry run complete. No changes were made." : "Tenant configuration applied.");
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.TenantApplyCommand = TenantApplyCommand;
|
|
39
|
+
//# sourceMappingURL=TenantApplyCommand.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TenantApplyCommand.cjs","sources":["../../../../../../packages/cli/src/commands/tenant/TenantApplyCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { RemoteProjectResolver } from '../../lib/project/RemoteProjectResolver.js'\nimport { TenantClient } from '../../lib/tenant/TenantClient.js'\nimport { TenantConfigLoader } from '../../lib/tenant/TenantConfigLoader.js'\nimport { TenantConfigApplier } from '../../lib/tenant/TenantConfigApplier.js'\n\ntype Args = {\n\tconfig?: string\n}\n\ntype Options = {\n\tdsn?: string\n\t['dry-run']?: boolean\n}\n\nconst DEFAULT_CONFIG_PATH = 'tenant.config.ts'\n\nexport class TenantApplyCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly remoteProjectResolver: RemoteProjectResolver,\n\t\tprivate readonly tenantConfigLoader: TenantConfigLoader,\n\t\tprivate readonly tenantConfigApplier: TenantConfigApplier,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Apply declarative tenant configuration (global config, identity providers, mail templates)')\n\t\tconfiguration.argument('config').optional().description(`Path to the tenant config file (default: ${DEFAULT_CONFIG_PATH})`)\n\t\tconfiguration.option('dsn').valueRequired().description('Project DSN. Falls back to CONTEMBER_* environment variables.')\n\t\tconfiguration.option('dry-run').valueNone().description('Print the actions that would be performed without executing them.')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void | number> {\n\t\tconst configPath = input.getArgument('config') ?? DEFAULT_CONFIG_PATH\n\t\tconst dsn = input.getOption('dsn')\n\t\tconst dryRun = input.getOption('dry-run') === true\n\n\t\tconst remoteProject = this.remoteProjectResolver.resolve(dsn)\n\t\tif (!remoteProject) {\n\t\t\tthrow `Project not defined. Please provide a DSN (--dsn) or set CONTEMBER_* environment variables.`\n\t\t}\n\n\t\tconst config = await this.tenantConfigLoader.loadConfig(configPath)\n\t\tconst client = TenantClient.create(remoteProject.endpoint, remoteProject.token)\n\n\t\tconsole.log(`Applying tenant config from ${configPath}`)\n\t\tconsole.log(`API URL: ${remoteProject.endpoint}`)\n\t\tconsole.log('')\n\n\t\tawait this.tenantConfigApplier.apply(client, config, { dryRun })\n\n\t\tconsole.log('')\n\t\tconsole.log(dryRun ? 'Dry run complete. No changes were made.' : 'Tenant configuration applied.')\n\t\treturn 0\n\t}\n}\n"],"names":["Command","TenantClient"],"mappings":";;;;AAeA,MAAM,sBAAsB;AAErB,MAAM,2BAA2BA,UAAAA,QAAuB;AAAA,EAC9D,YACkB,uBACA,oBACA,qBAChB;AACD,UAAA;AAJiB,SAAA,wBAAA;AACA,SAAA,qBAAA;AACA,SAAA,sBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,4FAA4F;AACtH,kBAAc,SAAS,QAAQ,EAAE,SAAA,EAAW,YAAY,4CAA4C,mBAAmB,GAAG;AAC1H,kBAAc,OAAO,KAAK,EAAE,cAAA,EAAgB,YAAY,+DAA+D;AACvH,kBAAc,OAAO,SAAS,EAAE,UAAA,EAAY,YAAY,mEAAmE;AAAA,EAC5H;AAAA,EAEA,MAAgB,QAAQ,OAAqD;AAC5E,UAAM,aAAa,MAAM,YAAY,QAAQ,KAAK;AAClD,UAAM,MAAM,MAAM,UAAU,KAAK;AACjC,UAAM,SAAS,MAAM,UAAU,SAAS,MAAM;AAE9C,UAAM,gBAAgB,KAAK,sBAAsB,QAAQ,GAAG;AAC5D,QAAI,CAAC,eAAe;AACnB,YAAM;AAAA,IACP;AAEA,UAAM,SAAS,MAAM,KAAK,mBAAmB,WAAW,UAAU;AAClE,UAAM,SAASC,aAAAA,aAAa,OAAO,cAAc,UAAU,cAAc,KAAK;AAE9E,YAAQ,IAAI,+BAA+B,UAAU,EAAE;AACvD,YAAQ,IAAI,YAAY,cAAc,QAAQ,EAAE;AAChD,YAAQ,IAAI,EAAE;AAEd,UAAM,KAAK,oBAAoB,MAAM,QAAQ,QAAQ,EAAE,QAAQ;AAE/D,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,SAAS,4CAA4C,+BAA+B;AAChG,WAAO;AAAA,EACR;AACD;;"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Command } from "@contember/cli-common";
|
|
2
|
+
import { TenantClient } from "../../lib/tenant/TenantClient.js";
|
|
3
|
+
const DEFAULT_CONFIG_PATH = "tenant.config.ts";
|
|
4
|
+
class TenantApplyCommand extends Command {
|
|
5
|
+
constructor(remoteProjectResolver, tenantConfigLoader, tenantConfigApplier) {
|
|
6
|
+
super();
|
|
7
|
+
this.remoteProjectResolver = remoteProjectResolver;
|
|
8
|
+
this.tenantConfigLoader = tenantConfigLoader;
|
|
9
|
+
this.tenantConfigApplier = tenantConfigApplier;
|
|
10
|
+
}
|
|
11
|
+
configure(configuration) {
|
|
12
|
+
configuration.description("Apply declarative tenant configuration (global config, identity providers, mail templates)");
|
|
13
|
+
configuration.argument("config").optional().description(`Path to the tenant config file (default: ${DEFAULT_CONFIG_PATH})`);
|
|
14
|
+
configuration.option("dsn").valueRequired().description("Project DSN. Falls back to CONTEMBER_* environment variables.");
|
|
15
|
+
configuration.option("dry-run").valueNone().description("Print the actions that would be performed without executing them.");
|
|
16
|
+
}
|
|
17
|
+
async execute(input) {
|
|
18
|
+
const configPath = input.getArgument("config") ?? DEFAULT_CONFIG_PATH;
|
|
19
|
+
const dsn = input.getOption("dsn");
|
|
20
|
+
const dryRun = input.getOption("dry-run") === true;
|
|
21
|
+
const remoteProject = this.remoteProjectResolver.resolve(dsn);
|
|
22
|
+
if (!remoteProject) {
|
|
23
|
+
throw `Project not defined. Please provide a DSN (--dsn) or set CONTEMBER_* environment variables.`;
|
|
24
|
+
}
|
|
25
|
+
const config = await this.tenantConfigLoader.loadConfig(configPath);
|
|
26
|
+
const client = TenantClient.create(remoteProject.endpoint, remoteProject.token);
|
|
27
|
+
console.log(`Applying tenant config from ${configPath}`);
|
|
28
|
+
console.log(`API URL: ${remoteProject.endpoint}`);
|
|
29
|
+
console.log("");
|
|
30
|
+
await this.tenantConfigApplier.apply(client, config, { dryRun });
|
|
31
|
+
console.log("");
|
|
32
|
+
console.log(dryRun ? "Dry run complete. No changes were made." : "Tenant configuration applied.");
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
TenantApplyCommand
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=TenantApplyCommand.js.map
|