@contember/cli 2.1.0-beta.2 → 2.2.0-alpha.1
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
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const schemaUtils = require("@contember/schema-utils");
|
|
4
|
+
const migrationsClient = require("@contember/migrations-client");
|
|
5
|
+
class MigrationSnapshotFacade {
|
|
6
|
+
constructor(migrationsResolver, schemaVersionBuilder, schemaDiffer, schemaMigrator, schemaStateManager, snapshotManager) {
|
|
7
|
+
this.migrationsResolver = migrationsResolver;
|
|
8
|
+
this.schemaVersionBuilder = schemaVersionBuilder;
|
|
9
|
+
this.schemaDiffer = schemaDiffer;
|
|
10
|
+
this.schemaMigrator = schemaMigrator;
|
|
11
|
+
this.schemaStateManager = schemaStateManager;
|
|
12
|
+
this.snapshotManager = snapshotManager;
|
|
13
|
+
}
|
|
14
|
+
/** Collapses all migrations into a single schema snapshot and writes snapshot.json. */
|
|
15
|
+
async create() {
|
|
16
|
+
const files = await this.migrationsResolver.getMigrationFiles();
|
|
17
|
+
if (files.length === 0) {
|
|
18
|
+
throw "No migrations to snapshot";
|
|
19
|
+
}
|
|
20
|
+
const stateMode = await this.schemaStateManager.isStateMode();
|
|
21
|
+
const version = files[files.length - 1].version;
|
|
22
|
+
const collapsedSchema = await this.schemaVersionBuilder.buildSchemaAdvanced(schemaUtils.emptySchema, () => true);
|
|
23
|
+
const modifications = this.schemaDiffer.diffSchemas(schemaUtils.emptySchema, collapsedSchema, {
|
|
24
|
+
skipNonModelDiffers: stateMode
|
|
25
|
+
});
|
|
26
|
+
const covers = [];
|
|
27
|
+
const contentMigrations = [];
|
|
28
|
+
for (const file of files) {
|
|
29
|
+
const content = await file.getContent();
|
|
30
|
+
const schema = migrationsClient.isSchemaMigration(content);
|
|
31
|
+
covers.push({
|
|
32
|
+
version: file.version,
|
|
33
|
+
name: file.name,
|
|
34
|
+
type: schema ? "schema" : "content",
|
|
35
|
+
checksum: schema ? migrationsClient.calculateMigrationChecksum(content) : null
|
|
36
|
+
});
|
|
37
|
+
if (!schema) {
|
|
38
|
+
contentMigrations.push(file.version);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const snapshot = {
|
|
42
|
+
version,
|
|
43
|
+
stateMode,
|
|
44
|
+
snapshot: { formatVersion: migrationsClient.VERSION_LATEST, modifications },
|
|
45
|
+
covers,
|
|
46
|
+
contentMigrations
|
|
47
|
+
};
|
|
48
|
+
await this.snapshotManager.write(snapshot);
|
|
49
|
+
return snapshot;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Returns the snapshot when it can safely bootstrap the current project, else null.
|
|
53
|
+
* The snapshot is only usable on an empty project (no executed migrations) and only when
|
|
54
|
+
* none of the covered migration files have changed. A present-but-stale snapshot is skipped
|
|
55
|
+
* with a warning, falling back to a full replay.
|
|
56
|
+
*/
|
|
57
|
+
async getUsableSnapshot(executedMigrations) {
|
|
58
|
+
if (!await this.snapshotManager.exists()) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
if (executedMigrations.length > 0) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const snapshot = await this.snapshotManager.read();
|
|
65
|
+
const stale = await this.findStaleness(snapshot);
|
|
66
|
+
if (stale) {
|
|
67
|
+
console.warn(`Ignoring snapshot: ${stale}. Run "migrations:snapshot" to regenerate it.`);
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
return snapshot;
|
|
71
|
+
}
|
|
72
|
+
/** Maps a snapshot to the GraphQL SnapshotInput; covered migrations are sent as Migration inputs. */
|
|
73
|
+
async buildSnapshotInput(snapshot) {
|
|
74
|
+
const files = await this.migrationsResolver.getMigrationFiles();
|
|
75
|
+
const byVersion = new Map(files.map((it) => [it.version, it]));
|
|
76
|
+
const covers = [];
|
|
77
|
+
for (const covered of snapshot.covers) {
|
|
78
|
+
const file = byVersion.get(covered.version);
|
|
79
|
+
if (!file) {
|
|
80
|
+
throw `Snapshot covers missing migration ${covered.name}`;
|
|
81
|
+
}
|
|
82
|
+
covers.push(migrationContentToInput(covered.version, covered.name, await file.getContent()));
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
formatVersion: snapshot.snapshot.formatVersion,
|
|
86
|
+
modifications: snapshot.snapshot.modifications,
|
|
87
|
+
covers
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/** Offline check that the snapshot still equals a full replay of all migrations. */
|
|
91
|
+
async verify() {
|
|
92
|
+
if (!await this.snapshotManager.exists()) {
|
|
93
|
+
throw 'No snapshot found. Run "migrations:snapshot" first.';
|
|
94
|
+
}
|
|
95
|
+
const snapshot = await this.snapshotManager.read();
|
|
96
|
+
const stale = await this.findStaleness(snapshot);
|
|
97
|
+
if (stale) {
|
|
98
|
+
return { ok: false, message: `Snapshot is stale: ${stale}. Run "migrations:snapshot" to regenerate it.` };
|
|
99
|
+
}
|
|
100
|
+
const stateMode = await this.schemaStateManager.isStateMode();
|
|
101
|
+
const replaySchema = await this.schemaVersionBuilder.buildSchema();
|
|
102
|
+
let snapshotSchema = this.schemaMigrator.applyModifications(schemaUtils.emptySchema, snapshot.snapshot.modifications, snapshot.snapshot.formatVersion);
|
|
103
|
+
if (stateMode) {
|
|
104
|
+
snapshotSchema = { ...snapshotSchema, ...await this.schemaStateManager.readState() };
|
|
105
|
+
}
|
|
106
|
+
const differences = schemaUtils.deepCompare(replaySchema, snapshotSchema, [], (path) => {
|
|
107
|
+
if (path[0] === "model" && path[1] === "entities" && (path[3] === "unique" || path[3] === "index")) {
|
|
108
|
+
return (a, b) => schemaUtils.compareArraysIgnoreOrder(a, b, path);
|
|
109
|
+
}
|
|
110
|
+
return null;
|
|
111
|
+
});
|
|
112
|
+
if (differences.length === 0) {
|
|
113
|
+
return {
|
|
114
|
+
ok: true,
|
|
115
|
+
message: `Snapshot is up to date (covers ${snapshot.covers.length} migrations up to ${snapshot.version}).`
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
ok: false,
|
|
120
|
+
message: 'Snapshot does not match a full replay of all migrations. Run "migrations:snapshot" to regenerate it.'
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
async findStaleness(snapshot) {
|
|
124
|
+
if (snapshot.stateMode !== await this.schemaStateManager.isStateMode()) {
|
|
125
|
+
return `schema state mode changed since the snapshot was created`;
|
|
126
|
+
}
|
|
127
|
+
const files = await this.migrationsResolver.getMigrationFiles();
|
|
128
|
+
const byVersion = new Map(files.map((it) => [it.version, it]));
|
|
129
|
+
for (const covered of snapshot.covers) {
|
|
130
|
+
const file = byVersion.get(covered.version);
|
|
131
|
+
if (!file) {
|
|
132
|
+
return `covered migration ${covered.name} is missing`;
|
|
133
|
+
}
|
|
134
|
+
const content = await file.getContent();
|
|
135
|
+
const currentType = migrationsClient.isSchemaMigration(content) ? "schema" : "content";
|
|
136
|
+
if (currentType !== covered.type) {
|
|
137
|
+
return `covered migration ${covered.name} changed type`;
|
|
138
|
+
}
|
|
139
|
+
if (covered.type === "schema") {
|
|
140
|
+
const checksum = migrationsClient.isSchemaMigration(content) ? migrationsClient.calculateMigrationChecksum(content) : null;
|
|
141
|
+
if (checksum !== covered.checksum) {
|
|
142
|
+
return `covered migration ${covered.name} has changed`;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const coveredVersions = new Set(snapshot.covers.map((it) => it.version));
|
|
147
|
+
for (const file of files) {
|
|
148
|
+
if (file.version <= snapshot.version && !coveredVersions.has(file.version)) {
|
|
149
|
+
return `migration ${file.name} is within the covered range but not part of the snapshot`;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const migrationContentToInput = (version, name, content) => {
|
|
156
|
+
if (migrationsClient.isSchemaMigration(content)) {
|
|
157
|
+
return {
|
|
158
|
+
version,
|
|
159
|
+
name,
|
|
160
|
+
type: "SCHEMA",
|
|
161
|
+
schemaMigration: {
|
|
162
|
+
formatVersion: content.formatVersion,
|
|
163
|
+
modifications: content.modifications,
|
|
164
|
+
skippedErrors: content.skippedErrors
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
return { version, name, type: "CONTENT", contentMigration: [] };
|
|
169
|
+
};
|
|
170
|
+
exports.MigrationSnapshotFacade = MigrationSnapshotFacade;
|
|
171
|
+
//# sourceMappingURL=MigrationSnapshotFacade.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationSnapshotFacade.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationSnapshotFacade.ts"],"sourcesContent":["import { compareArraysIgnoreOrder, deepCompare, emptySchema } from '@contember/schema-utils'\nimport {\n\tcalculateMigrationChecksum,\n\tCoveredMigration,\n\tExecutedMigrationInfo,\n\tisSchemaMigration,\n\tMigrationContent,\n\tMigrationsResolver,\n\tSchemaDiffer,\n\tSchemaMigrator,\n\tSchemaStateManager,\n\tSchemaVersionBuilder,\n\tSnapshotFile,\n\tSnapshotInput,\n\tSnapshotManager,\n\tVERSION_LATEST,\n} from '@contember/migrations-client'\n\nexport class MigrationSnapshotFacade {\n\tconstructor(\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly schemaDiffer: SchemaDiffer,\n\t\tprivate readonly schemaMigrator: SchemaMigrator,\n\t\tprivate readonly schemaStateManager: SchemaStateManager,\n\t\tprivate readonly snapshotManager: SnapshotManager,\n\t) {\n\t}\n\n\t/** Collapses all migrations into a single schema snapshot and writes snapshot.json. */\n\tasync create(): Promise<SnapshotFile> {\n\t\tconst files = await this.migrationsResolver.getMigrationFiles()\n\t\tif (files.length === 0) {\n\t\t\tthrow 'No migrations to snapshot'\n\t\t}\n\t\tconst stateMode = await this.schemaStateManager.isStateMode()\n\t\tconst version = files[files.length - 1].version\n\n\t\t// Replay all schema migrations into a single schema. In state mode the non-model parts\n\t\t// (acl/validation/actions/settings) live in state/ and are skipped here; otherwise they\n\t\t// are part of the migration history and must be included in the collapsed modifications.\n\t\tconst collapsedSchema = await this.schemaVersionBuilder.buildSchemaAdvanced(emptySchema, () => true)\n\t\tconst modifications = this.schemaDiffer.diffSchemas(emptySchema, collapsedSchema, {\n\t\t\tskipNonModelDiffers: stateMode,\n\t\t})\n\n\t\tconst covers: CoveredMigration[] = []\n\t\tconst contentMigrations: string[] = []\n\t\tfor (const file of files) {\n\t\t\tconst content = await file.getContent()\n\t\t\tconst schema = isSchemaMigration(content)\n\t\t\tcovers.push({\n\t\t\t\tversion: file.version,\n\t\t\t\tname: file.name,\n\t\t\t\ttype: schema ? 'schema' : 'content',\n\t\t\t\tchecksum: schema ? calculateMigrationChecksum(content) : null,\n\t\t\t})\n\t\t\tif (!schema) {\n\t\t\t\tcontentMigrations.push(file.version)\n\t\t\t}\n\t\t}\n\n\t\tconst snapshot: SnapshotFile = {\n\t\t\tversion,\n\t\t\tstateMode,\n\t\t\tsnapshot: { formatVersion: VERSION_LATEST, modifications },\n\t\t\tcovers,\n\t\t\tcontentMigrations,\n\t\t}\n\t\tawait this.snapshotManager.write(snapshot)\n\t\treturn snapshot\n\t}\n\n\t/**\n\t * Returns the snapshot when it can safely bootstrap the current project, else null.\n\t * The snapshot is only usable on an empty project (no executed migrations) and only when\n\t * none of the covered migration files have changed. A present-but-stale snapshot is skipped\n\t * with a warning, falling back to a full replay.\n\t */\n\tasync getUsableSnapshot(executedMigrations: ExecutedMigrationInfo[]): Promise<SnapshotFile | null> {\n\t\tif (!(await this.snapshotManager.exists())) {\n\t\t\treturn null\n\t\t}\n\t\tif (executedMigrations.length > 0) {\n\t\t\treturn null\n\t\t}\n\t\tconst snapshot = await this.snapshotManager.read()\n\t\tconst stale = await this.findStaleness(snapshot)\n\t\tif (stale) {\n\t\t\tconsole.warn(`Ignoring snapshot: ${stale}. Run \"migrations:snapshot\" to regenerate it.`)\n\t\t\treturn null\n\t\t}\n\t\treturn snapshot\n\t}\n\n\t/** Maps a snapshot to the GraphQL SnapshotInput; covered migrations are sent as Migration inputs. */\n\tasync buildSnapshotInput(snapshot: SnapshotFile): Promise<SnapshotInput> {\n\t\tconst files = await this.migrationsResolver.getMigrationFiles()\n\t\tconst byVersion = new Map(files.map(it => [it.version, it]))\n\t\tconst covers: unknown[] = []\n\t\tfor (const covered of snapshot.covers) {\n\t\t\tconst file = byVersion.get(covered.version)\n\t\t\tif (!file) {\n\t\t\t\tthrow `Snapshot covers missing migration ${covered.name}`\n\t\t\t}\n\t\t\tcovers.push(migrationContentToInput(covered.version, covered.name, await file.getContent()))\n\t\t}\n\t\treturn {\n\t\t\tformatVersion: snapshot.snapshot.formatVersion,\n\t\t\tmodifications: snapshot.snapshot.modifications,\n\t\t\tcovers,\n\t\t}\n\t}\n\n\t/** Offline check that the snapshot still equals a full replay of all migrations. */\n\tasync verify(): Promise<{ ok: boolean; message: string }> {\n\t\tif (!(await this.snapshotManager.exists())) {\n\t\t\tthrow 'No snapshot found. Run \"migrations:snapshot\" first.'\n\t\t}\n\t\tconst snapshot = await this.snapshotManager.read()\n\n\t\tconst stale = await this.findStaleness(snapshot)\n\t\tif (stale) {\n\t\t\treturn { ok: false, message: `Snapshot is stale: ${stale}. Run \"migrations:snapshot\" to regenerate it.` }\n\t\t}\n\n\t\tconst stateMode = await this.schemaStateManager.isStateMode()\n\t\tconst replaySchema = await this.schemaVersionBuilder.buildSchema()\n\t\tlet snapshotSchema = this.schemaMigrator.applyModifications(emptySchema, snapshot.snapshot.modifications, snapshot.snapshot.formatVersion)\n\t\tif (stateMode) {\n\t\t\tsnapshotSchema = { ...snapshotSchema, ...await this.schemaStateManager.readState() }\n\t\t}\n\n\t\t// Compare with the same order-insensitive equality that SchemaDiffer uses for its own\n\t\t// round-trip check. The collapsed differ emits fields/constraints in a fixed order that may\n\t\t// differ from a replay of an interleaved history (e.g. a column added to an entity that\n\t\t// already has a relation), so a raw checksum (JSON.stringify) would report false mismatches\n\t\t// on schemas that are in fact deeply equal.\n\t\tconst differences = deepCompare(replaySchema, snapshotSchema, [], path => {\n\t\t\tif (path[0] === 'model' && path[1] === 'entities' && (path[3] === 'unique' || path[3] === 'index')) {\n\t\t\t\treturn (a, b) => compareArraysIgnoreOrder(a, b, path)\n\t\t\t}\n\t\t\treturn null\n\t\t})\n\t\tif (differences.length === 0) {\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tmessage: `Snapshot is up to date (covers ${snapshot.covers.length} migrations up to ${snapshot.version}).`,\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tok: false,\n\t\t\tmessage: 'Snapshot does not match a full replay of all migrations. Run \"migrations:snapshot\" to regenerate it.',\n\t\t}\n\t}\n\n\tprivate async findStaleness(snapshot: SnapshotFile): Promise<string | null> {\n\t\t// The collapsed snapshot is built differently per mode (state mode omits the non-model parts,\n\t\t// see create()), and on bootstrap the non-model overlay is driven by the *current* mode. A mode\n\t\t// switch since the snapshot was created (e.g. migrations:init-state) leaves the covers untouched\n\t\t// and would otherwise pass unnoticed, so treat it as stale and fall back to a full replay.\n\t\tif (snapshot.stateMode !== await this.schemaStateManager.isStateMode()) {\n\t\t\treturn `schema state mode changed since the snapshot was created`\n\t\t}\n\t\tconst files = await this.migrationsResolver.getMigrationFiles()\n\t\tconst byVersion = new Map(files.map(it => [it.version, it]))\n\t\tfor (const covered of snapshot.covers) {\n\t\t\tconst file = byVersion.get(covered.version)\n\t\t\tif (!file) {\n\t\t\t\treturn `covered migration ${covered.name} is missing`\n\t\t\t}\n\t\t\tconst content = await file.getContent()\n\t\t\tconst currentType = isSchemaMigration(content) ? 'schema' : 'content'\n\t\t\t// A covered migration that flipped type (e.g. a content migration manually rewritten into a\n\t\t\t// schema one) is not reflected in the collapsed modifications, so the snapshot no longer\n\t\t\t// equals a replay. Schema covers also verify the checksum; content covers carry none (their\n\t\t\t// data is never reproduced), so the type check is the only identity they get.\n\t\t\tif (currentType !== covered.type) {\n\t\t\t\treturn `covered migration ${covered.name} changed type`\n\t\t\t}\n\t\t\tif (covered.type === 'schema') {\n\t\t\t\tconst checksum = isSchemaMigration(content) ? calculateMigrationChecksum(content) : null\n\t\t\t\tif (checksum !== covered.checksum) {\n\t\t\t\t\treturn `covered migration ${covered.name} has changed`\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Detect a migration added within the covered range (version <= snapshot.version) that the\n\t\t// snapshot does not know about — e.g. a teammate's migration with an earlier timestamp merged\n\t\t// after the snapshot was generated. Without this, bootstrapping would record the covers up to\n\t\t// snapshot.version and the subsequent normal replay would fail with MUST_FOLLOW_LATEST on the\n\t\t// in-range migration, leaving the database half-bootstrapped. Treat it as stale and fall back.\n\t\tconst coveredVersions = new Set(snapshot.covers.map(it => it.version))\n\t\tfor (const file of files) {\n\t\t\tif (file.version <= snapshot.version && !coveredVersions.has(file.version)) {\n\t\t\t\treturn `migration ${file.name} is within the covered range but not part of the snapshot`\n\t\t\t}\n\t\t}\n\t\treturn null\n\t}\n}\n\nconst migrationContentToInput = (version: string, name: string, content: MigrationContent) => {\n\tif (isSchemaMigration(content)) {\n\t\treturn {\n\t\t\tversion,\n\t\t\tname,\n\t\t\ttype: 'SCHEMA',\n\t\t\tschemaMigration: {\n\t\t\t\tformatVersion: content.formatVersion,\n\t\t\t\tmodifications: content.modifications,\n\t\t\t\tskippedErrors: content.skippedErrors,\n\t\t\t},\n\t\t}\n\t}\n\t// Content migrations are only recorded as executed (no data is replayed), so the queries are irrelevant.\n\treturn { version, name, type: 'CONTENT', contentMigration: [] }\n}\n"],"names":["emptySchema","isSchemaMigration","calculateMigrationChecksum","VERSION_LATEST","deepCompare","compareArraysIgnoreOrder"],"mappings":";;;;AAkBO,MAAM,wBAAwB;AAAA,EACpC,YACkB,oBACA,sBACA,cACA,gBACA,oBACA,iBAChB;AANgB,SAAA,qBAAA;AACA,SAAA,uBAAA;AACA,SAAA,eAAA;AACA,SAAA,iBAAA;AACA,SAAA,qBAAA;AACA,SAAA,kBAAA;AAAA,EAElB;AAAA;AAAA,EAGA,MAAM,SAAgC;AACrC,UAAM,QAAQ,MAAM,KAAK,mBAAmB,kBAAA;AAC5C,QAAI,MAAM,WAAW,GAAG;AACvB,YAAM;AAAA,IACP;AACA,UAAM,YAAY,MAAM,KAAK,mBAAmB,YAAA;AAChD,UAAM,UAAU,MAAM,MAAM,SAAS,CAAC,EAAE;AAKxC,UAAM,kBAAkB,MAAM,KAAK,qBAAqB,oBAAoBA,YAAAA,aAAa,MAAM,IAAI;AACnG,UAAM,gBAAgB,KAAK,aAAa,YAAYA,YAAAA,aAAa,iBAAiB;AAAA,MACjF,qBAAqB;AAAA,IAAA,CACrB;AAED,UAAM,SAA6B,CAAA;AACnC,UAAM,oBAA8B,CAAA;AACpC,eAAW,QAAQ,OAAO;AACzB,YAAM,UAAU,MAAM,KAAK,WAAA;AAC3B,YAAM,SAASC,iBAAAA,kBAAkB,OAAO;AACxC,aAAO,KAAK;AAAA,QACX,SAAS,KAAK;AAAA,QACd,MAAM,KAAK;AAAA,QACX,MAAM,SAAS,WAAW;AAAA,QAC1B,UAAU,SAASC,4CAA2B,O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|
|
1
|
+
import { emptySchema, deepCompare, compareArraysIgnoreOrder } from "@contember/schema-utils";
|
|
2
|
+
import { isSchemaMigration, calculateMigrationChecksum, VERSION_LATEST } from "@contember/migrations-client";
|
|
3
|
+
class MigrationSnapshotFacade {
|
|
4
|
+
constructor(migrationsResolver, schemaVersionBuilder, schemaDiffer, schemaMigrator, schemaStateManager, snapshotManager) {
|
|
5
|
+
this.migrationsResolver = migrationsResolver;
|
|
6
|
+
this.schemaVersionBuilder = schemaVersionBuilder;
|
|
7
|
+
this.schemaDiffer = schemaDiffer;
|
|
8
|
+
this.schemaMigrator = schemaMigrator;
|
|
9
|
+
this.schemaStateManager = schemaStateManager;
|
|
10
|
+
this.snapshotManager = snapshotManager;
|
|
11
|
+
}
|
|
12
|
+
/** Collapses all migrations into a single schema snapshot and writes snapshot.json. */
|
|
13
|
+
async create() {
|
|
14
|
+
const files = await this.migrationsResolver.getMigrationFiles();
|
|
15
|
+
if (files.length === 0) {
|
|
16
|
+
throw "No migrations to snapshot";
|
|
17
|
+
}
|
|
18
|
+
const stateMode = await this.schemaStateManager.isStateMode();
|
|
19
|
+
const version = files[files.length - 1].version;
|
|
20
|
+
const collapsedSchema = await this.schemaVersionBuilder.buildSchemaAdvanced(emptySchema, () => true);
|
|
21
|
+
const modifications = this.schemaDiffer.diffSchemas(emptySchema, collapsedSchema, {
|
|
22
|
+
skipNonModelDiffers: stateMode
|
|
23
|
+
});
|
|
24
|
+
const covers = [];
|
|
25
|
+
const contentMigrations = [];
|
|
26
|
+
for (const file of files) {
|
|
27
|
+
const content = await file.getContent();
|
|
28
|
+
const schema = isSchemaMigration(content);
|
|
29
|
+
covers.push({
|
|
30
|
+
version: file.version,
|
|
31
|
+
name: file.name,
|
|
32
|
+
type: schema ? "schema" : "content",
|
|
33
|
+
checksum: schema ? calculateMigrationChecksum(content) : null
|
|
34
|
+
});
|
|
35
|
+
if (!schema) {
|
|
36
|
+
contentMigrations.push(file.version);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const snapshot = {
|
|
40
|
+
version,
|
|
41
|
+
stateMode,
|
|
42
|
+
snapshot: { formatVersion: VERSION_LATEST, modifications },
|
|
43
|
+
covers,
|
|
44
|
+
contentMigrations
|
|
45
|
+
};
|
|
46
|
+
await this.snapshotManager.write(snapshot);
|
|
47
|
+
return snapshot;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Returns the snapshot when it can safely bootstrap the current project, else null.
|
|
51
|
+
* The snapshot is only usable on an empty project (no executed migrations) and only when
|
|
52
|
+
* none of the covered migration files have changed. A present-but-stale snapshot is skipped
|
|
53
|
+
* with a warning, falling back to a full replay.
|
|
54
|
+
*/
|
|
55
|
+
async getUsableSnapshot(executedMigrations) {
|
|
56
|
+
if (!await this.snapshotManager.exists()) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
if (executedMigrations.length > 0) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const snapshot = await this.snapshotManager.read();
|
|
63
|
+
const stale = await this.findStaleness(snapshot);
|
|
64
|
+
if (stale) {
|
|
65
|
+
console.warn(`Ignoring snapshot: ${stale}. Run "migrations:snapshot" to regenerate it.`);
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return snapshot;
|
|
69
|
+
}
|
|
70
|
+
/** Maps a snapshot to the GraphQL SnapshotInput; covered migrations are sent as Migration inputs. */
|
|
71
|
+
async buildSnapshotInput(snapshot) {
|
|
72
|
+
const files = await this.migrationsResolver.getMigrationFiles();
|
|
73
|
+
const byVersion = new Map(files.map((it) => [it.version, it]));
|
|
74
|
+
const covers = [];
|
|
75
|
+
for (const covered of snapshot.covers) {
|
|
76
|
+
const file = byVersion.get(covered.version);
|
|
77
|
+
if (!file) {
|
|
78
|
+
throw `Snapshot covers missing migration ${covered.name}`;
|
|
79
|
+
}
|
|
80
|
+
covers.push(migrationContentToInput(covered.version, covered.name, await file.getContent()));
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
formatVersion: snapshot.snapshot.formatVersion,
|
|
84
|
+
modifications: snapshot.snapshot.modifications,
|
|
85
|
+
covers
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/** Offline check that the snapshot still equals a full replay of all migrations. */
|
|
89
|
+
async verify() {
|
|
90
|
+
if (!await this.snapshotManager.exists()) {
|
|
91
|
+
throw 'No snapshot found. Run "migrations:snapshot" first.';
|
|
92
|
+
}
|
|
93
|
+
const snapshot = await this.snapshotManager.read();
|
|
94
|
+
const stale = await this.findStaleness(snapshot);
|
|
95
|
+
if (stale) {
|
|
96
|
+
return { ok: false, message: `Snapshot is stale: ${stale}. Run "migrations:snapshot" to regenerate it.` };
|
|
97
|
+
}
|
|
98
|
+
const stateMode = await this.schemaStateManager.isStateMode();
|
|
99
|
+
const replaySchema = await this.schemaVersionBuilder.buildSchema();
|
|
100
|
+
let snapshotSchema = this.schemaMigrator.applyModifications(emptySchema, snapshot.snapshot.modifications, snapshot.snapshot.formatVersion);
|
|
101
|
+
if (stateMode) {
|
|
102
|
+
snapshotSchema = { ...snapshotSchema, ...await this.schemaStateManager.readState() };
|
|
103
|
+
}
|
|
104
|
+
const differences = deepCompare(replaySchema, snapshotSchema, [], (path) => {
|
|
105
|
+
if (path[0] === "model" && path[1] === "entities" && (path[3] === "unique" || path[3] === "index")) {
|
|
106
|
+
return (a, b) => compareArraysIgnoreOrder(a, b, path);
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
});
|
|
110
|
+
if (differences.length === 0) {
|
|
111
|
+
return {
|
|
112
|
+
ok: true,
|
|
113
|
+
message: `Snapshot is up to date (covers ${snapshot.covers.length} migrations up to ${snapshot.version}).`
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
ok: false,
|
|
118
|
+
message: 'Snapshot does not match a full replay of all migrations. Run "migrations:snapshot" to regenerate it.'
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
async findStaleness(snapshot) {
|
|
122
|
+
if (snapshot.stateMode !== await this.schemaStateManager.isStateMode()) {
|
|
123
|
+
return `schema state mode changed since the snapshot was created`;
|
|
124
|
+
}
|
|
125
|
+
const files = await this.migrationsResolver.getMigrationFiles();
|
|
126
|
+
const byVersion = new Map(files.map((it) => [it.version, it]));
|
|
127
|
+
for (const covered of snapshot.covers) {
|
|
128
|
+
const file = byVersion.get(covered.version);
|
|
129
|
+
if (!file) {
|
|
130
|
+
return `covered migration ${covered.name} is missing`;
|
|
131
|
+
}
|
|
132
|
+
const content = await file.getContent();
|
|
133
|
+
const currentType = isSchemaMigration(content) ? "schema" : "content";
|
|
134
|
+
if (currentType !== covered.type) {
|
|
135
|
+
return `covered migration ${covered.name} changed type`;
|
|
136
|
+
}
|
|
137
|
+
if (covered.type === "schema") {
|
|
138
|
+
const checksum = isSchemaMigration(content) ? calculateMigrationChecksum(content) : null;
|
|
139
|
+
if (checksum !== covered.checksum) {
|
|
140
|
+
return `covered migration ${covered.name} has changed`;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const coveredVersions = new Set(snapshot.covers.map((it) => it.version));
|
|
145
|
+
for (const file of files) {
|
|
146
|
+
if (file.version <= snapshot.version && !coveredVersions.has(file.version)) {
|
|
147
|
+
return `migration ${file.name} is within the covered range but not part of the snapshot`;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const migrationContentToInput = (version, name, content) => {
|
|
154
|
+
if (isSchemaMigration(content)) {
|
|
155
|
+
return {
|
|
156
|
+
version,
|
|
157
|
+
name,
|
|
158
|
+
type: "SCHEMA",
|
|
159
|
+
schemaMigration: {
|
|
160
|
+
formatVersion: content.formatVersion,
|
|
161
|
+
modifications: content.modifications,
|
|
162
|
+
skippedErrors: content.skippedErrors
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
return { version, name, type: "CONTENT", contentMigration: [] };
|
|
167
|
+
};
|
|
168
|
+
export {
|
|
169
|
+
MigrationSnapshotFacade
|
|
170
|
+
};
|
|
171
|
+
//# sourceMappingURL=MigrationSnapshotFacade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrationSnapshotFacade.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationSnapshotFacade.ts"],"sourcesContent":["import { compareArraysIgnoreOrder, deepCompare, emptySchema } from '@contember/schema-utils'\nimport {\n\tcalculateMigrationChecksum,\n\tCoveredMigration,\n\tExecutedMigrationInfo,\n\tisSchemaMigration,\n\tMigrationContent,\n\tMigrationsResolver,\n\tSchemaDiffer,\n\tSchemaMigrator,\n\tSchemaStateManager,\n\tSchemaVersionBuilder,\n\tSnapshotFile,\n\tSnapshotInput,\n\tSnapshotManager,\n\tVERSION_LATEST,\n} from '@contember/migrations-client'\n\nexport class MigrationSnapshotFacade {\n\tconstructor(\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t\tprivate readonly schemaDiffer: SchemaDiffer,\n\t\tprivate readonly schemaMigrator: SchemaMigrator,\n\t\tprivate readonly schemaStateManager: SchemaStateManager,\n\t\tprivate readonly snapshotManager: SnapshotManager,\n\t) {\n\t}\n\n\t/** Collapses all migrations into a single schema snapshot and writes snapshot.json. */\n\tasync create(): Promise<SnapshotFile> {\n\t\tconst files = await this.migrationsResolver.getMigrationFiles()\n\t\tif (files.length === 0) {\n\t\t\tthrow 'No migrations to snapshot'\n\t\t}\n\t\tconst stateMode = await this.schemaStateManager.isStateMode()\n\t\tconst version = files[files.length - 1].version\n\n\t\t// Replay all schema migrations into a single schema. In state mode the non-model parts\n\t\t// (acl/validation/actions/settings) live in state/ and are skipped here; otherwise they\n\t\t// are part of the migration history and must be included in the collapsed modifications.\n\t\tconst collapsedSchema = await this.schemaVersionBuilder.buildSchemaAdvanced(emptySchema, () => true)\n\t\tconst modifications = this.schemaDiffer.diffSchemas(emptySchema, collapsedSchema, {\n\t\t\tskipNonModelDiffers: stateMode,\n\t\t})\n\n\t\tconst covers: CoveredMigration[] = []\n\t\tconst contentMigrations: string[] = []\n\t\tfor (const file of files) {\n\t\t\tconst content = await file.getContent()\n\t\t\tconst schema = isSchemaMigration(content)\n\t\t\tcovers.push({\n\t\t\t\tversion: file.version,\n\t\t\t\tname: file.name,\n\t\t\t\ttype: schema ? 'schema' : 'content',\n\t\t\t\tchecksum: schema ? calculateMigrationChecksum(content) : null,\n\t\t\t})\n\t\t\tif (!schema) {\n\t\t\t\tcontentMigrations.push(file.version)\n\t\t\t}\n\t\t}\n\n\t\tconst snapshot: SnapshotFile = {\n\t\t\tversion,\n\t\t\tstateMode,\n\t\t\tsnapshot: { formatVersion: VERSION_LATEST, modifications },\n\t\t\tcovers,\n\t\t\tcontentMigrations,\n\t\t}\n\t\tawait this.snapshotManager.write(snapshot)\n\t\treturn snapshot\n\t}\n\n\t/**\n\t * Returns the snapshot when it can safely bootstrap the current project, else null.\n\t * The snapshot is only usable on an empty project (no executed migrations) and only when\n\t * none of the covered migration files have changed. A present-but-stale snapshot is skipped\n\t * with a warning, falling back to a full replay.\n\t */\n\tasync getUsableSnapshot(executedMigrations: ExecutedMigrationInfo[]): Promise<SnapshotFile | null> {\n\t\tif (!(await this.snapshotManager.exists())) {\n\t\t\treturn null\n\t\t}\n\t\tif (executedMigrations.length > 0) {\n\t\t\treturn null\n\t\t}\n\t\tconst snapshot = await this.snapshotManager.read()\n\t\tconst stale = await this.findStaleness(snapshot)\n\t\tif (stale) {\n\t\t\tconsole.warn(`Ignoring snapshot: ${stale}. Run \"migrations:snapshot\" to regenerate it.`)\n\t\t\treturn null\n\t\t}\n\t\treturn snapshot\n\t}\n\n\t/** Maps a snapshot to the GraphQL SnapshotInput; covered migrations are sent as Migration inputs. */\n\tasync buildSnapshotInput(snapshot: SnapshotFile): Promise<SnapshotInput> {\n\t\tconst files = await this.migrationsResolver.getMigrationFiles()\n\t\tconst byVersion = new Map(files.map(it => [it.version, it]))\n\t\tconst covers: unknown[] = []\n\t\tfor (const covered of snapshot.covers) {\n\t\t\tconst file = byVersion.get(covered.version)\n\t\t\tif (!file) {\n\t\t\t\tthrow `Snapshot covers missing migration ${covered.name}`\n\t\t\t}\n\t\t\tcovers.push(migrationContentToInput(covered.version, covered.name, await file.getContent()))\n\t\t}\n\t\treturn {\n\t\t\tformatVersion: snapshot.snapshot.formatVersion,\n\t\t\tmodifications: snapshot.snapshot.modifications,\n\t\t\tcovers,\n\t\t}\n\t}\n\n\t/** Offline check that the snapshot still equals a full replay of all migrations. */\n\tasync verify(): Promise<{ ok: boolean; message: string }> {\n\t\tif (!(await this.snapshotManager.exists())) {\n\t\t\tthrow 'No snapshot found. Run \"migrations:snapshot\" first.'\n\t\t}\n\t\tconst snapshot = await this.snapshotManager.read()\n\n\t\tconst stale = await this.findStaleness(snapshot)\n\t\tif (stale) {\n\t\t\treturn { ok: false, message: `Snapshot is stale: ${stale}. Run \"migrations:snapshot\" to regenerate it.` }\n\t\t}\n\n\t\tconst stateMode = await this.schemaStateManager.isStateMode()\n\t\tconst replaySchema = await this.schemaVersionBuilder.buildSchema()\n\t\tlet snapshotSchema = this.schemaMigrator.applyModifications(emptySchema, snapshot.snapshot.modifications, snapshot.snapshot.formatVersion)\n\t\tif (stateMode) {\n\t\t\tsnapshotSchema = { ...snapshotSchema, ...await this.schemaStateManager.readState() }\n\t\t}\n\n\t\t// Compare with the same order-insensitive equality that SchemaDiffer uses for its own\n\t\t// round-trip check. The collapsed differ emits fields/constraints in a fixed order that may\n\t\t// differ from a replay of an interleaved history (e.g. a column added to an entity that\n\t\t// already has a relation), so a raw checksum (JSON.stringify) would report false mismatches\n\t\t// on schemas that are in fact deeply equal.\n\t\tconst differences = deepCompare(replaySchema, snapshotSchema, [], path => {\n\t\t\tif (path[0] === 'model' && path[1] === 'entities' && (path[3] === 'unique' || path[3] === 'index')) {\n\t\t\t\treturn (a, b) => compareArraysIgnoreOrder(a, b, path)\n\t\t\t}\n\t\t\treturn null\n\t\t})\n\t\tif (differences.length === 0) {\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tmessage: `Snapshot is up to date (covers ${snapshot.covers.length} migrations up to ${snapshot.version}).`,\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tok: false,\n\t\t\tmessage: 'Snapshot does not match a full replay of all migrations. Run \"migrations:snapshot\" to regenerate it.',\n\t\t}\n\t}\n\n\tprivate async findStaleness(snapshot: SnapshotFile): Promise<string | null> {\n\t\t// The collapsed snapshot is built differently per mode (state mode omits the non-model parts,\n\t\t// see create()), and on bootstrap the non-model overlay is driven by the *current* mode. A mode\n\t\t// switch since the snapshot was created (e.g. migrations:init-state) leaves the covers untouched\n\t\t// and would otherwise pass unnoticed, so treat it as stale and fall back to a full replay.\n\t\tif (snapshot.stateMode !== await this.schemaStateManager.isStateMode()) {\n\t\t\treturn `schema state mode changed since the snapshot was created`\n\t\t}\n\t\tconst files = await this.migrationsResolver.getMigrationFiles()\n\t\tconst byVersion = new Map(files.map(it => [it.version, it]))\n\t\tfor (const covered of snapshot.covers) {\n\t\t\tconst file = byVersion.get(covered.version)\n\t\t\tif (!file) {\n\t\t\t\treturn `covered migration ${covered.name} is missing`\n\t\t\t}\n\t\t\tconst content = await file.getContent()\n\t\t\tconst currentType = isSchemaMigration(content) ? 'schema' : 'content'\n\t\t\t// A covered migration that flipped type (e.g. a content migration manually rewritten into a\n\t\t\t// schema one) is not reflected in the collapsed modifications, so the snapshot no longer\n\t\t\t// equals a replay. Schema covers also verify the checksum; content covers carry none (their\n\t\t\t// data is never reproduced), so the type check is the only identity they get.\n\t\t\tif (currentType !== covered.type) {\n\t\t\t\treturn `covered migration ${covered.name} changed type`\n\t\t\t}\n\t\t\tif (covered.type === 'schema') {\n\t\t\t\tconst checksum = isSchemaMigration(content) ? calculateMigrationChecksum(content) : null\n\t\t\t\tif (checksum !== covered.checksum) {\n\t\t\t\t\treturn `covered migration ${covered.name} has changed`\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Detect a migration added within the covered range (version <= snapshot.version) that the\n\t\t// snapshot does not know about — e.g. a teammate's migration with an earlier timestamp merged\n\t\t// after the snapshot was generated. Without this, bootstrapping would record the covers up to\n\t\t// snapshot.version and the subsequent normal replay would fail with MUST_FOLLOW_LATEST on the\n\t\t// in-range migration, leaving the database half-bootstrapped. Treat it as stale and fall back.\n\t\tconst coveredVersions = new Set(snapshot.covers.map(it => it.version))\n\t\tfor (const file of files) {\n\t\t\tif (file.version <= snapshot.version && !coveredVersions.has(file.version)) {\n\t\t\t\treturn `migration ${file.name} is within the covered range but not part of the snapshot`\n\t\t\t}\n\t\t}\n\t\treturn null\n\t}\n}\n\nconst migrationContentToInput = (version: string, name: string, content: MigrationContent) => {\n\tif (isSchemaMigration(content)) {\n\t\treturn {\n\t\t\tversion,\n\t\t\tname,\n\t\t\ttype: 'SCHEMA',\n\t\t\tschemaMigration: {\n\t\t\t\tformatVersion: content.formatVersion,\n\t\t\t\tmodifications: content.modifications,\n\t\t\t\tskippedErrors: content.skippedErrors,\n\t\t\t},\n\t\t}\n\t}\n\t// Content migrations are only recorded as executed (no data is replayed), so the queries are irrelevant.\n\treturn { version, name, type: 'CONTENT', contentMigration: [] }\n}\n"],"names":[],"mappings":";;AAkBO,MAAM,wBAAwB;AAAA,EACpC,YACkB,oBACA,sBACA,cACA,gBACA,oBACA,iBAChB;AANgB,SAAA,qBAAA;AACA,SAAA,uBAAA;AACA,SAAA,eAAA;AACA,SAAA,iBAAA;AACA,SAAA,qBAAA;AACA,SAAA,kBAAA;AAAA,EAElB;AAAA;AAAA,EAGA,MAAM,SAAgC;AACrC,UAAM,QAAQ,MAAM,KAAK,mBAAmB,kBAAA;AAC5C,QAAI,MAAM,WAAW,GAAG;AACvB,YAAM;AAAA,IACP;AACA,UAAM,YAAY,MAAM,KAAK,mBAAmB,YAAA;AAChD,UAAM,UAAU,MAAM,MAAM,SAAS,C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A,EACR;AACD;AAEA,MAAM,0BAA0B,CAAC,SAAiB,MAAc,YAA8B;AAC7F,MAAI,kBAAkB,OAAO,GAAG;AAC/B,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,MAAM;AAAA,MACN,iBAAiB;AAAA,QAChB,eAAe,QAAQ;AAAA,QACvB,eAAe,QAAQ;AAAA,QACvB,eAAe,QAAQ;AAAA,MAAA;AAAA,IACxB;AAAA,EAEF;AAEA,SAAO,EAAE,SAAS,MAAM,MAAM,WAAW,kBAAkB,GAAC;AAC7D;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationsStatusFacade.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsStatusFacade.ts"],"sourcesContent":["import { MigrationsResolver, MigrationsStatusResolver } from '@contember/migrations-client'\nimport { SystemClientProvider } from '../SystemClientProvider'\nimport { MigrationPrinter } from './MigrationPrinter'\n\nexport class MigrationsStatusFacade {\n\tconstructor(\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly migrationsStatusResolver: MigrationsStatusResolver,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t) {\n\t}\n\n\tpublic resolveMigrationsStatus = async ({ force, allowError }: { force?: boolean; allowError?: boolean }) => {\n\t\tconst executedMigrations = await this.systemClientProvider.get().listExecutedMigrations()\n\t\tconst localMigrations = await this.migrationsResolver.getMigrationFiles()\n\t\tconst status = await this.migrationsStatusResolver.getMigrationsStatus(executedMigrations, localMigrations, force)\n\t\tif (status.errorMigrations.length > 0 && !allowError) {\n\t\t\tconsole.error(this.migrationPrinter.printStatusTable(status.errorMigrations))\n\t\t\tif (!force) {\n\t\t\t\tthrow `Cannot execute migrations`\n\t\t\t}\n\t\t}\n\n\t\treturn status\n\t}\n}\n"],"names":[],"mappings":";;;;;AAIO,MAAM,uBAAuB;AAAA,EACnC,YACkB,sBACA,oBACA,0BACA,kBAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,qBAAA;AACA,SAAA,2BAAA;AACA,SAAA,mBAAA;AAIlB,kBAAA,MAAO,2BAA0B,OAAO,EAAE,OAAO,iBAA4D;AAC5G,YAAM,qBAAqB,MAAM,KAAK,qBAAqB,IAAA,EAAM,uBAAA;AACjE,YAAM,kBAAkB,MAAM,KAAK,mBAAmB,kBAAA;AACtD,YAAM,SAAS,MAAM,KAAK,yBAAyB,oBAAoB,oBAAoB,iBAAiB,KAAK;AACjH,UAAI,OAAO,gBAAgB,SAAS,KAAK,CAAC,YAAY;AACrD,gBAAQ,MAAM,KAAK,iBAAiB,iBAAiB,OAAO,eAAe,CAAC;AAC5E,YAAI,CAAC,OAAO;AACX,gBAAM;AAAA,QACP;AAAA,MACD;AAEA,aAAO;AAAA,IACR,CAAA;AAAA,EAdA;AAeD;;"}
|
|
1
|
+
{"version":3,"file":"MigrationsStatusFacade.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsStatusFacade.ts"],"sourcesContent":["import { MigrationsResolver, MigrationsStatusResolver } from '@contember/migrations-client'\nimport { SystemClientProvider } from '../SystemClientProvider.js'\nimport { MigrationPrinter } from './MigrationPrinter.js'\n\nexport class MigrationsStatusFacade {\n\tconstructor(\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly migrationsStatusResolver: MigrationsStatusResolver,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t) {\n\t}\n\n\tpublic resolveMigrationsStatus = async ({ force, allowError }: { force?: boolean; allowError?: boolean }) => {\n\t\tconst executedMigrations = await this.systemClientProvider.get().listExecutedMigrations()\n\t\tconst localMigrations = await this.migrationsResolver.getMigrationFiles()\n\t\tconst status = await this.migrationsStatusResolver.getMigrationsStatus(executedMigrations, localMigrations, force)\n\t\tif (status.errorMigrations.length > 0 && !allowError) {\n\t\t\tconsole.error(this.migrationPrinter.printStatusTable(status.errorMigrations))\n\t\t\tif (!force) {\n\t\t\t\tthrow `Cannot execute migrations`\n\t\t\t}\n\t\t}\n\n\t\treturn status\n\t}\n}\n"],"names":[],"mappings":";;;;;AAIO,MAAM,uBAAuB;AAAA,EACnC,YACkB,sBACA,oBACA,0BACA,kBAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,qBAAA;AACA,SAAA,2BAAA;AACA,SAAA,mBAAA;AAIlB,kBAAA,MAAO,2BAA0B,OAAO,EAAE,OAAO,iBAA4D;AAC5G,YAAM,qBAAqB,MAAM,KAAK,qBAAqB,IAAA,EAAM,uBAAA;AACjE,YAAM,kBAAkB,MAAM,KAAK,mBAAmB,kBAAA;AACtD,YAAM,SAAS,MAAM,KAAK,yBAAyB,oBAAoB,oBAAoB,iBAAiB,KAAK;AACjH,UAAI,OAAO,gBAAgB,SAAS,KAAK,CAAC,YAAY;AACrD,gBAAQ,MAAM,KAAK,iBAAiB,iBAAiB,OAAO,eAAe,CAAC;AAC5E,YAAI,CAAC,OAAO;AACX,gBAAM;AAAA,QACP;AAAA,MACD;AAEA,aAAO;AAAA,IACR,CAAA;AAAA,EAdA;AAeD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationsStatusFacade.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsStatusFacade.ts"],"sourcesContent":["import { MigrationsResolver, MigrationsStatusResolver } from '@contember/migrations-client'\nimport { SystemClientProvider } from '../SystemClientProvider'\nimport { MigrationPrinter } from './MigrationPrinter'\n\nexport class MigrationsStatusFacade {\n\tconstructor(\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly migrationsStatusResolver: MigrationsStatusResolver,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t) {\n\t}\n\n\tpublic resolveMigrationsStatus = async ({ force, allowError }: { force?: boolean; allowError?: boolean }) => {\n\t\tconst executedMigrations = await this.systemClientProvider.get().listExecutedMigrations()\n\t\tconst localMigrations = await this.migrationsResolver.getMigrationFiles()\n\t\tconst status = await this.migrationsStatusResolver.getMigrationsStatus(executedMigrations, localMigrations, force)\n\t\tif (status.errorMigrations.length > 0 && !allowError) {\n\t\t\tconsole.error(this.migrationPrinter.printStatusTable(status.errorMigrations))\n\t\t\tif (!force) {\n\t\t\t\tthrow `Cannot execute migrations`\n\t\t\t}\n\t\t}\n\n\t\treturn status\n\t}\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,uBAAuB;AAAA,EACnC,YACkB,sBACA,oBACA,0BACA,kBAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,qBAAA;AACA,SAAA,2BAAA;AACA,SAAA,mBAAA;AAIlB,kBAAA,MAAO,2BAA0B,OAAO,EAAE,OAAO,iBAA4D;AAC5G,YAAM,qBAAqB,MAAM,KAAK,qBAAqB,IAAA,EAAM,uBAAA;AACjE,YAAM,kBAAkB,MAAM,KAAK,mBAAmB,kBAAA;AACtD,YAAM,SAAS,MAAM,KAAK,yBAAyB,oBAAoB,oBAAoB,iBAAiB,KAAK;AACjH,UAAI,OAAO,gBAAgB,SAAS,KAAK,CAAC,YAAY;AACrD,gBAAQ,MAAM,KAAK,iBAAiB,iBAAiB,OAAO,eAAe,CAAC;AAC5E,YAAI,CAAC,OAAO;AACX,gBAAM;AAAA,QACP;AAAA,MACD;AAEA,aAAO;AAAA,IACR,CAAA;AAAA,EAdA;AAeD;"}
|
|
1
|
+
{"version":3,"file":"MigrationsStatusFacade.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsStatusFacade.ts"],"sourcesContent":["import { MigrationsResolver, MigrationsStatusResolver } from '@contember/migrations-client'\nimport { SystemClientProvider } from '../SystemClientProvider.js'\nimport { MigrationPrinter } from './MigrationPrinter.js'\n\nexport class MigrationsStatusFacade {\n\tconstructor(\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly migrationsStatusResolver: MigrationsStatusResolver,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t) {\n\t}\n\n\tpublic resolveMigrationsStatus = async ({ force, allowError }: { force?: boolean; allowError?: boolean }) => {\n\t\tconst executedMigrations = await this.systemClientProvider.get().listExecutedMigrations()\n\t\tconst localMigrations = await this.migrationsResolver.getMigrationFiles()\n\t\tconst status = await this.migrationsStatusResolver.getMigrationsStatus(executedMigrations, localMigrations, force)\n\t\tif (status.errorMigrations.length > 0 && !allowError) {\n\t\t\tconsole.error(this.migrationPrinter.printStatusTable(status.errorMigrations))\n\t\t\tif (!force) {\n\t\t\t\tthrow `Cannot execute migrations`\n\t\t\t}\n\t\t}\n\n\t\treturn status\n\t}\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,uBAAuB;AAAA,EACnC,YACkB,sBACA,oBACA,0BACA,kBAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,qBAAA;AACA,SAAA,2BAAA;AACA,SAAA,mBAAA;AAIlB,kBAAA,MAAO,2BAA0B,OAAO,EAAE,OAAO,iBAA4D;AAC5G,YAAM,qBAAqB,MAAM,KAAK,qBAAqB,IAAA,EAAM,uBAAA;AACjE,YAAM,kBAAkB,MAAM,KAAK,mBAAmB,kBAAA;AACtD,YAAM,SAAS,MAAM,KAAK,yBAAyB,oBAAoB,oBAAoB,iBAAiB,KAAK;AACjH,UAAI,OAAO,gBAAgB,SAAS,KAAK,CAAC,YAAY;AACrD,gBAAQ,MAAM,KAAK,iBAAiB,iBAAiB,OAAO,eAAe,CAAC;AAC5E,YAAI,CAAC,OAAO;AACX,gBAAM;AAAA,QACP;AAAA,MACD;AAEA,aAAO;AAAA,IACR,CAAA;AAAA,EAdA;AAeD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationsValidator.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsValidator.ts"],"sourcesContent":["import { Migration } from '@contember/migrations-client'\nimport { Schema } from '@contember/schema'\nimport { SchemaValidatorSkippedErrors } from '@contember/schema-utils'\nimport { MigrationDescriber, MigrationVersionHelper, SchemaMigrator, SchemaUpdateError } from '@contember/schema-migrations'\nimport { validateSchemaAndPrintErrors } from '../schema/SchemaValidationHelper'\n\nexport class MigrationsValidator {\n\tconstructor(\n\t\tprivate readonly describer: MigrationDescriber,\n\t\tprivate readonly migrator: SchemaMigrator,\n\t) {\n\t}\n\n\tvalidate = (initialSchema: Schema, migrations: Migration[]): boolean => {\n\t\tlet migratedSchema = initialSchema\n\t\tlet projectValid = true\n\t\tlet skippedErrors: SchemaValidatorSkippedErrors[] = []\n\t\tfor (const migration of migrations) {\n\t\t\ttry {\n\t\t\t\t// just a check that it does not fail\n\t\t\t\tthis.describer.describeModifications(migratedSchema, migration)\n\n\t\t\t\tmigratedSchema = this.migrator.applyModifications(migratedSchema, migration.modifications, migration.formatVersion)\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof SchemaUpdateError) {\n\t\t\t\t\tconsole.error(`Migration ${migration.name} has failed`)\n\t\t\t\t}\n\t\t\t\tthrow e\n\t\t\t}\n\t\t\tconst errorMessage = `Migration ${migration.name} produces invalid schema:`\n\t\t\tskippedErrors = [\n\t\t\t\t...skippedErrors.filter(it => it.skipUntil && MigrationVersionHelper.extractVersion(it.skipUntil) >= migration.version),\n\t\t\t\t...migration.skippedErrors ?? [],\n\t\t\t]\n\t\t\tprojectValid = validateSchemaAndPrintErrors(migratedSchema, errorMessage, skippedErrors)\n\t\t\t\t&& projectValid\n\t\t}\n\t\treturn projectValid\n\t}\n}\n"],"names":["SchemaUpdateError","MigrationVersionHelper","validateSchemaAndPrintErrors"],"mappings":";;;;;;;AAMO,MAAM,oBAAoB;AAAA,EAChC,YACkB,WACA,UAChB;AAFgB,SAAA,YAAA;AACA,SAAA,WAAA;AAIlB,kBAAA,MAAA,YAAW,CAAC,eAAuB,eAAqC;AACvE,UAAI,iBAAiB;AACrB,UAAI,eAAe;AACnB,UAAI,gBAAgD,CAAA;AACpD,iBAAW,aAAa,YAAY;AACnC,YAAI;AAEH,eAAK,UAAU,sBAAsB,gBAAgB,SAAS;AAE9D,2BAAiB,KAAK,SAAS,mBAAmB,gBAAgB,UAAU,eAAe,UAAU,aAAa;AAAA,QACnH,SAAS,GAAG;AACX,cAAI,aAAaA,iBAAAA,mBAAmB;AACnC,oBAAQ,MAAM,aAAa,UAAU,IAAI,aAAa;AAAA,UACvD;AACA,gBAAM;AAAA,QACP;AACA,cAAM,eAAe,aAAa,UAAU,IAAI;AAChD,wBAAgB;AAAA,UACf,GAAG,cAAc,OAAO,CAAA,OAAM,GAAG,aAAaC,wCAAuB,eAAe,GAAG,SAAS,KAAK,UAAU,OAAO;AAAA,UACtH,GAAG,UAAU,iBAAiB,CAAA;AAAA,QAAC;AAEhC,uBAAeC,uBAAAA,6BAA6B,gBAAgB,cAAc,aAAa,KACnF;AAAA,MACL;AACA,aAAO;AAAA,IACR,CAAA;AAAA,EA3BA;AA4BD;;"}
|
|
1
|
+
{"version":3,"file":"MigrationsValidator.cjs","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsValidator.ts"],"sourcesContent":["import { Migration } from '@contember/migrations-client'\nimport { Schema } from '@contember/schema'\nimport { SchemaValidatorSkippedErrors } from '@contember/schema-utils'\nimport { MigrationDescriber, MigrationVersionHelper, SchemaMigrator, SchemaUpdateError } from '@contember/schema-migrations'\nimport { validateSchemaAndPrintErrors } from '../schema/SchemaValidationHelper.js'\n\nexport class MigrationsValidator {\n\tconstructor(\n\t\tprivate readonly describer: MigrationDescriber,\n\t\tprivate readonly migrator: SchemaMigrator,\n\t) {\n\t}\n\n\tvalidate = (initialSchema: Schema, migrations: Migration[]): boolean => {\n\t\tlet migratedSchema = initialSchema\n\t\tlet projectValid = true\n\t\tlet skippedErrors: SchemaValidatorSkippedErrors[] = []\n\t\tfor (const migration of migrations) {\n\t\t\ttry {\n\t\t\t\t// just a check that it does not fail\n\t\t\t\tthis.describer.describeModifications(migratedSchema, migration)\n\n\t\t\t\tmigratedSchema = this.migrator.applyModifications(migratedSchema, migration.modifications, migration.formatVersion)\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof SchemaUpdateError) {\n\t\t\t\t\tconsole.error(`Migration ${migration.name} has failed`)\n\t\t\t\t}\n\t\t\t\tthrow e\n\t\t\t}\n\t\t\tconst errorMessage = `Migration ${migration.name} produces invalid schema:`\n\t\t\tskippedErrors = [\n\t\t\t\t...skippedErrors.filter(it => it.skipUntil && MigrationVersionHelper.extractVersion(it.skipUntil) >= migration.version),\n\t\t\t\t...migration.skippedErrors ?? [],\n\t\t\t]\n\t\t\tprojectValid = validateSchemaAndPrintErrors(migratedSchema, errorMessage, skippedErrors)\n\t\t\t\t&& projectValid\n\t\t}\n\t\treturn projectValid\n\t}\n}\n"],"names":["SchemaUpdateError","MigrationVersionHelper","validateSchemaAndPrintErrors"],"mappings":";;;;;;;AAMO,MAAM,oBAAoB;AAAA,EAChC,YACkB,WACA,UAChB;AAFgB,SAAA,YAAA;AACA,SAAA,WAAA;AAIlB,kBAAA,MAAA,YAAW,CAAC,eAAuB,eAAqC;AACvE,UAAI,iBAAiB;AACrB,UAAI,eAAe;AACnB,UAAI,gBAAgD,CAAA;AACpD,iBAAW,aAAa,YAAY;AACnC,YAAI;AAEH,eAAK,UAAU,sBAAsB,gBAAgB,SAAS;AAE9D,2BAAiB,KAAK,SAAS,mBAAmB,gBAAgB,UAAU,eAAe,UAAU,aAAa;AAAA,QACnH,SAAS,GAAG;AACX,cAAI,aAAaA,iBAAAA,mBAAmB;AACnC,oBAAQ,MAAM,aAAa,UAAU,IAAI,aAAa;AAAA,UACvD;AACA,gBAAM;AAAA,QACP;AACA,cAAM,eAAe,aAAa,UAAU,IAAI;AAChD,wBAAgB;AAAA,UACf,GAAG,cAAc,OAAO,CAAA,OAAM,GAAG,aAAaC,wCAAuB,eAAe,GAAG,SAAS,KAAK,UAAU,OAAO;AAAA,UACtH,GAAG,UAAU,iBAAiB,CAAA;AAAA,QAAC;AAEhC,uBAAeC,uBAAAA,6BAA6B,gBAAgB,cAAc,aAAa,KACnF;AAAA,MACL;AACA,aAAO;AAAA,IACR,CAAA;AAAA,EA3BA;AA4BD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationsValidator.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsValidator.ts"],"sourcesContent":["import { Migration } from '@contember/migrations-client'\nimport { Schema } from '@contember/schema'\nimport { SchemaValidatorSkippedErrors } from '@contember/schema-utils'\nimport { MigrationDescriber, MigrationVersionHelper, SchemaMigrator, SchemaUpdateError } from '@contember/schema-migrations'\nimport { validateSchemaAndPrintErrors } from '../schema/SchemaValidationHelper'\n\nexport class MigrationsValidator {\n\tconstructor(\n\t\tprivate readonly describer: MigrationDescriber,\n\t\tprivate readonly migrator: SchemaMigrator,\n\t) {\n\t}\n\n\tvalidate = (initialSchema: Schema, migrations: Migration[]): boolean => {\n\t\tlet migratedSchema = initialSchema\n\t\tlet projectValid = true\n\t\tlet skippedErrors: SchemaValidatorSkippedErrors[] = []\n\t\tfor (const migration of migrations) {\n\t\t\ttry {\n\t\t\t\t// just a check that it does not fail\n\t\t\t\tthis.describer.describeModifications(migratedSchema, migration)\n\n\t\t\t\tmigratedSchema = this.migrator.applyModifications(migratedSchema, migration.modifications, migration.formatVersion)\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof SchemaUpdateError) {\n\t\t\t\t\tconsole.error(`Migration ${migration.name} has failed`)\n\t\t\t\t}\n\t\t\t\tthrow e\n\t\t\t}\n\t\t\tconst errorMessage = `Migration ${migration.name} produces invalid schema:`\n\t\t\tskippedErrors = [\n\t\t\t\t...skippedErrors.filter(it => it.skipUntil && MigrationVersionHelper.extractVersion(it.skipUntil) >= migration.version),\n\t\t\t\t...migration.skippedErrors ?? [],\n\t\t\t]\n\t\t\tprojectValid = validateSchemaAndPrintErrors(migratedSchema, errorMessage, skippedErrors)\n\t\t\t\t&& projectValid\n\t\t}\n\t\treturn projectValid\n\t}\n}\n"],"names":[],"mappings":";;;;;AAMO,MAAM,oBAAoB;AAAA,EAChC,YACkB,WACA,UAChB;AAFgB,SAAA,YAAA;AACA,SAAA,WAAA;AAIlB,kBAAA,MAAA,YAAW,CAAC,eAAuB,eAAqC;AACvE,UAAI,iBAAiB;AACrB,UAAI,eAAe;AACnB,UAAI,gBAAgD,CAAA;AACpD,iBAAW,aAAa,YAAY;AACnC,YAAI;AAEH,eAAK,UAAU,sBAAsB,gBAAgB,SAAS;AAE9D,2BAAiB,KAAK,SAAS,mBAAmB,gBAAgB,UAAU,eAAe,UAAU,aAAa;AAAA,QACnH,SAAS,GAAG;AACX,cAAI,aAAa,mBAAmB;AACnC,oBAAQ,MAAM,aAAa,UAAU,IAAI,aAAa;AAAA,UACvD;AACA,gBAAM;AAAA,QACP;AACA,cAAM,eAAe,aAAa,UAAU,IAAI;AAChD,wBAAgB;AAAA,UACf,GAAG,cAAc,OAAO,CAAA,OAAM,GAAG,aAAa,uBAAuB,eAAe,GAAG,SAAS,KAAK,UAAU,OAAO;AAAA,UACtH,GAAG,UAAU,iBAAiB,CAAA;AAAA,QAAC;AAEhC,uBAAe,6BAA6B,gBAAgB,cAAc,aAAa,KACnF;AAAA,MACL;AACA,aAAO;AAAA,IACR,CAAA;AAAA,EA3BA;AA4BD;"}
|
|
1
|
+
{"version":3,"file":"MigrationsValidator.js","sources":["../../../../../../packages/cli/src/lib/migrations/MigrationsValidator.ts"],"sourcesContent":["import { Migration } from '@contember/migrations-client'\nimport { Schema } from '@contember/schema'\nimport { SchemaValidatorSkippedErrors } from '@contember/schema-utils'\nimport { MigrationDescriber, MigrationVersionHelper, SchemaMigrator, SchemaUpdateError } from '@contember/schema-migrations'\nimport { validateSchemaAndPrintErrors } from '../schema/SchemaValidationHelper.js'\n\nexport class MigrationsValidator {\n\tconstructor(\n\t\tprivate readonly describer: MigrationDescriber,\n\t\tprivate readonly migrator: SchemaMigrator,\n\t) {\n\t}\n\n\tvalidate = (initialSchema: Schema, migrations: Migration[]): boolean => {\n\t\tlet migratedSchema = initialSchema\n\t\tlet projectValid = true\n\t\tlet skippedErrors: SchemaValidatorSkippedErrors[] = []\n\t\tfor (const migration of migrations) {\n\t\t\ttry {\n\t\t\t\t// just a check that it does not fail\n\t\t\t\tthis.describer.describeModifications(migratedSchema, migration)\n\n\t\t\t\tmigratedSchema = this.migrator.applyModifications(migratedSchema, migration.modifications, migration.formatVersion)\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof SchemaUpdateError) {\n\t\t\t\t\tconsole.error(`Migration ${migration.name} has failed`)\n\t\t\t\t}\n\t\t\t\tthrow e\n\t\t\t}\n\t\t\tconst errorMessage = `Migration ${migration.name} produces invalid schema:`\n\t\t\tskippedErrors = [\n\t\t\t\t...skippedErrors.filter(it => it.skipUntil && MigrationVersionHelper.extractVersion(it.skipUntil) >= migration.version),\n\t\t\t\t...migration.skippedErrors ?? [],\n\t\t\t]\n\t\t\tprojectValid = validateSchemaAndPrintErrors(migratedSchema, errorMessage, skippedErrors)\n\t\t\t\t&& projectValid\n\t\t}\n\t\treturn projectValid\n\t}\n}\n"],"names":[],"mappings":";;;;;AAMO,MAAM,oBAAoB;AAAA,EAChC,YACkB,WACA,UAChB;AAFgB,SAAA,YAAA;AACA,SAAA,WAAA;AAIlB,kBAAA,MAAA,YAAW,CAAC,eAAuB,eAAqC;AACvE,UAAI,iBAAiB;AACrB,UAAI,eAAe;AACnB,UAAI,gBAAgD,CAAA;AACpD,iBAAW,aAAa,YAAY;AACnC,YAAI;AAEH,eAAK,UAAU,sBAAsB,gBAAgB,SAAS;AAE9D,2BAAiB,KAAK,SAAS,mBAAmB,gBAAgB,UAAU,eAAe,UAAU,aAAa;AAAA,QACnH,SAAS,GAAG;AACX,cAAI,aAAa,mBAAmB;AACnC,oBAAQ,MAAM,aAAa,UAAU,IAAI,aAAa;AAAA,UACvD;AACA,gBAAM;AAAA,QACP;AACA,cAAM,eAAe,aAAa,UAAU,IAAI;AAChD,wBAAgB;AAAA,UACf,GAAG,cAAc,OAAO,CAAA,OAAM,GAAG,aAAa,uBAAuB,eAAe,GAAG,SAAS,KAAK,UAAU,OAAO;AAAA,UACtH,GAAG,UAAU,iBAAiB,CAAA;AAAA,QAAC;AAEhC,uBAAe,6BAA6B,gBAAgB,cAAc,aAAa,KACnF;AAAA,MACL;AACA,aAAO;AAAA,IACR,CAAA;AAAA,EA3BA;AA4BD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteProjectProvider.cjs","sources":["../../../../../../packages/cli/src/lib/project/RemoteProjectProvider.ts"],"sourcesContent":["import { RemoteProject } from './RemoteProject'\n\nexport class RemoteProjectProvider {\n\tprivate _remoteProject: RemoteProject | undefined = undefined\n\n\tpublic setRemoteProject(remoteProject: RemoteProject) {\n\t\tthis._remoteProject = remoteProject\n\t}\n\n\tpublic get(): RemoteProject {\n\t\tif (!this._remoteProject) {\n\t\t\tthrow new Error('Remote project not set')\n\t\t}\n\t\treturn this._remoteProject\n\t}\n}\n"],"names":[],"mappings":";;;;;AAEO,MAAM,sBAAsB;AAAA,EAA5B,cAAA;AACN,kBAAA,MAAQ,gBAAA;AAAA,EAAA;AAAA,EAED,iBAAiB,eAA8B;AACrD,SAAK,iBAAiB;AAAA,EACvB;AAAA,EAEO,MAAqB;AAC3B,QAAI,CAAC,KAAK,gBAAgB;AACzB,YAAM,IAAI,MAAM,wBAAwB;AAAA,IACzC;AACA,WAAO,KAAK;AAAA,EACb;AACD;;"}
|
|
1
|
+
{"version":3,"file":"RemoteProjectProvider.cjs","sources":["../../../../../../packages/cli/src/lib/project/RemoteProjectProvider.ts"],"sourcesContent":["import { RemoteProject } from './RemoteProject.js'\n\nexport class RemoteProjectProvider {\n\tprivate _remoteProject: RemoteProject | undefined = undefined\n\n\tpublic setRemoteProject(remoteProject: RemoteProject) {\n\t\tthis._remoteProject = remoteProject\n\t}\n\n\tpublic get(): RemoteProject {\n\t\tif (!this._remoteProject) {\n\t\t\tthrow new Error('Remote project not set')\n\t\t}\n\t\treturn this._remoteProject\n\t}\n}\n"],"names":[],"mappings":";;;;;AAEO,MAAM,sBAAsB;AAAA,EAA5B,cAAA;AACN,kBAAA,MAAQ,gBAAA;AAAA,EAAA;AAAA,EAED,iBAAiB,eAA8B;AACrD,SAAK,iBAAiB;AAAA,EACvB;AAAA,EAEO,MAAqB;AAC3B,QAAI,CAAC,KAAK,gBAAgB;AACzB,YAAM,IAAI,MAAM,wBAAwB;AAAA,IACzC;AACA,WAAO,KAAK;AAAA,EACb;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteProjectProvider.js","sources":["../../../../../../packages/cli/src/lib/project/RemoteProjectProvider.ts"],"sourcesContent":["import { RemoteProject } from './RemoteProject'\n\nexport class RemoteProjectProvider {\n\tprivate _remoteProject: RemoteProject | undefined = undefined\n\n\tpublic setRemoteProject(remoteProject: RemoteProject) {\n\t\tthis._remoteProject = remoteProject\n\t}\n\n\tpublic get(): RemoteProject {\n\t\tif (!this._remoteProject) {\n\t\t\tthrow new Error('Remote project not set')\n\t\t}\n\t\treturn this._remoteProject\n\t}\n}\n"],"names":[],"mappings":";;;AAEO,MAAM,sBAAsB;AAAA,EAA5B,cAAA;AACN,kBAAA,MAAQ,gBAAA;AAAA,EAAA;AAAA,EAED,iBAAiB,eAA8B;AACrD,SAAK,iBAAiB;AAAA,EACvB;AAAA,EAEO,MAAqB;AAC3B,QAAI,CAAC,KAAK,gBAAgB;AACzB,YAAM,IAAI,MAAM,wBAAwB;AAAA,IACzC;AACA,WAAO,KAAK;AAAA,EACb;AACD;"}
|
|
1
|
+
{"version":3,"file":"RemoteProjectProvider.js","sources":["../../../../../../packages/cli/src/lib/project/RemoteProjectProvider.ts"],"sourcesContent":["import { RemoteProject } from './RemoteProject.js'\n\nexport class RemoteProjectProvider {\n\tprivate _remoteProject: RemoteProject | undefined = undefined\n\n\tpublic setRemoteProject(remoteProject: RemoteProject) {\n\t\tthis._remoteProject = remoteProject\n\t}\n\n\tpublic get(): RemoteProject {\n\t\tif (!this._remoteProject) {\n\t\t\tthrow new Error('Remote project not set')\n\t\t}\n\t\treturn this._remoteProject\n\t}\n}\n"],"names":[],"mappings":";;;AAEO,MAAM,sBAAsB;AAAA,EAA5B,cAAA;AACN,kBAAA,MAAQ,gBAAA;AAAA,EAAA;AAAA,EAED,iBAAiB,eAA8B;AACrD,SAAK,iBAAiB;AAAA,EACvB;AAAA,EAEO,MAAqB;AAC3B,QAAI,CAAC,KAAK,gBAAgB;AACzB,YAAM,IAAI,MAAM,wBAAwB;AAAA,IACzC;AACA,WAAO,KAAK;AAAA,EACb;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteProjectResolver.cjs","sources":["../../../../../../packages/cli/src/lib/project/RemoteProjectResolver.ts"],"sourcesContent":["import { parseDsn } from '../dsn'\nimport { RemoteProject } from './RemoteProject'\nimport { CliEnv } from '../env'\n\nexport class RemoteProjectResolver {\n\tconstructor(\n\t\tprivate readonly cliEnv: CliEnv,\n\t) {\n\t}\n\n\tresolve(identifier?: string, adminEndpoint?: string): RemoteProject | undefined {\n\t\tlet endpoint: string | undefined\n\t\tlet token: string | undefined\n\t\tlet project: string | undefined\n\t\tif (identifier?.includes('://')) {\n\t\t\t;({ endpoint, project, token } = parseDsn(identifier))\n\t\t} else if (this.cliEnv.dsn) {\n\t\t\t;({ endpoint, project, token } = parseDsn(this.cliEnv.dsn))\n\t\t} else {\n\t\t\tendpoint = this.cliEnv.apiUrl\n\t\t\ttoken = this.cliEnv.apiToken\n\t\t\tproject = !identifier || identifier === '.' ? this.cliEnv.projectName : identifier\n\t\t}\n\t\tif (!project || !endpoint || !token) {\n\t\t\treturn undefined\n\t\t}\n\t\tif (endpoint.endsWith('/')) {\n\t\t\tendpoint = endpoint.slice(0, -1)\n\t\t}\n\n\t\tif (!adminEndpoint && endpoint.endsWith('.contember.cloud') && !endpoint.includes('://api-')) {\n\t\t\tadminEndpoint = endpoint\n\t\t\tendpoint += '/_api'\n\t\t}\n\n\t\treturn new RemoteProject(project, endpoint, token, adminEndpoint)\n\t}\n}\n"],"names":["parseDsn","RemoteProject"],"mappings":";;;;AAIO,MAAM,sBAAsB;AAAA,EAClC,YACkB,QAChB;AADgB,SAAA,SAAA;AAAA,EAElB;AAAA,EAEA,QAAQ,YAAqB,eAAmD;AAC/E,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI,YAAY,SAAS,KAAK,GAAG;AAC/B,OAAC,EAAE,UAAU,SAAS,MAAA,IAAUA,IAAAA,SAAS,UAAU;AAAA,IACrD,WAAW,KAAK,OAAO,KAAK;AAC1B,OAAC,EAAE,UAAU,SAAS,MAAA,IAAUA,IAAAA,SAAS,KAAK,OAAO,GAAG;AAAA,IAC1D,OAAO;AACN,iBAAW,KAAK,OAAO;AACvB,cAAQ,KAAK,OAAO;AACpB,gBAAU,CAAC,cAAc,eAAe,MAAM,KAAK,OAAO,cAAc;AAAA,IACzE;AACA,QAAI,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO;AACpC,aAAO;AAAA,IACR;AACA,QAAI,SAAS,SAAS,GAAG,GAAG;AAC3B,iBAAW,SAAS,MAAM,GAAG,EAAE;AAAA,IAChC;AAEA,QAAI,CAAC,iBAAiB,SAAS,SAAS,kBAAkB,KAAK,CAAC,SAAS,SAAS,SAAS,GAAG;AAC7F,sBAAgB;AAChB,kBAAY;AAAA,IACb;AAEA,WAAO,IAAIC,cAAAA,cAAc,SAAS,UAAU,OAAO,aAAa;AAAA,EACjE;AACD;;"}
|
|
1
|
+
{"version":3,"file":"RemoteProjectResolver.cjs","sources":["../../../../../../packages/cli/src/lib/project/RemoteProjectResolver.ts"],"sourcesContent":["import { parseDsn } from '../dsn.js'\nimport { RemoteProject } from './RemoteProject.js'\nimport { CliEnv } from '../env.js'\n\nexport class RemoteProjectResolver {\n\tconstructor(\n\t\tprivate readonly cliEnv: CliEnv,\n\t) {\n\t}\n\n\tresolve(identifier?: string, adminEndpoint?: string): RemoteProject | undefined {\n\t\tlet endpoint: string | undefined\n\t\tlet token: string | undefined\n\t\tlet project: string | undefined\n\t\tif (identifier?.includes('://')) {\n\t\t\t;({ endpoint, project, token } = parseDsn(identifier))\n\t\t} else if (this.cliEnv.dsn) {\n\t\t\t;({ endpoint, project, token } = parseDsn(this.cliEnv.dsn))\n\t\t} else {\n\t\t\tendpoint = this.cliEnv.apiUrl\n\t\t\ttoken = this.cliEnv.apiToken\n\t\t\tproject = !identifier || identifier === '.' ? this.cliEnv.projectName : identifier\n\t\t}\n\t\tif (!project || !endpoint || !token) {\n\t\t\treturn undefined\n\t\t}\n\t\tif (endpoint.endsWith('/')) {\n\t\t\tendpoint = endpoint.slice(0, -1)\n\t\t}\n\n\t\tif (!adminEndpoint && endpoint.endsWith('.contember.cloud') && !endpoint.includes('://api-')) {\n\t\t\tadminEndpoint = endpoint\n\t\t\tendpoint += '/_api'\n\t\t}\n\n\t\treturn new RemoteProject(project, endpoint, token, adminEndpoint)\n\t}\n}\n"],"names":["parseDsn","RemoteProject"],"mappings":";;;;AAIO,MAAM,sBAAsB;AAAA,EAClC,YACkB,QAChB;AADgB,SAAA,SAAA;AAAA,EAElB;AAAA,EAEA,QAAQ,YAAqB,eAAmD;AAC/E,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI,YAAY,SAAS,KAAK,GAAG;AAC/B,OAAC,EAAE,UAAU,SAAS,MAAA,IAAUA,IAAAA,SAAS,UAAU;AAAA,IACrD,WAAW,KAAK,OAAO,KAAK;AAC1B,OAAC,EAAE,UAAU,SAAS,MAAA,IAAUA,IAAAA,SAAS,KAAK,OAAO,GAAG;AAAA,IAC1D,OAAO;AACN,iBAAW,KAAK,OAAO;AACvB,cAAQ,KAAK,OAAO;AACpB,gBAAU,CAAC,cAAc,eAAe,MAAM,KAAK,OAAO,cAAc;AAAA,IACzE;AACA,QAAI,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO;AACpC,aAAO;AAAA,IACR;AACA,QAAI,SAAS,SAAS,GAAG,GAAG;AAC3B,iBAAW,SAAS,MAAM,GAAG,EAAE;AAAA,IAChC;AAEA,QAAI,CAAC,iBAAiB,SAAS,SAAS,kBAAkB,KAAK,CAAC,SAAS,SAAS,SAAS,GAAG;AAC7F,sBAAgB;AAChB,kBAAY;AAAA,IACb;AAEA,WAAO,IAAIC,cAAAA,cAAc,SAAS,UAAU,OAAO,aAAa;AAAA,EACjE;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteProjectResolver.js","sources":["../../../../../../packages/cli/src/lib/project/RemoteProjectResolver.ts"],"sourcesContent":["import { parseDsn } from '../dsn'\nimport { RemoteProject } from './RemoteProject'\nimport { CliEnv } from '../env'\n\nexport class RemoteProjectResolver {\n\tconstructor(\n\t\tprivate readonly cliEnv: CliEnv,\n\t) {\n\t}\n\n\tresolve(identifier?: string, adminEndpoint?: string): RemoteProject | undefined {\n\t\tlet endpoint: string | undefined\n\t\tlet token: string | undefined\n\t\tlet project: string | undefined\n\t\tif (identifier?.includes('://')) {\n\t\t\t;({ endpoint, project, token } = parseDsn(identifier))\n\t\t} else if (this.cliEnv.dsn) {\n\t\t\t;({ endpoint, project, token } = parseDsn(this.cliEnv.dsn))\n\t\t} else {\n\t\t\tendpoint = this.cliEnv.apiUrl\n\t\t\ttoken = this.cliEnv.apiToken\n\t\t\tproject = !identifier || identifier === '.' ? this.cliEnv.projectName : identifier\n\t\t}\n\t\tif (!project || !endpoint || !token) {\n\t\t\treturn undefined\n\t\t}\n\t\tif (endpoint.endsWith('/')) {\n\t\t\tendpoint = endpoint.slice(0, -1)\n\t\t}\n\n\t\tif (!adminEndpoint && endpoint.endsWith('.contember.cloud') && !endpoint.includes('://api-')) {\n\t\t\tadminEndpoint = endpoint\n\t\t\tendpoint += '/_api'\n\t\t}\n\n\t\treturn new RemoteProject(project, endpoint, token, adminEndpoint)\n\t}\n}\n"],"names":[],"mappings":";;AAIO,MAAM,sBAAsB;AAAA,EAClC,YACkB,QAChB;AADgB,SAAA,SAAA;AAAA,EAElB;AAAA,EAEA,QAAQ,YAAqB,eAAmD;AAC/E,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI,YAAY,SAAS,KAAK,GAAG;AAC/B,OAAC,EAAE,UAAU,SAAS,MAAA,IAAU,SAAS,UAAU;AAAA,IACrD,WAAW,KAAK,OAAO,KAAK;AAC1B,OAAC,EAAE,UAAU,SAAS,MAAA,IAAU,SAAS,KAAK,OAAO,GAAG;AAAA,IAC1D,OAAO;AACN,iBAAW,KAAK,OAAO;AACvB,cAAQ,KAAK,OAAO;AACpB,gBAAU,CAAC,cAAc,eAAe,MAAM,KAAK,OAAO,cAAc;AAAA,IACzE;AACA,QAAI,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO;AACpC,aAAO;AAAA,IACR;AACA,QAAI,SAAS,SAAS,GAAG,GAAG;AAC3B,iBAAW,SAAS,MAAM,GAAG,EAAE;AAAA,IAChC;AAEA,QAAI,CAAC,iBAAiB,SAAS,SAAS,kBAAkB,KAAK,CAAC,SAAS,SAAS,SAAS,GAAG;AAC7F,sBAAgB;AAChB,kBAAY;AAAA,IACb;AAEA,WAAO,IAAI,cAAc,SAAS,UAAU,OAAO,aAAa;AAAA,EACjE;AACD;"}
|
|
1
|
+
{"version":3,"file":"RemoteProjectResolver.js","sources":["../../../../../../packages/cli/src/lib/project/RemoteProjectResolver.ts"],"sourcesContent":["import { parseDsn } from '../dsn.js'\nimport { RemoteProject } from './RemoteProject.js'\nimport { CliEnv } from '../env.js'\n\nexport class RemoteProjectResolver {\n\tconstructor(\n\t\tprivate readonly cliEnv: CliEnv,\n\t) {\n\t}\n\n\tresolve(identifier?: string, adminEndpoint?: string): RemoteProject | undefined {\n\t\tlet endpoint: string | undefined\n\t\tlet token: string | undefined\n\t\tlet project: string | undefined\n\t\tif (identifier?.includes('://')) {\n\t\t\t;({ endpoint, project, token } = parseDsn(identifier))\n\t\t} else if (this.cliEnv.dsn) {\n\t\t\t;({ endpoint, project, token } = parseDsn(this.cliEnv.dsn))\n\t\t} else {\n\t\t\tendpoint = this.cliEnv.apiUrl\n\t\t\ttoken = this.cliEnv.apiToken\n\t\t\tproject = !identifier || identifier === '.' ? this.cliEnv.projectName : identifier\n\t\t}\n\t\tif (!project || !endpoint || !token) {\n\t\t\treturn undefined\n\t\t}\n\t\tif (endpoint.endsWith('/')) {\n\t\t\tendpoint = endpoint.slice(0, -1)\n\t\t}\n\n\t\tif (!adminEndpoint && endpoint.endsWith('.contember.cloud') && !endpoint.includes('://api-')) {\n\t\t\tadminEndpoint = endpoint\n\t\t\tendpoint += '/_api'\n\t\t}\n\n\t\treturn new RemoteProject(project, endpoint, token, adminEndpoint)\n\t}\n}\n"],"names":[],"mappings":";;AAIO,MAAM,sBAAsB;AAAA,EAClC,YACkB,QAChB;AADgB,SAAA,SAAA;AAAA,EAElB;AAAA,EAEA,QAAQ,YAAqB,eAAmD;AAC/E,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI,YAAY,SAAS,KAAK,GAAG;AAC/B,OAAC,EAAE,UAAU,SAAS,MAAA,IAAU,SAAS,UAAU;AAAA,IACrD,WAAW,KAAK,OAAO,KAAK;AAC1B,OAAC,EAAE,UAAU,SAAS,MAAA,IAAU,SAAS,KAAK,OAAO,GAAG;AAAA,IAC1D,OAAO;AACN,iBAAW,KAAK,OAAO;AACvB,cAAQ,KAAK,OAAO;AACpB,gBAAU,CAAC,cAAc,eAAe,MAAM,KAAK,OAAO,cAAc;AAAA,IACzE;AACA,QAAI,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO;AACpC,aAAO;AAAA,IACR;AACA,QAAI,SAAS,SAAS,GAAG,GAAG;AAC3B,iBAAW,SAAS,MAAM,GAAG,EAAE;AAAA,IAChC;AAEA,QAAI,CAAC,iBAAiB,SAAS,SAAS,kBAAkB,KAAK,CAAC,SAAS,SAAS,SAAS,GAAG;AAC7F,sBAAgB;AAChB,kBAAY;AAAA,IACb;AAEA,WAAO,IAAI,cAAc,SAAS,UAAU,OAAO,aAAa;AAAA,EACjE;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityInfo.cjs","sources":["../../../../../../../../packages/cli/src/lib/project/docs/components/EntityInfo.tsx"],"sourcesContent":["import { Model, Schema } from '@contember/schema'\nimport { ReferencesMap } from '../../../schema/collectReferences'\nimport { formatEntityAnchor, formatFieldAnchor } from './utils'\nimport { SinglePermission } from './SinglePermission'\nimport { FieldType } from './FieldType'\nimport { FieldPermissions } from './FieldPermissions'\nimport { OnDelete } from './OnDelete'\nimport { Fragment, h } from 'preact'\n\ninterface EntityInfoProps {\n\tentity: Model.Entity\n\tschema: Schema\n\treferences: ReferencesMap\n}\n\nexport const EntityInfo = ({ entity, schema, references }: EntityInfoProps) => (\n\t<div class={'m-4 border border-gray-400 rounded-lg group'} id={formatEntityAnchor(entity.name)}>\n\t\t<div class={'font-bold text-gray-900 py-2 px-4 border-b border-gray-400 group-target:bg-yellow-100 rounded-t-lg'}>\n\t\t\t{entity.name}\n\t\t</div>\n\t\t<div class={'px-2 py-2 flex flex-wrap '}>\n\t\t\t<div>\n\t\t\t\t<table>\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th class={'text-left px-2 text-gray-500 font-normal w-[180px] max-w-[180px]'}>Name</th>\n\t\t\t\t\t\t\t<th class={'text-left px-2 text-gray-500 font-normal w-[340px] max-w-[340px]'}>Type</th>\n\t\t\t\t\t\t\t{Object.keys(schema.acl.roles).map(role => (\n\t\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\t\tkey={role}\n\t\t\t\t\t\t\t\t\tclass={'text-left px-2 text-gray-500 font-normal w-[120px] max-w-[120px] text-xs truncate text-sm'}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{role}\n\t\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t{Object.entries(schema.acl.roles).map(([name, role]) => (\n\t\t\t\t\t\t\t<td class={'px-2'} key={name}>\n\t\t\t\t\t\t\t\t<SinglePermission value={'D'} predicate={role.entities[entity.name]?.operations.delete} />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</tr>\n\t\t\t\t\t{Object.values(entity.fields).map(field => (\n\t\t\t\t\t\t<tr class={'even:bg-gray-100 target:bg-yellow-100'} id={formatFieldAnchor(entity.name, field.name)} key={field.name}>\n\t\t\t\t\t\t\t<td class={'px-2 font-mono truncate w-[180px] max-w-[180px]'} title={field.name}>\n\t\t\t\t\t\t\t\t{field.name}\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class={'text-gray-800 px-2 font-mono w-[420px] max-w-[420px]'}>\n\t\t\t\t\t\t\t\t<FieldType field={field} />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t{Object.entries(schema.acl.roles).map(([name, role]) => (\n\t\t\t\t\t\t\t\t<td class={'px-2'} key={name}>\n\t\t\t\t\t\t\t\t\t<FieldPermissions field={field.name} entityPermissions={role.entities[entity.name]} />\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t))}\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t\t<div class={'px-2 py-2 w-1/2'}>\n\t\t\t\t<h3 class={'text-lg text-gray-600'}>On delete behaviour:</h3>\n\t\t\t\t<p class={'text-gray-500 text-sm'}>\n\t\t\t\t\t(What happens when you attempt to delete entity {entity.name})\n\t\t\t\t</p>\n\t\t\t\t<div class={'mt-2 text-sm '}>\n\t\t\t\t\t<OnDelete references={references} entity={entity} />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{false && (\n\t\t\t\t<div class={'px-2 py-2 w-1/2'}>\n\t\t\t\t\t<h3 class={'text-lg text-gray-600'}>ACL predicates:</h3>\n\t\t\t\t\t<div class={'mt-2 text-sm '}>\n\t\t\t\t\t\t{Object.entries(schema.acl.roles).map(([roleName, role]) =>\n\t\t\t\t\t\t\tObject.entries(role.entities[entity.name]?.predicates ?? {}).map(([predicateName, predicate]) => (\n\t\t\t\t\t\t\t\t<Fragment key={roleName + '__' + predicateName}>\n\t\t\t\t\t\t\t\t\t<h4>{roleName}: {predicateName}</h4>\n\t\t\t\t\t\t\t\t\t<code>{JSON.stringify(predicate)}</code>\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t))\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t</div>\n)\n"],"names":["jsxs","formatEntityAnchor","jsx","SinglePermission","formatFieldAnchor","FieldType","FieldPermissions","OnDelete"],"mappings":";;;;;;;;;AAeO,MAAM,aAAa,CAAC,EAAE,QAAQ,QAAQ,WAAA,MAC5CA,2BAAAA,KAAC,OAAA,EAAI,OAAO,+CAA+C,IAAIC,MAAAA,mBAAmB,OAAO,IAAI,GAC5F,UAAA;AAAA,EAAAC,2BAAAA,IAAC,OAAA,EAAI,OAAO,sGACV,UAAA,OAAO,MACT;AAAA,EACAF,2BAAAA,KAAC,OAAA,EAAI,OAAO,6BACX,UAAA;AAAA,IAAAE,2BAAAA,IAAC,OAAA,EACA,0CAAC,SAAA,EACA,UAAA;AAAA,MAAAA,2BAAAA,IAAC,SAAA,EACA,0CAAC,MAAA,EACA,UAAA;AAAA,QAAAA,2BAAAA,IAAC,MAAA,EAAG,OAAO,oEAAoE,UAAA,QAAI;AAAA,QACnFA,2BAAAA,IAAC,MAAA,EAAG,OAAO,oEAAoE,UAAA,QAAI;AAAA,QAClF,OAAO,KAAK,OAAO,IAAI,KAAK,EAAE,IAAI,CAAA,SAClCA,2BAAAA;AAAAA,UAAC;AAAA,UAAA;A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wBAAoB;AAAA,MACxDF,2BAAAA,KAAC,KAAA,EAAE,OAAO,yBAAyB,UAAA;AAAA,QAAA;AAAA,QACe,OAAO;AAAA,QAAK;AAAA,MAAA,GAC9D;AAAA,MACAE,2BAAAA,IAAC,SAAI,OAAO,iBACX,yCAACK,mBAAA,EAAS,YAAwB,QAAgB,EAAA,CACnD;AAAA,IAAA,GACD;AAAA,IACC;AAAA,EAAA,EAAA,CAeF;AAAA,EAAA,CACD;;"}
|
|
1
|
+
{"version":3,"file":"EntityInfo.cjs","sources":["../../../../../../../../packages/cli/src/lib/project/docs/components/EntityInfo.tsx"],"sourcesContent":["import { Model, Schema } from '@contember/schema'\nimport { ReferencesMap } from '../../../schema/collectReferences.js'\nimport { formatEntityAnchor, formatFieldAnchor } from './utils.js'\nimport { SinglePermission } from './SinglePermission.js'\nimport { FieldType } from './FieldType.js'\nimport { FieldPermissions } from './FieldPermissions.js'\nimport { OnDelete } from './OnDelete.js'\nimport { Fragment, h } from 'preact'\n\ninterface EntityInfoProps {\n\tentity: Model.Entity\n\tschema: Schema\n\treferences: ReferencesMap\n}\n\nexport const EntityInfo = ({ entity, schema, references }: EntityInfoProps) => (\n\t<div class={'m-4 border border-gray-400 rounded-lg group'} id={formatEntityAnchor(entity.name)}>\n\t\t<div class={'font-bold text-gray-900 py-2 px-4 border-b border-gray-400 group-target:bg-yellow-100 rounded-t-lg'}>\n\t\t\t{entity.name}\n\t\t</div>\n\t\t<div class={'px-2 py-2 flex flex-wrap '}>\n\t\t\t<div>\n\t\t\t\t<table>\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th class={'text-left px-2 text-gray-500 font-normal w-[180px] max-w-[180px]'}>Name</th>\n\t\t\t\t\t\t\t<th class={'text-left px-2 text-gray-500 font-normal w-[340px] max-w-[340px]'}>Type</th>\n\t\t\t\t\t\t\t{Object.keys(schema.acl.roles).map(role => (\n\t\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\t\tkey={role}\n\t\t\t\t\t\t\t\t\tclass={'text-left px-2 text-gray-500 font-normal w-[120px] max-w-[120px] text-xs truncate text-sm'}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{role}\n\t\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t{Object.entries(schema.acl.roles).map(([name, role]) => (\n\t\t\t\t\t\t\t<td class={'px-2'} key={name}>\n\t\t\t\t\t\t\t\t<SinglePermission value={'D'} predicate={role.entities[entity.name]?.operations.delete} />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</tr>\n\t\t\t\t\t{Object.values(entity.fields).map(field => (\n\t\t\t\t\t\t<tr class={'even:bg-gray-100 target:bg-yellow-100'} id={formatFieldAnchor(entity.name, field.name)} key={field.name}>\n\t\t\t\t\t\t\t<td class={'px-2 font-mono truncate w-[180px] max-w-[180px]'} title={field.name}>\n\t\t\t\t\t\t\t\t{field.name}\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class={'text-gray-800 px-2 font-mono w-[420px] max-w-[420px]'}>\n\t\t\t\t\t\t\t\t<FieldType field={field} />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t{Object.entries(schema.acl.roles).map(([name, role]) => (\n\t\t\t\t\t\t\t\t<td class={'px-2'} key={name}>\n\t\t\t\t\t\t\t\t\t<FieldPermissions field={field.name} entityPermissions={role.entities[entity.name]} />\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t))}\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t\t<div class={'px-2 py-2 w-1/2'}>\n\t\t\t\t<h3 class={'text-lg text-gray-600'}>On delete behaviour:</h3>\n\t\t\t\t<p class={'text-gray-500 text-sm'}>\n\t\t\t\t\t(What happens when you attempt to delete entity {entity.name})\n\t\t\t\t</p>\n\t\t\t\t<div class={'mt-2 text-sm '}>\n\t\t\t\t\t<OnDelete references={references} entity={entity} />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{false && (\n\t\t\t\t<div class={'px-2 py-2 w-1/2'}>\n\t\t\t\t\t<h3 class={'text-lg text-gray-600'}>ACL predicates:</h3>\n\t\t\t\t\t<div class={'mt-2 text-sm '}>\n\t\t\t\t\t\t{Object.entries(schema.acl.roles).map(([roleName, role]) =>\n\t\t\t\t\t\t\tObject.entries(role.entities[entity.name]?.predicates ?? {}).map(([predicateName, predicate]) => (\n\t\t\t\t\t\t\t\t<Fragment key={roleName + '__' + predicateName}>\n\t\t\t\t\t\t\t\t\t<h4>{roleName}: {predicateName}</h4>\n\t\t\t\t\t\t\t\t\t<code>{JSON.stringify(predicate)}</code>\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t))\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t</div>\n)\n"],"names":["jsxs","formatEntityAnchor","jsx","SinglePermission","formatFieldAnchor","FieldType","FieldPermissions","OnDelete"],"mappings":";;;;;;;;;AAeO,MAAM,aAAa,CAAC,EAAE,QAAQ,QAAQ,WAAA,MAC5CA,2BAAAA,KAAC,OAAA,EAAI,OAAO,+CAA+C,IAAIC,MAAAA,mBAAmB,OAAO,IAAI,GAC5F,UAAA;AAAA,EAAAC,2BAAAA,IAAC,OAAA,EAAI,OAAO,sGACV,UAAA,OAAO,MACT;AAAA,EACAF,2BAAAA,KAAC,OAAA,EAAI,OAAO,6BACX,UAAA;AAAA,IAAAE,2BAAAA,IAAC,OAAA,EACA,0CAAC,SAAA,EACA,UAAA;AAAA,MAAAA,2BAAAA,IAAC,SAAA,EACA,0CAAC,MAAA,EACA,UAAA;AAAA,QAAAA,2BAAAA,IAAC,M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,IAExB,CACA;AAAA,MAAA,EAAA,GAXuG,MAAM,IAY/G,CACA;AAAA,IAAA,EAAA,CACF,EAAA,CACD;AAAA,IACAN,2BAAAA,KAAC,OAAA,EAAI,OAAO,mBACX,UAAA;AAAA,MAAAE,2BAAAA,IAAC,MAAA,EAAG,OAAO,yBAAyB,UAAA,wBAAoB;AAAA,MACxDF,2BAAAA,KAAC,KAAA,EAAE,OAAO,yBAAyB,UAAA;AAAA,QAAA;AAAA,QACe,OAAO;AAAA,QAAK;AAAA,MAAA,GAC9D;AAAA,MACAE,2BAAAA,IAAC,SAAI,OAAO,iBACX,yCAACK,mBAAA,EAAS,YAAwB,QAAgB,EAAA,CACnD;AAAA,IAAA,GACD;AAAA,IACC;AAAA,EAAA,EAAA,CAeF;AAAA,EAAA,CACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityInfo.js","sources":["../../../../../../../../packages/cli/src/lib/project/docs/components/EntityInfo.tsx"],"sourcesContent":["import { Model, Schema } from '@contember/schema'\nimport { ReferencesMap } from '../../../schema/collectReferences'\nimport { formatEntityAnchor, formatFieldAnchor } from './utils'\nimport { SinglePermission } from './SinglePermission'\nimport { FieldType } from './FieldType'\nimport { FieldPermissions } from './FieldPermissions'\nimport { OnDelete } from './OnDelete'\nimport { Fragment, h } from 'preact'\n\ninterface EntityInfoProps {\n\tentity: Model.Entity\n\tschema: Schema\n\treferences: ReferencesMap\n}\n\nexport const EntityInfo = ({ entity, schema, references }: EntityInfoProps) => (\n\t<div class={'m-4 border border-gray-400 rounded-lg group'} id={formatEntityAnchor(entity.name)}>\n\t\t<div class={'font-bold text-gray-900 py-2 px-4 border-b border-gray-400 group-target:bg-yellow-100 rounded-t-lg'}>\n\t\t\t{entity.name}\n\t\t</div>\n\t\t<div class={'px-2 py-2 flex flex-wrap '}>\n\t\t\t<div>\n\t\t\t\t<table>\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th class={'text-left px-2 text-gray-500 font-normal w-[180px] max-w-[180px]'}>Name</th>\n\t\t\t\t\t\t\t<th class={'text-left px-2 text-gray-500 font-normal w-[340px] max-w-[340px]'}>Type</th>\n\t\t\t\t\t\t\t{Object.keys(schema.acl.roles).map(role => (\n\t\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\t\tkey={role}\n\t\t\t\t\t\t\t\t\tclass={'text-left px-2 text-gray-500 font-normal w-[120px] max-w-[120px] text-xs truncate text-sm'}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{role}\n\t\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t{Object.entries(schema.acl.roles).map(([name, role]) => (\n\t\t\t\t\t\t\t<td class={'px-2'} key={name}>\n\t\t\t\t\t\t\t\t<SinglePermission value={'D'} predicate={role.entities[entity.name]?.operations.delete} />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</tr>\n\t\t\t\t\t{Object.values(entity.fields).map(field => (\n\t\t\t\t\t\t<tr class={'even:bg-gray-100 target:bg-yellow-100'} id={formatFieldAnchor(entity.name, field.name)} key={field.name}>\n\t\t\t\t\t\t\t<td class={'px-2 font-mono truncate w-[180px] max-w-[180px]'} title={field.name}>\n\t\t\t\t\t\t\t\t{field.name}\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class={'text-gray-800 px-2 font-mono w-[420px] max-w-[420px]'}>\n\t\t\t\t\t\t\t\t<FieldType field={field} />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t{Object.entries(schema.acl.roles).map(([name, role]) => (\n\t\t\t\t\t\t\t\t<td class={'px-2'} key={name}>\n\t\t\t\t\t\t\t\t\t<FieldPermissions field={field.name} entityPermissions={role.entities[entity.name]} />\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t))}\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t\t<div class={'px-2 py-2 w-1/2'}>\n\t\t\t\t<h3 class={'text-lg text-gray-600'}>On delete behaviour:</h3>\n\t\t\t\t<p class={'text-gray-500 text-sm'}>\n\t\t\t\t\t(What happens when you attempt to delete entity {entity.name})\n\t\t\t\t</p>\n\t\t\t\t<div class={'mt-2 text-sm '}>\n\t\t\t\t\t<OnDelete references={references} entity={entity} />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{false && (\n\t\t\t\t<div class={'px-2 py-2 w-1/2'}>\n\t\t\t\t\t<h3 class={'text-lg text-gray-600'}>ACL predicates:</h3>\n\t\t\t\t\t<div class={'mt-2 text-sm '}>\n\t\t\t\t\t\t{Object.entries(schema.acl.roles).map(([roleName, role]) =>\n\t\t\t\t\t\t\tObject.entries(role.entities[entity.name]?.predicates ?? {}).map(([predicateName, predicate]) => (\n\t\t\t\t\t\t\t\t<Fragment key={roleName + '__' + predicateName}>\n\t\t\t\t\t\t\t\t\t<h4>{roleName}: {predicateName}</h4>\n\t\t\t\t\t\t\t\t\t<code>{JSON.stringify(predicate)}</code>\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t))\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t</div>\n)\n"],"names":[],"mappings":";;;;;;;AAeO,MAAM,aAAa,CAAC,EAAE,QAAQ,QAAQ,WAAA,MAC5C,qBAAC,OAAA,EAAI,OAAO,+CAA+C,IAAI,mBAAmB,OAAO,IAAI,GAC5F,UAAA;AAAA,EAAA,oBAAC,OAAA,EAAI,OAAO,sGACV,UAAA,OAAO,MACT;AAAA,EACA,qBAAC,OAAA,EAAI,OAAO,6BACX,UAAA;AAAA,IAAA,oBAAC,OAAA,EACA,+BAAC,SAAA,EAC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AAA,MAAA,EAAA,GAXuG,MAAM,IAY/G,CACA;AAAA,IAAA,EAAA,CACF,EAAA,CACD;AAAA,IACA,qBAAC,OAAA,EAAI,OAAO,mBACX,UAAA;AAAA,MAAA,oBAAC,MAAA,EAAG,OAAO,yBAAyB,UAAA,wBAAoB;AAAA,MACxD,qBAAC,KAAA,EAAE,OAAO,yBAAyB,UAAA;AAAA,QAAA;AAAA,QACe,OAAO;AAAA,QAAK;AAAA,MAAA,GAC9D;AAAA,MACA,oBAAC,SAAI,OAAO,iBACX,8BAAC,UAAA,EAAS,YAAwB,QAAgB,EAAA,CACnD;AAAA,IAAA,GACD;AAAA,IACC;AAAA,EAAA,EAAA,CAeF;AAAA,EAAA,CACD;"}
|
|
1
|
+
{"version":3,"file":"EntityInfo.js","sources":["../../../../../../../../packages/cli/src/lib/project/docs/components/EntityInfo.tsx"],"sourcesContent":["import { Model, Schema } from '@contember/schema'\nimport { ReferencesMap } from '../../../schema/collectReferences.js'\nimport { formatEntityAnchor, formatFieldAnchor } from './utils.js'\nimport { SinglePermission } from './SinglePermission.js'\nimport { FieldType } from './FieldType.js'\nimport { FieldPermissions } from './FieldPermissions.js'\nimport { OnDelete } from './OnDelete.js'\nimport { Fragment, h } from 'preact'\n\ninterface EntityInfoProps {\n\tentity: Model.Entity\n\tschema: Schema\n\treferences: ReferencesMap\n}\n\nexport const EntityInfo = ({ entity, schema, references }: EntityInfoProps) => (\n\t<div class={'m-4 border border-gray-400 rounded-lg group'} id={formatEntityAnchor(entity.name)}>\n\t\t<div class={'font-bold text-gray-900 py-2 px-4 border-b border-gray-400 group-target:bg-yellow-100 rounded-t-lg'}>\n\t\t\t{entity.name}\n\t\t</div>\n\t\t<div class={'px-2 py-2 flex flex-wrap '}>\n\t\t\t<div>\n\t\t\t\t<table>\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th class={'text-left px-2 text-gray-500 font-normal w-[180px] max-w-[180px]'}>Name</th>\n\t\t\t\t\t\t\t<th class={'text-left px-2 text-gray-500 font-normal w-[340px] max-w-[340px]'}>Type</th>\n\t\t\t\t\t\t\t{Object.keys(schema.acl.roles).map(role => (\n\t\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\t\tkey={role}\n\t\t\t\t\t\t\t\t\tclass={'text-left px-2 text-gray-500 font-normal w-[120px] max-w-[120px] text-xs truncate text-sm'}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{role}\n\t\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t{Object.entries(schema.acl.roles).map(([name, role]) => (\n\t\t\t\t\t\t\t<td class={'px-2'} key={name}>\n\t\t\t\t\t\t\t\t<SinglePermission value={'D'} predicate={role.entities[entity.name]?.operations.delete} />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</tr>\n\t\t\t\t\t{Object.values(entity.fields).map(field => (\n\t\t\t\t\t\t<tr class={'even:bg-gray-100 target:bg-yellow-100'} id={formatFieldAnchor(entity.name, field.name)} key={field.name}>\n\t\t\t\t\t\t\t<td class={'px-2 font-mono truncate w-[180px] max-w-[180px]'} title={field.name}>\n\t\t\t\t\t\t\t\t{field.name}\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class={'text-gray-800 px-2 font-mono w-[420px] max-w-[420px]'}>\n\t\t\t\t\t\t\t\t<FieldType field={field} />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t{Object.entries(schema.acl.roles).map(([name, role]) => (\n\t\t\t\t\t\t\t\t<td class={'px-2'} key={name}>\n\t\t\t\t\t\t\t\t\t<FieldPermissions field={field.name} entityPermissions={role.entities[entity.name]} />\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t))}\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t\t<div class={'px-2 py-2 w-1/2'}>\n\t\t\t\t<h3 class={'text-lg text-gray-600'}>On delete behaviour:</h3>\n\t\t\t\t<p class={'text-gray-500 text-sm'}>\n\t\t\t\t\t(What happens when you attempt to delete entity {entity.name})\n\t\t\t\t</p>\n\t\t\t\t<div class={'mt-2 text-sm '}>\n\t\t\t\t\t<OnDelete references={references} entity={entity} />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{false && (\n\t\t\t\t<div class={'px-2 py-2 w-1/2'}>\n\t\t\t\t\t<h3 class={'text-lg text-gray-600'}>ACL predicates:</h3>\n\t\t\t\t\t<div class={'mt-2 text-sm '}>\n\t\t\t\t\t\t{Object.entries(schema.acl.roles).map(([roleName, role]) =>\n\t\t\t\t\t\t\tObject.entries(role.entities[entity.name]?.predicates ?? {}).map(([predicateName, predicate]) => (\n\t\t\t\t\t\t\t\t<Fragment key={roleName + '__' + predicateName}>\n\t\t\t\t\t\t\t\t\t<h4>{roleName}: {predicateName}</h4>\n\t\t\t\t\t\t\t\t\t<code>{JSON.stringify(predicate)}</code>\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t))\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t</div>\n)\n"],"names":[],"mappings":";;;;;;;AAeO,MAAM,aAAa,CAAC,EAAE,QAAQ,QAAQ,WAAA,MAC5C,qBAAC,OAAA,EAAI,OAAO,+CAA+C,IAAI,mBAAmB,OAAO,IAAI,GAC5F,UAAA;AAAA,EAAA,oBAAC,OAAA,EAAI,OAAO,sGACV,UAAA,OAAO,MACT;AAAA,EACA,qBAAC,OAAA,EAAI,OAAO,6BACX,UAAA;AAAA,IAAA,oBAAC,OAAA,EACA,+BAAC,SAAA,EACA,UAAA;AAAA,MAAA,oBAAC,SAAA,EACA,+BAAC,MAAA,EACA,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AA,CACF,EAAA,CACD;AAAA,IACA,qBAAC,OAAA,EAAI,OAAO,mBACX,UAAA;AAAA,MAAA,oBAAC,MAAA,EAAG,OAAO,yBAAyB,UAAA,wBAAoB;AAAA,MACxD,qBAAC,KAAA,EAAE,OAAO,yBAAyB,UAAA;AAAA,QAAA;AAAA,QACe,OAAO;AAAA,QAAK;AAAA,MAAA,GAC9D;AAAA,MACA,oBAAC,SAAI,OAAO,iBACX,8BAAC,UAAA,EAAS,YAAwB,QAAgB,EAAA,CACnD;AAAA,IAAA,GACD;AAAA,IACC;AAAA,EAAA,EAAA,CAeF;AAAA,EAAA,CACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityLink.cjs","sources":["../../../../../../../../packages/cli/src/lib/project/docs/components/EntityLink.tsx"],"sourcesContent":["import { h } from 'preact'\nimport { formatEntityAnchor } from './utils'\n\nexport const EntityLink = ({ entity }: { entity: string }) => (\n\t<a href={`#${formatEntityAnchor(entity)}`} class={'text-blue-500 hover:underline'}>{entity}</a>\n)\n"],"names":["jsx","formatEntityAnchor"],"mappings":";;;;AAGO,MAAM,aAAa,CAAC,EAAE,OAAA,MAC5BA,2BAAAA,IAAC,KAAA,EAAE,MAAM,IAAIC,MAAAA,mBAAmB,MAAM,CAAC,IAAI,OAAO,iCAAkC,UAAA,OAAA,CAAO;;"}
|
|
1
|
+
{"version":3,"file":"EntityLink.cjs","sources":["../../../../../../../../packages/cli/src/lib/project/docs/components/EntityLink.tsx"],"sourcesContent":["import { h } from 'preact'\nimport { formatEntityAnchor } from './utils.js'\n\nexport const EntityLink = ({ entity }: { entity: string }) => (\n\t<a href={`#${formatEntityAnchor(entity)}`} class={'text-blue-500 hover:underline'}>{entity}</a>\n)\n"],"names":["jsx","formatEntityAnchor"],"mappings":";;;;AAGO,MAAM,aAAa,CAAC,EAAE,OAAA,MAC5BA,2BAAAA,IAAC,KAAA,EAAE,MAAM,IAAIC,MAAAA,mBAAmB,MAAM,CAAC,IAAI,OAAO,iCAAkC,UAAA,OAAA,CAAO;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityLink.js","sources":["../../../../../../../../packages/cli/src/lib/project/docs/components/EntityLink.tsx"],"sourcesContent":["import { h } from 'preact'\nimport { formatEntityAnchor } from './utils'\n\nexport const EntityLink = ({ entity }: { entity: string }) => (\n\t<a href={`#${formatEntityAnchor(entity)}`} class={'text-blue-500 hover:underline'}>{entity}</a>\n)\n"],"names":[],"mappings":";;AAGO,MAAM,aAAa,CAAC,EAAE,OAAA,MAC5B,oBAAC,KAAA,EAAE,MAAM,IAAI,mBAAmB,MAAM,CAAC,IAAI,OAAO,iCAAkC,UAAA,OAAA,CAAO;"}
|
|
1
|
+
{"version":3,"file":"EntityLink.js","sources":["../../../../../../../../packages/cli/src/lib/project/docs/components/EntityLink.tsx"],"sourcesContent":["import { h } from 'preact'\nimport { formatEntityAnchor } from './utils.js'\n\nexport const EntityLink = ({ entity }: { entity: string }) => (\n\t<a href={`#${formatEntityAnchor(entity)}`} class={'text-blue-500 hover:underline'}>{entity}</a>\n)\n"],"names":[],"mappings":";;AAGO,MAAM,aAAa,CAAC,EAAE,OAAA,MAC5B,oBAAC,KAAA,EAAE,MAAM,IAAI,mBAAmB,MAAM,CAAC,IAAI,OAAO,iCAAkC,UAAA,OAAA,CAAO;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldLink.cjs","sources":["../../../../../../../../packages/cli/src/lib/project/docs/components/FieldLink.tsx"],"sourcesContent":["import { Fragment, h } from 'preact'\nimport { EntityLink } from './EntityLink'\nimport { formatFieldAnchor } from './utils'\n\nexport const FieldLink = ({ entity, field, noEntityLabel }: { entity: string; field: string; noEntityLabel?: boolean }) => (\n\t<Fragment>\n\t\t{noEntityLabel ? '' : (\n\t\t\t<Fragment>\n\t\t\t\t<EntityLink entity={entity} />.\n\t\t\t</Fragment>\n\t\t)}\n\t\t<a href={`#${formatFieldAnchor(entity, field)}`} class={'text-blue-500 hover:underline'}>{field}</a>\n\t</Fragment>\n)\n"],"names":["Fragment","jsx","EntityLink","formatFieldAnchor"],"mappings":";;;;;;AAIO,MAAM,YAAY,CAAC,EAAE,QAAQ,OAAO,cAAA,sCACzCA,iBAAA,EACC,UAAA;AAAA,EAAA,gBAAgB,qCACfA,OAAAA,UAAA,EACA,UAAA;AAAA,IAAAC,+BAACC,WAAAA,cAAW,QAAgB;AAAA,IAAE;AAAA,EAAA,GAC/B;AAAA,EAEDD,2BAAAA,IAAC,KAAA,EAAE,MAAM,IAAIE,MAAAA,kBAAkB,QAAQ,KAAK,CAAC,IAAI,OAAO,iCAAkC,UAAA,MAAA,CAAM;AAAA,EAAA,CACjG;;"}
|
|
1
|
+
{"version":3,"file":"FieldLink.cjs","sources":["../../../../../../../../packages/cli/src/lib/project/docs/components/FieldLink.tsx"],"sourcesContent":["import { Fragment, h } from 'preact'\nimport { EntityLink } from './EntityLink.js'\nimport { formatFieldAnchor } from './utils.js'\n\nexport const FieldLink = ({ entity, field, noEntityLabel }: { entity: string; field: string; noEntityLabel?: boolean }) => (\n\t<Fragment>\n\t\t{noEntityLabel ? '' : (\n\t\t\t<Fragment>\n\t\t\t\t<EntityLink entity={entity} />.\n\t\t\t</Fragment>\n\t\t)}\n\t\t<a href={`#${formatFieldAnchor(entity, field)}`} class={'text-blue-500 hover:underline'}>{field}</a>\n\t</Fragment>\n)\n"],"names":["Fragment","jsx","EntityLink","formatFieldAnchor"],"mappings":";;;;;;AAIO,MAAM,YAAY,CAAC,EAAE,QAAQ,OAAO,cAAA,sCACzCA,iBAAA,EACC,UAAA;AAAA,EAAA,gBAAgB,qCACfA,OAAAA,UAAA,EACA,UAAA;AAAA,IAAAC,+BAACC,WAAAA,cAAW,QAAgB;AAAA,IAAE;AAAA,EAAA,GAC/B;AAAA,EAEDD,2BAAAA,IAAC,KAAA,EAAE,MAAM,IAAIE,MAAAA,kBAAkB,QAAQ,KAAK,CAAC,IAAI,OAAO,iCAAkC,UAAA,MAAA,CAAM;AAAA,EAAA,CACjG;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldLink.js","sources":["../../../../../../../../packages/cli/src/lib/project/docs/components/FieldLink.tsx"],"sourcesContent":["import { Fragment, h } from 'preact'\nimport { EntityLink } from './EntityLink'\nimport { formatFieldAnchor } from './utils'\n\nexport const FieldLink = ({ entity, field, noEntityLabel }: { entity: string; field: string; noEntityLabel?: boolean }) => (\n\t<Fragment>\n\t\t{noEntityLabel ? '' : (\n\t\t\t<Fragment>\n\t\t\t\t<EntityLink entity={entity} />.\n\t\t\t</Fragment>\n\t\t)}\n\t\t<a href={`#${formatFieldAnchor(entity, field)}`} class={'text-blue-500 hover:underline'}>{field}</a>\n\t</Fragment>\n)\n"],"names":[],"mappings":";;;;AAIO,MAAM,YAAY,CAAC,EAAE,QAAQ,OAAO,cAAA,2BACzC,UAAA,EACC,UAAA;AAAA,EAAA,gBAAgB,0BACf,UAAA,EACA,UAAA;AAAA,IAAA,oBAAC,cAAW,QAAgB;AAAA,IAAE;AAAA,EAAA,GAC/B;AAAA,EAED,oBAAC,KAAA,EAAE,MAAM,IAAI,kBAAkB,QAAQ,KAAK,CAAC,IAAI,OAAO,iCAAkC,UAAA,MAAA,CAAM;AAAA,EAAA,CACjG;"}
|
|
1
|
+
{"version":3,"file":"FieldLink.js","sources":["../../../../../../../../packages/cli/src/lib/project/docs/components/FieldLink.tsx"],"sourcesContent":["import { Fragment, h } from 'preact'\nimport { EntityLink } from './EntityLink.js'\nimport { formatFieldAnchor } from './utils.js'\n\nexport const FieldLink = ({ entity, field, noEntityLabel }: { entity: string; field: string; noEntityLabel?: boolean }) => (\n\t<Fragment>\n\t\t{noEntityLabel ? '' : (\n\t\t\t<Fragment>\n\t\t\t\t<EntityLink entity={entity} />.\n\t\t\t</Fragment>\n\t\t)}\n\t\t<a href={`#${formatFieldAnchor(entity, field)}`} class={'text-blue-500 hover:underline'}>{field}</a>\n\t</Fragment>\n)\n"],"names":[],"mappings":";;;;AAIO,MAAM,YAAY,CAAC,EAAE,QAAQ,OAAO,cAAA,2BACzC,UAAA,EACC,UAAA;AAAA,EAAA,gBAAgB,0BACf,UAAA,EACA,UAAA;AAAA,IAAA,oBAAC,cAAW,QAAgB;AAAA,IAAE;AAAA,EAAA,GAC/B;AAAA,EAED,oBAAC,KAAA,EAAE,MAAM,IAAI,kBAAkB,QAAQ,KAAK,CAAC,IAAI,OAAO,iCAAkC,UAAA,MAAA,CAAM;AAAA,EAAA,CACjG;"}
|