@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
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import prompts from 'prompts'
|
|
2
|
-
import { MigrationPrinter } from './MigrationPrinter'
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { MigrationPrinter } from './MigrationPrinter.js'
|
|
3
|
+
import {
|
|
4
|
+
isSchemaMigration,
|
|
5
|
+
MigrateErrorCode,
|
|
6
|
+
MigrationExecutor,
|
|
7
|
+
MigrationToExecuteOkStatus,
|
|
8
|
+
SchemaState,
|
|
9
|
+
SchemaStateManager,
|
|
10
|
+
SchemaVersionBuilder,
|
|
11
|
+
} from '@contember/migrations-client'
|
|
12
|
+
import { MigrationsStatusFacade } from './MigrationsStatusFacade.js'
|
|
13
|
+
import { MigrationSnapshotFacade } from './MigrationSnapshotFacade.js'
|
|
5
14
|
import { MigrationVersionHelper } from '@contember/engine-common'
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { RemoteProjectProvider } from '../project/RemoteProjectProvider'
|
|
15
|
+
import { SystemClientProvider } from '../SystemClientProvider.js'
|
|
16
|
+
import { TenantClientProvider } from '../TenantClientProvider.js'
|
|
17
|
+
import { RemoteProjectProvider } from '../project/RemoteProjectProvider.js'
|
|
10
18
|
|
|
11
19
|
export class MigrationExecutionFacade {
|
|
12
20
|
constructor(
|
|
@@ -17,6 +25,8 @@ export class MigrationExecutionFacade {
|
|
|
17
25
|
private readonly migrationPrinter: MigrationPrinter,
|
|
18
26
|
private readonly migrationExecutor: MigrationExecutor,
|
|
19
27
|
private readonly migrationStatusFacade: MigrationsStatusFacade,
|
|
28
|
+
private readonly schemaStateManager: SchemaStateManager,
|
|
29
|
+
private readonly migrationSnapshotFacade: MigrationSnapshotFacade,
|
|
20
30
|
) {
|
|
21
31
|
}
|
|
22
32
|
|
|
@@ -25,28 +35,52 @@ export class MigrationExecutionFacade {
|
|
|
25
35
|
force,
|
|
26
36
|
until,
|
|
27
37
|
additionalMessage,
|
|
38
|
+
useSnapshot = true,
|
|
28
39
|
}: {
|
|
29
40
|
requireConfirmation: boolean | ((migrations: MigrationToExecuteOkStatus[]) => boolean)
|
|
30
41
|
force?: boolean
|
|
31
42
|
until?: string
|
|
32
43
|
additionalMessage?: string
|
|
44
|
+
useSnapshot?: boolean
|
|
33
45
|
}): Promise<boolean> => {
|
|
34
46
|
const project = this.projectProvider.get()
|
|
35
47
|
await this.tenantClientProvider.get().createProject(project.name, true)
|
|
36
48
|
|
|
49
|
+
const stateMode = await this.schemaStateManager.isStateMode()
|
|
50
|
+
let schemaState = stateMode ? await this.schemaStateManager.readState() : undefined
|
|
51
|
+
|
|
52
|
+
// The state files always reflect the latest schema. When migrating to an older version, that
|
|
53
|
+
// state may reference parts of the model that don't exist yet, so skip it rather than push an
|
|
54
|
+
// inconsistent overlay. Run `migrations:execute` without `--until` to sync the schema state.
|
|
55
|
+
if (until && schemaState) {
|
|
56
|
+
console.log(
|
|
57
|
+
'Warning: schema state was not applied because --until targets a specific migration; the state files reflect the latest schema. Run migrations:execute without --until to sync it.',
|
|
58
|
+
)
|
|
59
|
+
schemaState = undefined
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (useSnapshot) {
|
|
63
|
+
await this.tryApplySnapshot({ until, schemaState })
|
|
64
|
+
}
|
|
65
|
+
|
|
37
66
|
const status = await this.migrationStatusFacade.resolveMigrationsStatus({ force })
|
|
38
67
|
const migrations = until
|
|
39
68
|
? status.migrationsToExecute.filter(it => it.version <= MigrationVersionHelper.extractVersion(until))
|
|
40
69
|
: status.migrationsToExecute
|
|
41
|
-
if (migrations.length === 0) {
|
|
70
|
+
if (migrations.length === 0 && !schemaState) {
|
|
42
71
|
console.log('No migrations to execute')
|
|
43
72
|
return true
|
|
44
73
|
}
|
|
45
|
-
|
|
46
|
-
|
|
74
|
+
if (migrations.length > 0) {
|
|
75
|
+
console.log('Will execute following migrations:')
|
|
76
|
+
migrations.forEach(it => console.log(it.name))
|
|
77
|
+
}
|
|
78
|
+
if (schemaState && migrations.length === 0) {
|
|
79
|
+
console.log('Updating schema state')
|
|
80
|
+
}
|
|
47
81
|
additionalMessage && console.log(additionalMessage)
|
|
48
82
|
|
|
49
|
-
if (typeof requireConfirmation === 'function' ? requireConfirmation(migrations) : requireConfirmation) {
|
|
83
|
+
if (migrations.length > 0 && (typeof requireConfirmation === 'function' ? requireConfirmation(migrations) : requireConfirmation)) {
|
|
50
84
|
if (!process.stdin.isTTY) {
|
|
51
85
|
throw 'TTY not available. Pass --yes option to confirm execution.'
|
|
52
86
|
}
|
|
@@ -81,18 +115,78 @@ export class MigrationExecutionFacade {
|
|
|
81
115
|
} while (true)
|
|
82
116
|
}
|
|
83
117
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
118
|
+
try {
|
|
119
|
+
await this.migrationExecutor.executeMigrations({
|
|
120
|
+
client: this.systemClientProvider.get(),
|
|
121
|
+
migrations,
|
|
122
|
+
schemaState,
|
|
123
|
+
contentMigrationFactoryArgs: {
|
|
124
|
+
apiToken: project.token,
|
|
125
|
+
apiBaseUrl: project.endpoint,
|
|
126
|
+
projectName: project.name,
|
|
127
|
+
schemaVersionBuilder: this.schemaVersionBuilder,
|
|
128
|
+
},
|
|
129
|
+
log: message => console.log(message),
|
|
130
|
+
force,
|
|
131
|
+
})
|
|
132
|
+
} catch (e) {
|
|
133
|
+
if (isViewReplaceFailure(e)) {
|
|
134
|
+
console.error(
|
|
135
|
+
"\nAn in-place view update (CREATE OR REPLACE VIEW) failed — Postgres rejects it (SQLSTATE 42P16) when a view's"
|
|
136
|
+
+ ' output columns changed (e.g. reordered or retyped) even though its fields did not.\n'
|
|
137
|
+
+ 'Re-generate the migration with `migrations:diff <name> --recreate-views` to drop & recreate the affected'
|
|
138
|
+
+ ' views (and their dependants) instead.\n',
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
throw e
|
|
142
|
+
}
|
|
96
143
|
return true
|
|
97
144
|
}
|
|
145
|
+
|
|
146
|
+
private async tryApplySnapshot({ until, schemaState }: { until?: string; schemaState?: SchemaState }): Promise<void> {
|
|
147
|
+
const executed = await this.systemClientProvider.get().listExecutedMigrations()
|
|
148
|
+
const snapshot = await this.migrationSnapshotFacade.getUsableSnapshot(executed)
|
|
149
|
+
if (!snapshot) {
|
|
150
|
+
return
|
|
151
|
+
}
|
|
152
|
+
if (until && snapshot.version > MigrationVersionHelper.extractVersion(until)) {
|
|
153
|
+
// snapshot reaches past the requested target — fall back to a normal replay
|
|
154
|
+
return
|
|
155
|
+
}
|
|
156
|
+
console.log(`Bootstrapping from snapshot (collapses ${snapshot.covers.length} migrations up to ${snapshot.version})`)
|
|
157
|
+
if (snapshot.contentMigrations.length > 0) {
|
|
158
|
+
console.warn(
|
|
159
|
+
`Note: ${snapshot.contentMigrations.length} content migration(s) are covered by the snapshot; their data is NOT reproduced.`,
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
const input = await this.migrationSnapshotFacade.buildSnapshotInput(snapshot)
|
|
163
|
+
try {
|
|
164
|
+
await this.systemClientProvider.get().migrateFromSnapshot(input, schemaState)
|
|
165
|
+
} catch (e) {
|
|
166
|
+
if (isProjectNotEmptyError(e)) {
|
|
167
|
+
// The project was migrated between our emptiness check and the server call (e.g. a
|
|
168
|
+
// concurrent execute on a fresh database). Fall back to a normal replay rather than
|
|
169
|
+
// crashing — the subsequent status resolution will pick up whatever is left to run.
|
|
170
|
+
console.warn('Snapshot skipped: the project is no longer empty. Falling back to a full replay.')
|
|
171
|
+
return
|
|
172
|
+
}
|
|
173
|
+
throw e
|
|
174
|
+
}
|
|
175
|
+
console.log('Snapshot applied')
|
|
176
|
+
}
|
|
98
177
|
}
|
|
178
|
+
|
|
179
|
+
const isProjectNotEmptyError = (e: unknown): boolean =>
|
|
180
|
+
Array.isArray(e) && e.some(it => it !== null && typeof it === 'object' && (it as { code?: unknown }).code === MigrateErrorCode.ProjectNotEmpty)
|
|
181
|
+
|
|
182
|
+
// A failed `updateView` modification surfaces as MIGRATION_FAILED whose developerMessage embeds the failing
|
|
183
|
+
// statement (`CREATE OR REPLACE VIEW …`). Since each modification's SQL is executed in isolation, that string
|
|
184
|
+
// is a precise signal that an in-place view update — and not some other statement — is what Postgres rejected.
|
|
185
|
+
const isViewReplaceFailure = (e: unknown): boolean =>
|
|
186
|
+
Array.isArray(e) && e.some(it =>
|
|
187
|
+
it !== null
|
|
188
|
+
&& typeof it === 'object'
|
|
189
|
+
&& (it as { code?: unknown }).code === MigrateErrorCode.MigrationFailed
|
|
190
|
+
&& typeof (it as { message?: unknown }).message === 'string'
|
|
191
|
+
&& (it as { message: string }).message.includes('CREATE OR REPLACE VIEW')
|
|
192
|
+
)
|
|
@@ -5,7 +5,7 @@ import chalk from 'chalk'
|
|
|
5
5
|
import { AnyMigrationStatus, Migration, MigrationDescriber, MigrationState } from '@contember/migrations-client'
|
|
6
6
|
import { emptyDatabaseMetadata } from '@contember/database'
|
|
7
7
|
import chalkTable from 'chalk-table'
|
|
8
|
-
import { assertNever } from '../assertNever'
|
|
8
|
+
import { assertNever } from '../assertNever.js'
|
|
9
9
|
|
|
10
10
|
export class MigrationPrinter {
|
|
11
11
|
constructor(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Migration, MigrationFilesManager, SchemaVersionBuilder, SystemClient } from '@contember/migrations-client'
|
|
2
|
-
import { MigrationsValidator } from './MigrationsValidator'
|
|
1
|
+
import { Migration, MigrationFilesManager, SchemaStateManager, SchemaVersionBuilder, SystemClient } from '@contember/migrations-client'
|
|
2
|
+
import { MigrationsValidator } from './MigrationsValidator.js'
|
|
3
3
|
import { emptySchema } from '@contember/schema-utils'
|
|
4
4
|
import { MigrationVersionHelper } from '@contember/engine-common'
|
|
5
|
-
import { SystemClientProvider } from '../SystemClientProvider'
|
|
5
|
+
import { SystemClientProvider } from '../SystemClientProvider.js'
|
|
6
6
|
|
|
7
7
|
export class MigrationRebaseFacade {
|
|
8
8
|
constructor(
|
|
@@ -10,6 +10,7 @@ export class MigrationRebaseFacade {
|
|
|
10
10
|
private readonly migrationsValidator: MigrationsValidator,
|
|
11
11
|
private readonly systemClientProvider: SystemClientProvider,
|
|
12
12
|
private readonly migrationFilesManager: MigrationFilesManager,
|
|
13
|
+
private readonly schemaStateManager: SchemaStateManager,
|
|
13
14
|
) {
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -37,5 +38,11 @@ export class MigrationRebaseFacade {
|
|
|
37
38
|
await this.systemClientProvider.get().migrationModify(migration.version, newMigration)
|
|
38
39
|
await this.migrationFilesManager.moveFile(migration.name, newMigration.name)
|
|
39
40
|
}
|
|
41
|
+
|
|
42
|
+
// migrationModify rebuilds the server schema from migrations, dropping the non-model
|
|
43
|
+
// state; re-apply it from the state files so the server stays consistent.
|
|
44
|
+
if (await this.schemaStateManager.isStateMode()) {
|
|
45
|
+
await this.systemClientProvider.get().migrate([], false, await this.schemaStateManager.readState())
|
|
46
|
+
}
|
|
40
47
|
}
|
|
41
48
|
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { compareArraysIgnoreOrder, deepCompare, emptySchema } from '@contember/schema-utils'
|
|
2
|
+
import {
|
|
3
|
+
calculateMigrationChecksum,
|
|
4
|
+
CoveredMigration,
|
|
5
|
+
ExecutedMigrationInfo,
|
|
6
|
+
isSchemaMigration,
|
|
7
|
+
MigrationContent,
|
|
8
|
+
MigrationsResolver,
|
|
9
|
+
SchemaDiffer,
|
|
10
|
+
SchemaMigrator,
|
|
11
|
+
SchemaStateManager,
|
|
12
|
+
SchemaVersionBuilder,
|
|
13
|
+
SnapshotFile,
|
|
14
|
+
SnapshotInput,
|
|
15
|
+
SnapshotManager,
|
|
16
|
+
VERSION_LATEST,
|
|
17
|
+
} from '@contember/migrations-client'
|
|
18
|
+
|
|
19
|
+
export class MigrationSnapshotFacade {
|
|
20
|
+
constructor(
|
|
21
|
+
private readonly migrationsResolver: MigrationsResolver,
|
|
22
|
+
private readonly schemaVersionBuilder: SchemaVersionBuilder,
|
|
23
|
+
private readonly schemaDiffer: SchemaDiffer,
|
|
24
|
+
private readonly schemaMigrator: SchemaMigrator,
|
|
25
|
+
private readonly schemaStateManager: SchemaStateManager,
|
|
26
|
+
private readonly snapshotManager: SnapshotManager,
|
|
27
|
+
) {
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Collapses all migrations into a single schema snapshot and writes snapshot.json. */
|
|
31
|
+
async create(): Promise<SnapshotFile> {
|
|
32
|
+
const files = await this.migrationsResolver.getMigrationFiles()
|
|
33
|
+
if (files.length === 0) {
|
|
34
|
+
throw 'No migrations to snapshot'
|
|
35
|
+
}
|
|
36
|
+
const stateMode = await this.schemaStateManager.isStateMode()
|
|
37
|
+
const version = files[files.length - 1].version
|
|
38
|
+
|
|
39
|
+
// Replay all schema migrations into a single schema. In state mode the non-model parts
|
|
40
|
+
// (acl/validation/actions/settings) live in state/ and are skipped here; otherwise they
|
|
41
|
+
// are part of the migration history and must be included in the collapsed modifications.
|
|
42
|
+
const collapsedSchema = await this.schemaVersionBuilder.buildSchemaAdvanced(emptySchema, () => true)
|
|
43
|
+
const modifications = this.schemaDiffer.diffSchemas(emptySchema, collapsedSchema, {
|
|
44
|
+
skipNonModelDiffers: stateMode,
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const covers: CoveredMigration[] = []
|
|
48
|
+
const contentMigrations: string[] = []
|
|
49
|
+
for (const file of files) {
|
|
50
|
+
const content = await file.getContent()
|
|
51
|
+
const schema = isSchemaMigration(content)
|
|
52
|
+
covers.push({
|
|
53
|
+
version: file.version,
|
|
54
|
+
name: file.name,
|
|
55
|
+
type: schema ? 'schema' : 'content',
|
|
56
|
+
checksum: schema ? calculateMigrationChecksum(content) : null,
|
|
57
|
+
})
|
|
58
|
+
if (!schema) {
|
|
59
|
+
contentMigrations.push(file.version)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const snapshot: SnapshotFile = {
|
|
64
|
+
version,
|
|
65
|
+
stateMode,
|
|
66
|
+
snapshot: { formatVersion: VERSION_LATEST, modifications },
|
|
67
|
+
covers,
|
|
68
|
+
contentMigrations,
|
|
69
|
+
}
|
|
70
|
+
await this.snapshotManager.write(snapshot)
|
|
71
|
+
return snapshot
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Returns the snapshot when it can safely bootstrap the current project, else null.
|
|
76
|
+
* The snapshot is only usable on an empty project (no executed migrations) and only when
|
|
77
|
+
* none of the covered migration files have changed. A present-but-stale snapshot is skipped
|
|
78
|
+
* with a warning, falling back to a full replay.
|
|
79
|
+
*/
|
|
80
|
+
async getUsableSnapshot(executedMigrations: ExecutedMigrationInfo[]): Promise<SnapshotFile | null> {
|
|
81
|
+
if (!(await this.snapshotManager.exists())) {
|
|
82
|
+
return null
|
|
83
|
+
}
|
|
84
|
+
if (executedMigrations.length > 0) {
|
|
85
|
+
return null
|
|
86
|
+
}
|
|
87
|
+
const snapshot = await this.snapshotManager.read()
|
|
88
|
+
const stale = await this.findStaleness(snapshot)
|
|
89
|
+
if (stale) {
|
|
90
|
+
console.warn(`Ignoring snapshot: ${stale}. Run "migrations:snapshot" to regenerate it.`)
|
|
91
|
+
return null
|
|
92
|
+
}
|
|
93
|
+
return snapshot
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Maps a snapshot to the GraphQL SnapshotInput; covered migrations are sent as Migration inputs. */
|
|
97
|
+
async buildSnapshotInput(snapshot: SnapshotFile): Promise<SnapshotInput> {
|
|
98
|
+
const files = await this.migrationsResolver.getMigrationFiles()
|
|
99
|
+
const byVersion = new Map(files.map(it => [it.version, it]))
|
|
100
|
+
const covers: unknown[] = []
|
|
101
|
+
for (const covered of snapshot.covers) {
|
|
102
|
+
const file = byVersion.get(covered.version)
|
|
103
|
+
if (!file) {
|
|
104
|
+
throw `Snapshot covers missing migration ${covered.name}`
|
|
105
|
+
}
|
|
106
|
+
covers.push(migrationContentToInput(covered.version, covered.name, await file.getContent()))
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
formatVersion: snapshot.snapshot.formatVersion,
|
|
110
|
+
modifications: snapshot.snapshot.modifications,
|
|
111
|
+
covers,
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Offline check that the snapshot still equals a full replay of all migrations. */
|
|
116
|
+
async verify(): Promise<{ ok: boolean; message: string }> {
|
|
117
|
+
if (!(await this.snapshotManager.exists())) {
|
|
118
|
+
throw 'No snapshot found. Run "migrations:snapshot" first.'
|
|
119
|
+
}
|
|
120
|
+
const snapshot = await this.snapshotManager.read()
|
|
121
|
+
|
|
122
|
+
const stale = await this.findStaleness(snapshot)
|
|
123
|
+
if (stale) {
|
|
124
|
+
return { ok: false, message: `Snapshot is stale: ${stale}. Run "migrations:snapshot" to regenerate it.` }
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const stateMode = await this.schemaStateManager.isStateMode()
|
|
128
|
+
const replaySchema = await this.schemaVersionBuilder.buildSchema()
|
|
129
|
+
let snapshotSchema = this.schemaMigrator.applyModifications(emptySchema, snapshot.snapshot.modifications, snapshot.snapshot.formatVersion)
|
|
130
|
+
if (stateMode) {
|
|
131
|
+
snapshotSchema = { ...snapshotSchema, ...await this.schemaStateManager.readState() }
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Compare with the same order-insensitive equality that SchemaDiffer uses for its own
|
|
135
|
+
// round-trip check. The collapsed differ emits fields/constraints in a fixed order that may
|
|
136
|
+
// differ from a replay of an interleaved history (e.g. a column added to an entity that
|
|
137
|
+
// already has a relation), so a raw checksum (JSON.stringify) would report false mismatches
|
|
138
|
+
// on schemas that are in fact deeply equal.
|
|
139
|
+
const differences = deepCompare(replaySchema, snapshotSchema, [], path => {
|
|
140
|
+
if (path[0] === 'model' && path[1] === 'entities' && (path[3] === 'unique' || path[3] === 'index')) {
|
|
141
|
+
return (a, b) => compareArraysIgnoreOrder(a, b, path)
|
|
142
|
+
}
|
|
143
|
+
return null
|
|
144
|
+
})
|
|
145
|
+
if (differences.length === 0) {
|
|
146
|
+
return {
|
|
147
|
+
ok: true,
|
|
148
|
+
message: `Snapshot is up to date (covers ${snapshot.covers.length} migrations up to ${snapshot.version}).`,
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
ok: false,
|
|
153
|
+
message: 'Snapshot does not match a full replay of all migrations. Run "migrations:snapshot" to regenerate it.',
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
private async findStaleness(snapshot: SnapshotFile): Promise<string | null> {
|
|
158
|
+
// The collapsed snapshot is built differently per mode (state mode omits the non-model parts,
|
|
159
|
+
// see create()), and on bootstrap the non-model overlay is driven by the *current* mode. A mode
|
|
160
|
+
// switch since the snapshot was created (e.g. migrations:init-state) leaves the covers untouched
|
|
161
|
+
// and would otherwise pass unnoticed, so treat it as stale and fall back to a full replay.
|
|
162
|
+
if (snapshot.stateMode !== await this.schemaStateManager.isStateMode()) {
|
|
163
|
+
return `schema state mode changed since the snapshot was created`
|
|
164
|
+
}
|
|
165
|
+
const files = await this.migrationsResolver.getMigrationFiles()
|
|
166
|
+
const byVersion = new Map(files.map(it => [it.version, it]))
|
|
167
|
+
for (const covered of snapshot.covers) {
|
|
168
|
+
const file = byVersion.get(covered.version)
|
|
169
|
+
if (!file) {
|
|
170
|
+
return `covered migration ${covered.name} is missing`
|
|
171
|
+
}
|
|
172
|
+
const content = await file.getContent()
|
|
173
|
+
const currentType = isSchemaMigration(content) ? 'schema' : 'content'
|
|
174
|
+
// A covered migration that flipped type (e.g. a content migration manually rewritten into a
|
|
175
|
+
// schema one) is not reflected in the collapsed modifications, so the snapshot no longer
|
|
176
|
+
// equals a replay. Schema covers also verify the checksum; content covers carry none (their
|
|
177
|
+
// data is never reproduced), so the type check is the only identity they get.
|
|
178
|
+
if (currentType !== covered.type) {
|
|
179
|
+
return `covered migration ${covered.name} changed type`
|
|
180
|
+
}
|
|
181
|
+
if (covered.type === 'schema') {
|
|
182
|
+
const checksum = isSchemaMigration(content) ? calculateMigrationChecksum(content) : null
|
|
183
|
+
if (checksum !== covered.checksum) {
|
|
184
|
+
return `covered migration ${covered.name} has changed`
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// Detect a migration added within the covered range (version <= snapshot.version) that the
|
|
189
|
+
// snapshot does not know about — e.g. a teammate's migration with an earlier timestamp merged
|
|
190
|
+
// after the snapshot was generated. Without this, bootstrapping would record the covers up to
|
|
191
|
+
// snapshot.version and the subsequent normal replay would fail with MUST_FOLLOW_LATEST on the
|
|
192
|
+
// in-range migration, leaving the database half-bootstrapped. Treat it as stale and fall back.
|
|
193
|
+
const coveredVersions = new Set(snapshot.covers.map(it => it.version))
|
|
194
|
+
for (const file of files) {
|
|
195
|
+
if (file.version <= snapshot.version && !coveredVersions.has(file.version)) {
|
|
196
|
+
return `migration ${file.name} is within the covered range but not part of the snapshot`
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return null
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const migrationContentToInput = (version: string, name: string, content: MigrationContent) => {
|
|
204
|
+
if (isSchemaMigration(content)) {
|
|
205
|
+
return {
|
|
206
|
+
version,
|
|
207
|
+
name,
|
|
208
|
+
type: 'SCHEMA',
|
|
209
|
+
schemaMigration: {
|
|
210
|
+
formatVersion: content.formatVersion,
|
|
211
|
+
modifications: content.modifications,
|
|
212
|
+
skippedErrors: content.skippedErrors,
|
|
213
|
+
},
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
// Content migrations are only recorded as executed (no data is replayed), so the queries are irrelevant.
|
|
217
|
+
return { version, name, type: 'CONTENT', contentMigration: [] }
|
|
218
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MigrationsResolver, MigrationsStatusResolver } from '@contember/migrations-client'
|
|
2
|
-
import { SystemClientProvider } from '../SystemClientProvider'
|
|
3
|
-
import { MigrationPrinter } from './MigrationPrinter'
|
|
2
|
+
import { SystemClientProvider } from '../SystemClientProvider.js'
|
|
3
|
+
import { MigrationPrinter } from './MigrationPrinter.js'
|
|
4
4
|
|
|
5
5
|
export class MigrationsStatusFacade {
|
|
6
6
|
constructor(
|
|
@@ -2,7 +2,7 @@ import { Migration } from '@contember/migrations-client'
|
|
|
2
2
|
import { Schema } from '@contember/schema'
|
|
3
3
|
import { SchemaValidatorSkippedErrors } from '@contember/schema-utils'
|
|
4
4
|
import { MigrationDescriber, MigrationVersionHelper, SchemaMigrator, SchemaUpdateError } from '@contember/schema-migrations'
|
|
5
|
-
import { validateSchemaAndPrintErrors } from '../schema/SchemaValidationHelper'
|
|
5
|
+
import { validateSchemaAndPrintErrors } from '../schema/SchemaValidationHelper.js'
|
|
6
6
|
|
|
7
7
|
export class MigrationsValidator {
|
|
8
8
|
constructor(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { parseDsn } from '../dsn'
|
|
2
|
-
import { RemoteProject } from './RemoteProject'
|
|
3
|
-
import { CliEnv } from '../env'
|
|
1
|
+
import { parseDsn } from '../dsn.js'
|
|
2
|
+
import { RemoteProject } from './RemoteProject.js'
|
|
3
|
+
import { CliEnv } from '../env.js'
|
|
4
4
|
|
|
5
5
|
export class RemoteProjectResolver {
|
|
6
6
|
constructor(
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Model, Schema } from '@contember/schema'
|
|
2
|
-
import { ReferencesMap } from '../../../schema/collectReferences'
|
|
3
|
-
import { formatEntityAnchor, formatFieldAnchor } from './utils'
|
|
4
|
-
import { SinglePermission } from './SinglePermission'
|
|
5
|
-
import { FieldType } from './FieldType'
|
|
6
|
-
import { FieldPermissions } from './FieldPermissions'
|
|
7
|
-
import { OnDelete } from './OnDelete'
|
|
2
|
+
import { ReferencesMap } from '../../../schema/collectReferences.js'
|
|
3
|
+
import { formatEntityAnchor, formatFieldAnchor } from './utils.js'
|
|
4
|
+
import { SinglePermission } from './SinglePermission.js'
|
|
5
|
+
import { FieldType } from './FieldType.js'
|
|
6
|
+
import { FieldPermissions } from './FieldPermissions.js'
|
|
7
|
+
import { OnDelete } from './OnDelete.js'
|
|
8
8
|
import { Fragment, h } from 'preact'
|
|
9
9
|
|
|
10
10
|
interface EntityInfoProps {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h } from 'preact'
|
|
2
|
-
import { formatEntityAnchor } from './utils'
|
|
2
|
+
import { formatEntityAnchor } from './utils.js'
|
|
3
3
|
|
|
4
4
|
export const EntityLink = ({ entity }: { entity: string }) => (
|
|
5
5
|
<a href={`#${formatEntityAnchor(entity)}`} class={'text-blue-500 hover:underline'}>{entity}</a>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, h } from 'preact'
|
|
2
|
-
import { EntityLink } from './EntityLink'
|
|
3
|
-
import { formatFieldAnchor } from './utils'
|
|
2
|
+
import { EntityLink } from './EntityLink.js'
|
|
3
|
+
import { formatFieldAnchor } from './utils.js'
|
|
4
4
|
|
|
5
5
|
export const FieldLink = ({ entity, field, noEntityLabel }: { entity: string; field: string; noEntityLabel?: boolean }) => (
|
|
6
6
|
<Fragment>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, h } from 'preact'
|
|
2
2
|
import { Acl } from '@contember/schema'
|
|
3
|
-
import { SinglePermission } from './SinglePermission'
|
|
3
|
+
import { SinglePermission } from './SinglePermission.js'
|
|
4
4
|
|
|
5
5
|
export const FieldPermissions = ({ entityPermissions, field }: { entityPermissions?: Acl.EntityPermissions; field: string }) => {
|
|
6
6
|
const readPermissions = entityPermissions?.operations.read?.[field]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Model } from '@contember/schema'
|
|
2
2
|
import { Fragment, h } from 'preact'
|
|
3
|
-
import { EntityLink } from './EntityLink'
|
|
4
|
-
import { FieldLink } from './FieldLink'
|
|
3
|
+
import { EntityLink } from './EntityLink.js'
|
|
4
|
+
import { FieldLink } from './FieldLink.js'
|
|
5
5
|
|
|
6
6
|
export const FieldType = ({ field }: { field: Model.AnyField }) => {
|
|
7
7
|
if (field.type === 'ManyHasMany') {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Fragment, h } from 'preact'
|
|
2
2
|
import { Model } from '@contember/schema'
|
|
3
|
-
import { ReferenceMapEntry, ReferencesMap } from '../../../schema/collectReferences'
|
|
4
|
-
import { FieldLink } from './FieldLink'
|
|
5
|
-
import { EntityLink } from './EntityLink'
|
|
3
|
+
import { ReferenceMapEntry, ReferencesMap } from '../../../schema/collectReferences.js'
|
|
4
|
+
import { FieldLink } from './FieldLink.js'
|
|
5
|
+
import { EntityLink } from './EntityLink.js'
|
|
6
6
|
|
|
7
7
|
const sortReferences = (a: ReferenceMapEntry, b: ReferenceMapEntry) =>
|
|
8
8
|
a.owningRelation.joiningColumn.onDelete.localeCompare(b.owningRelation.joiningColumn.onDelete)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Schema } from '@contember/schema'
|
|
2
2
|
import { h } from 'preact'
|
|
3
|
-
import { collectReferences } from '../../../schema/collectReferences'
|
|
4
|
-
import { EntityLink } from './EntityLink'
|
|
5
|
-
import { EntityInfo } from './EntityInfo'
|
|
3
|
+
import { collectReferences } from '../../../schema/collectReferences.js'
|
|
4
|
+
import { EntityLink } from './EntityLink.js'
|
|
5
|
+
import { EntityInfo } from './EntityInfo.js'
|
|
6
6
|
|
|
7
7
|
export const ProjectInfo = (props: { schema: Schema; projectName: string }) => {
|
|
8
8
|
const references = collectReferences(props.schema.model)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Schema } from '@contember/schema'
|
|
2
2
|
import { h } from 'preact'
|
|
3
3
|
import render from 'preact-render-to-string'
|
|
4
|
-
import { ProjectInfo } from './components/ProjectInfo'
|
|
4
|
+
import { ProjectInfo } from './components/ProjectInfo.js'
|
|
5
5
|
import { readFile } from 'node:fs/promises'
|
|
6
|
-
import { packageRoot } from '../../../consts'
|
|
6
|
+
import { packageRoot } from '../../../consts.js'
|
|
7
7
|
|
|
8
8
|
export const renderProjectInfoHtml = async (schema: Schema, projectName: string) => {
|
|
9
9
|
const html = render(<ProjectInfo schema={schema} projectName={projectName} />)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { join } from 'node:path'
|
|
2
2
|
import { Schema } from '@contember/schema'
|
|
3
3
|
import { schemaType } from '@contember/schema-utils'
|
|
4
|
-
import { JsCodeRunner } from '../js/JsCodeRunner'
|
|
4
|
+
import { JsCodeRunner } from '../js/JsCodeRunner.js'
|
|
5
5
|
import * as Typesafe from '@contember/typesafe'
|
|
6
|
-
import { Workspace } from '../workspace/Workspace'
|
|
6
|
+
import { Workspace } from '../workspace/Workspace.js'
|
|
7
7
|
|
|
8
8
|
export class ImportSchemaLoader {
|
|
9
9
|
constructor(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from '@contember/schema'
|
|
2
2
|
import { SchemaValidator, SchemaValidatorSkippedErrors } from '@contember/schema-utils'
|
|
3
|
-
import { printValidationErrors } from './SchemaValidationPrinter'
|
|
3
|
+
import { printValidationErrors } from './SchemaValidationPrinter.js'
|
|
4
4
|
|
|
5
5
|
export const validateSchemaAndPrintErrors = (schema: Schema, message?: string, skippedErrors?: SchemaValidatorSkippedErrors[]): boolean => {
|
|
6
6
|
const errors = SchemaValidator.validate(schema, skippedErrors)
|