@contember/cli 2.0.0-alpha.9 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/contember-docker.sh +0 -0
- package/dist/development/run.cjs.map +1 -1
- package/dist/development/run.js.map +1 -1
- package/dist/development/src/commands/deploy/DeployCommand.cjs +5 -5
- package/dist/development/src/commands/deploy/DeployCommand.cjs.map +1 -1
- package/dist/development/src/commands/deploy/DeployCommand.js +5 -5
- package/dist/development/src/commands/deploy/DeployCommand.js.map +1 -1
- package/dist/development/src/commands/migrations/MigrationAmendCommand.cjs +15 -3
- package/dist/development/src/commands/migrations/MigrationAmendCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationAmendCommand.js +15 -3
- package/dist/development/src/commands/migrations/MigrationAmendCommand.js.map +1 -1
- package/dist/development/src/commands/migrations/MigrationBlankCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationBlankCommand.js.map +1 -1
- package/dist/development/src/commands/migrations/MigrationDescribeCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationDescribeCommand.js.map +1 -1
- package/dist/development/src/commands/migrations/MigrationDiffCommand.cjs +1 -1
- package/dist/development/src/commands/migrations/MigrationDiffCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationDiffCommand.js +1 -1
- package/dist/development/src/commands/migrations/MigrationDiffCommand.js.map +1 -1
- package/dist/development/src/commands/migrations/MigrationExecuteCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationExecuteCommand.js.map +1 -1
- package/dist/development/src/commands/migrations/MigrationRebaseCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationRebaseCommand.js.map +1 -1
- package/dist/development/src/commands/migrations/MigrationStatusCommand.cjs.map +1 -1
- package/dist/development/src/commands/migrations/MigrationStatusCommand.js.map +1 -1
- package/dist/development/src/commands/misc/VersionCommand.cjs.map +1 -1
- package/dist/development/src/commands/misc/VersionCommand.js.map +1 -1
- package/dist/development/src/commands/project/ProjectGenerateDocumentationCommand.cjs.map +1 -1
- package/dist/development/src/commands/project/ProjectGenerateDocumentationCommand.js.map +1 -1
- package/dist/development/src/commands/project/ProjectPrintSchemaCommand.cjs +13 -2
- package/dist/development/src/commands/project/ProjectPrintSchemaCommand.cjs.map +1 -1
- package/dist/development/src/commands/project/ProjectPrintSchemaCommand.js +14 -3
- package/dist/development/src/commands/project/ProjectPrintSchemaCommand.js.map +1 -1
- package/dist/development/src/commands/project/ProjectValidateCommand.cjs.map +1 -1
- package/dist/development/src/commands/project/ProjectValidateCommand.js.map +1 -1
- package/dist/development/src/commands/transfer/ExportCommand.cjs +2 -0
- package/dist/development/src/commands/transfer/ExportCommand.cjs.map +1 -1
- package/dist/development/src/commands/transfer/ExportCommand.js +2 -0
- package/dist/development/src/commands/transfer/ExportCommand.js.map +1 -1
- package/dist/development/src/commands/transfer/ImportCommand.cjs.map +1 -1
- package/dist/development/src/commands/transfer/ImportCommand.js.map +1 -1
- package/dist/development/src/commands/transfer/TransferCommand.cjs +2 -0
- package/dist/development/src/commands/transfer/TransferCommand.cjs.map +1 -1
- package/dist/development/src/commands/transfer/TransferCommand.js +2 -0
- package/dist/development/src/commands/transfer/TransferCommand.js.map +1 -1
- package/dist/development/src/commands/transfer/utils.cjs.map +1 -1
- package/dist/development/src/commands/transfer/utils.js.map +1 -1
- package/dist/development/src/commands/workspace/WorkspaceUpdateApiCommand.cjs.map +1 -1
- package/dist/development/src/commands/workspace/WorkspaceUpdateApiCommand.js.map +1 -1
- package/dist/development/src/consts.cjs +3 -1
- package/dist/development/src/consts.cjs.map +1 -1
- package/dist/development/src/consts.js +4 -2
- package/dist/development/src/consts.js.map +1 -1
- package/dist/development/src/dic.cjs +3 -1
- package/dist/development/src/dic.cjs.map +1 -1
- package/dist/development/src/dic.js +3 -1
- package/dist/development/src/dic.js.map +1 -1
- package/dist/development/src/lib/SystemClientProvider.cjs.map +1 -1
- package/dist/development/src/lib/SystemClientProvider.js.map +1 -1
- package/dist/development/src/lib/TenantClientProvider.cjs.map +1 -1
- package/dist/development/src/lib/TenantClientProvider.js.map +1 -1
- package/dist/development/src/lib/VersionChecker.cjs.map +1 -1
- package/dist/development/src/lib/VersionChecker.js.map +1 -1
- package/dist/development/src/lib/admin/AdminClient.cjs +1 -1
- package/dist/development/src/lib/admin/AdminClient.cjs.map +1 -1
- package/dist/development/src/lib/admin/AdminClient.js +1 -1
- package/dist/development/src/lib/admin/AdminClient.js.map +1 -1
- package/dist/development/src/lib/admin/AdminDeployer.cjs.map +1 -1
- package/dist/development/src/lib/admin/AdminDeployer.js.map +1 -1
- package/dist/development/src/lib/dsn.cjs.map +1 -1
- package/dist/development/src/lib/dsn.js.map +1 -1
- package/dist/development/src/lib/env.cjs +4 -1
- package/dist/development/src/lib/env.cjs.map +1 -1
- package/dist/development/src/lib/env.js +4 -1
- package/dist/development/src/lib/env.js.map +1 -1
- package/dist/development/src/lib/fs/DockerComposeManager.cjs.map +1 -1
- package/dist/development/src/lib/fs/DockerComposeManager.js.map +1 -1
- package/dist/development/src/lib/fs/FileSystem.cjs.map +1 -1
- package/dist/development/src/lib/fs/FileSystem.js.map +1 -1
- package/dist/development/src/lib/fs/YamlHandler.cjs.map +1 -1
- package/dist/development/src/lib/fs/YamlHandler.js.map +1 -1
- package/dist/development/src/lib/js/EsBuildBuilder.cjs +24 -19
- package/dist/development/src/lib/js/EsBuildBuilder.cjs.map +1 -1
- package/dist/development/src/lib/js/EsBuildBuilder.js +1 -1
- package/dist/development/src/lib/js/EsBuildBuilder.js.map +1 -1
- package/dist/development/src/lib/js/EvalExecutor.cjs +2 -2
- package/dist/development/src/lib/js/EvalExecutor.cjs.map +1 -1
- package/dist/development/src/lib/js/EvalExecutor.js +2 -2
- package/dist/development/src/lib/js/EvalExecutor.js.map +1 -1
- package/dist/development/src/lib/js/JsCodeRunner.cjs.map +1 -1
- package/dist/development/src/lib/js/JsCodeRunner.js.map +1 -1
- package/dist/development/src/lib/migrations/MigrationExecutionFacade.cjs +1 -1
- package/dist/development/src/lib/migrations/MigrationExecutionFacade.cjs.map +1 -1
- package/dist/development/src/lib/migrations/MigrationExecutionFacade.js +1 -1
- package/dist/development/src/lib/migrations/MigrationExecutionFacade.js.map +1 -1
- package/dist/development/src/lib/migrations/MigrationPrinter.cjs.map +1 -1
- package/dist/development/src/lib/migrations/MigrationPrinter.js.map +1 -1
- package/dist/development/src/lib/migrations/MigrationRebaseFacade.cjs.map +1 -1
- package/dist/development/src/lib/migrations/MigrationRebaseFacade.js.map +1 -1
- package/dist/development/src/lib/migrations/MigrationsStatusFacade.cjs.map +1 -1
- package/dist/development/src/lib/migrations/MigrationsStatusFacade.js.map +1 -1
- package/dist/development/src/lib/migrations/MigrationsValidator.cjs.map +1 -1
- package/dist/development/src/lib/migrations/MigrationsValidator.js.map +1 -1
- package/dist/development/src/lib/migrations/migrations.cjs.map +1 -1
- package/dist/development/src/lib/migrations/migrations.js.map +1 -1
- package/dist/development/src/lib/project/RemoteProject.cjs.map +1 -1
- package/dist/development/src/lib/project/RemoteProject.js.map +1 -1
- package/dist/development/src/lib/project/RemoteProjectProvider.cjs.map +1 -1
- package/dist/development/src/lib/project/RemoteProjectProvider.js.map +1 -1
- package/dist/development/src/lib/project/RemoteProjectResolver.cjs +9 -2
- package/dist/development/src/lib/project/RemoteProjectResolver.cjs.map +1 -1
- package/dist/development/src/lib/project/RemoteProjectResolver.js +9 -2
- package/dist/development/src/lib/project/RemoteProjectResolver.js.map +1 -1
- package/dist/development/src/lib/project/docs/components/EntityInfo.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/components/EntityInfo.js.map +1 -1
- package/dist/development/src/lib/project/docs/components/FieldLink.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/components/FieldLink.js.map +1 -1
- package/dist/development/src/lib/project/docs/components/FieldPermissions.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/components/FieldPermissions.js.map +1 -1
- package/dist/development/src/lib/project/docs/components/FieldType.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/components/FieldType.js.map +1 -1
- package/dist/development/src/lib/project/docs/components/OnDelete.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/components/OnDelete.js.map +1 -1
- package/dist/development/src/lib/project/docs/components/ProjectInfo.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/components/ProjectInfo.js.map +1 -1
- package/dist/development/src/lib/project/docs/components/SinglePermission.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/components/SinglePermission.js.map +1 -1
- package/dist/development/src/lib/project/docs/projectDescribe.cjs +3 -5
- package/dist/development/src/lib/project/docs/projectDescribe.cjs.map +1 -1
- package/dist/development/src/lib/project/docs/projectDescribe.js +3 -4
- package/dist/development/src/lib/project/docs/projectDescribe.js.map +1 -1
- package/dist/development/src/lib/schema/SchemaLoader.cjs.map +1 -1
- package/dist/development/src/lib/schema/SchemaLoader.js.map +1 -1
- package/dist/development/src/lib/schema/SchemaValidationHelper.cjs.map +1 -1
- package/dist/development/src/lib/schema/SchemaValidationPrinter.cjs.map +1 -1
- package/dist/development/src/lib/schema/SchemaValidationPrinter.js.map +1 -1
- package/dist/development/src/lib/schema/collectReferences.cjs.map +1 -1
- package/dist/development/src/lib/schema/collectReferences.js.map +1 -1
- package/dist/development/src/lib/stream.cjs.map +1 -1
- package/dist/development/src/lib/stream.js.map +1 -1
- package/dist/development/src/lib/tenant/TenantClient.cjs +4 -8
- package/dist/development/src/lib/tenant/TenantClient.cjs.map +1 -1
- package/dist/development/src/lib/tenant/TenantClient.js +3 -7
- package/dist/development/src/lib/tenant/TenantClient.js.map +1 -1
- package/dist/development/src/lib/transfer/DataTransferClient.cjs +2 -2
- package/dist/development/src/lib/transfer/DataTransferClient.cjs.map +1 -1
- package/dist/development/src/lib/transfer/DataTransferClient.js +2 -2
- package/dist/development/src/lib/transfer/DataTransferClient.js.map +1 -1
- package/dist/development/src/lib/transfer/stdio.cjs.map +1 -1
- package/dist/development/src/lib/transfer/stdio.js.map +1 -1
- package/dist/development/src/lib/workspace/WorkspaceResolver.cjs.map +1 -1
- package/dist/development/src/lib/workspace/WorkspaceResolver.js.map +1 -1
- package/dist/production/run.cjs.map +1 -1
- package/dist/production/run.js +0 -0
- package/dist/production/run.js.map +1 -1
- package/dist/production/src/commands/deploy/DeployCommand.cjs +5 -5
- package/dist/production/src/commands/deploy/DeployCommand.cjs.map +1 -1
- package/dist/production/src/commands/deploy/DeployCommand.js +5 -5
- package/dist/production/src/commands/deploy/DeployCommand.js.map +1 -1
- package/dist/production/src/commands/migrations/MigrationAmendCommand.cjs +15 -3
- package/dist/production/src/commands/migrations/MigrationAmendCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationAmendCommand.js +15 -3
- package/dist/production/src/commands/migrations/MigrationAmendCommand.js.map +1 -1
- package/dist/production/src/commands/migrations/MigrationBlankCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationBlankCommand.js.map +1 -1
- package/dist/production/src/commands/migrations/MigrationDescribeCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationDescribeCommand.js.map +1 -1
- package/dist/production/src/commands/migrations/MigrationDiffCommand.cjs +1 -1
- package/dist/production/src/commands/migrations/MigrationDiffCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationDiffCommand.js +1 -1
- package/dist/production/src/commands/migrations/MigrationDiffCommand.js.map +1 -1
- package/dist/production/src/commands/migrations/MigrationExecuteCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationExecuteCommand.js.map +1 -1
- package/dist/production/src/commands/migrations/MigrationRebaseCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationRebaseCommand.js.map +1 -1
- package/dist/production/src/commands/migrations/MigrationStatusCommand.cjs.map +1 -1
- package/dist/production/src/commands/migrations/MigrationStatusCommand.js.map +1 -1
- package/dist/production/src/commands/misc/VersionCommand.cjs.map +1 -1
- package/dist/production/src/commands/misc/VersionCommand.js.map +1 -1
- package/dist/production/src/commands/project/ProjectGenerateDocumentationCommand.cjs.map +1 -1
- package/dist/production/src/commands/project/ProjectGenerateDocumentationCommand.js.map +1 -1
- package/dist/production/src/commands/project/ProjectPrintSchemaCommand.cjs +13 -2
- package/dist/production/src/commands/project/ProjectPrintSchemaCommand.cjs.map +1 -1
- package/dist/production/src/commands/project/ProjectPrintSchemaCommand.js +14 -3
- package/dist/production/src/commands/project/ProjectPrintSchemaCommand.js.map +1 -1
- package/dist/production/src/commands/project/ProjectValidateCommand.cjs.map +1 -1
- package/dist/production/src/commands/project/ProjectValidateCommand.js.map +1 -1
- package/dist/production/src/commands/transfer/ExportCommand.cjs +2 -0
- package/dist/production/src/commands/transfer/ExportCommand.cjs.map +1 -1
- package/dist/production/src/commands/transfer/ExportCommand.js +2 -0
- package/dist/production/src/commands/transfer/ExportCommand.js.map +1 -1
- package/dist/production/src/commands/transfer/ImportCommand.cjs.map +1 -1
- package/dist/production/src/commands/transfer/ImportCommand.js.map +1 -1
- package/dist/production/src/commands/transfer/TransferCommand.cjs +2 -0
- package/dist/production/src/commands/transfer/TransferCommand.cjs.map +1 -1
- package/dist/production/src/commands/transfer/TransferCommand.js +2 -0
- package/dist/production/src/commands/transfer/TransferCommand.js.map +1 -1
- package/dist/production/src/commands/transfer/utils.cjs.map +1 -1
- package/dist/production/src/commands/transfer/utils.js.map +1 -1
- package/dist/production/src/commands/workspace/WorkspaceUpdateApiCommand.cjs.map +1 -1
- package/dist/production/src/commands/workspace/WorkspaceUpdateApiCommand.js.map +1 -1
- package/dist/production/src/consts.cjs +3 -1
- package/dist/production/src/consts.cjs.map +1 -1
- package/dist/production/src/consts.js +4 -2
- package/dist/production/src/consts.js.map +1 -1
- package/dist/production/src/dic.cjs +3 -1
- package/dist/production/src/dic.cjs.map +1 -1
- package/dist/production/src/dic.js +3 -1
- package/dist/production/src/dic.js.map +1 -1
- package/dist/production/src/lib/SystemClientProvider.cjs.map +1 -1
- package/dist/production/src/lib/SystemClientProvider.js.map +1 -1
- package/dist/production/src/lib/TenantClientProvider.cjs.map +1 -1
- package/dist/production/src/lib/TenantClientProvider.js.map +1 -1
- package/dist/production/src/lib/VersionChecker.cjs.map +1 -1
- package/dist/production/src/lib/VersionChecker.js.map +1 -1
- package/dist/production/src/lib/admin/AdminClient.cjs +1 -1
- package/dist/production/src/lib/admin/AdminClient.cjs.map +1 -1
- package/dist/production/src/lib/admin/AdminClient.js +1 -1
- package/dist/production/src/lib/admin/AdminClient.js.map +1 -1
- package/dist/production/src/lib/admin/AdminDeployer.cjs.map +1 -1
- package/dist/production/src/lib/admin/AdminDeployer.js.map +1 -1
- package/dist/production/src/lib/dsn.cjs.map +1 -1
- package/dist/production/src/lib/dsn.js.map +1 -1
- package/dist/production/src/lib/env.cjs +4 -1
- package/dist/production/src/lib/env.cjs.map +1 -1
- package/dist/production/src/lib/env.js +4 -1
- package/dist/production/src/lib/env.js.map +1 -1
- package/dist/production/src/lib/fs/DockerComposeManager.cjs.map +1 -1
- package/dist/production/src/lib/fs/DockerComposeManager.js.map +1 -1
- package/dist/production/src/lib/fs/FileSystem.cjs.map +1 -1
- package/dist/production/src/lib/fs/FileSystem.js.map +1 -1
- package/dist/production/src/lib/fs/YamlHandler.cjs.map +1 -1
- package/dist/production/src/lib/fs/YamlHandler.js.map +1 -1
- package/dist/production/src/lib/js/EsBuildBuilder.cjs +24 -19
- package/dist/production/src/lib/js/EsBuildBuilder.cjs.map +1 -1
- package/dist/production/src/lib/js/EsBuildBuilder.js +1 -1
- package/dist/production/src/lib/js/EsBuildBuilder.js.map +1 -1
- package/dist/production/src/lib/js/EvalExecutor.cjs +2 -2
- package/dist/production/src/lib/js/EvalExecutor.cjs.map +1 -1
- package/dist/production/src/lib/js/EvalExecutor.js +2 -2
- package/dist/production/src/lib/js/EvalExecutor.js.map +1 -1
- package/dist/production/src/lib/js/JsCodeRunner.cjs.map +1 -1
- package/dist/production/src/lib/js/JsCodeRunner.js.map +1 -1
- package/dist/production/src/lib/migrations/MigrationExecutionFacade.cjs +1 -1
- package/dist/production/src/lib/migrations/MigrationExecutionFacade.cjs.map +1 -1
- package/dist/production/src/lib/migrations/MigrationExecutionFacade.js +1 -1
- package/dist/production/src/lib/migrations/MigrationExecutionFacade.js.map +1 -1
- package/dist/production/src/lib/migrations/MigrationPrinter.cjs.map +1 -1
- package/dist/production/src/lib/migrations/MigrationPrinter.js.map +1 -1
- package/dist/production/src/lib/migrations/MigrationRebaseFacade.cjs.map +1 -1
- package/dist/production/src/lib/migrations/MigrationRebaseFacade.js.map +1 -1
- package/dist/production/src/lib/migrations/MigrationsStatusFacade.cjs.map +1 -1
- package/dist/production/src/lib/migrations/MigrationsStatusFacade.js.map +1 -1
- package/dist/production/src/lib/migrations/MigrationsValidator.cjs.map +1 -1
- package/dist/production/src/lib/migrations/MigrationsValidator.js.map +1 -1
- package/dist/production/src/lib/migrations/migrations.cjs.map +1 -1
- package/dist/production/src/lib/migrations/migrations.js.map +1 -1
- package/dist/production/src/lib/project/RemoteProject.cjs.map +1 -1
- package/dist/production/src/lib/project/RemoteProject.js.map +1 -1
- package/dist/production/src/lib/project/RemoteProjectProvider.cjs.map +1 -1
- package/dist/production/src/lib/project/RemoteProjectProvider.js.map +1 -1
- package/dist/production/src/lib/project/RemoteProjectResolver.cjs +9 -2
- package/dist/production/src/lib/project/RemoteProjectResolver.cjs.map +1 -1
- package/dist/production/src/lib/project/RemoteProjectResolver.js +9 -2
- package/dist/production/src/lib/project/RemoteProjectResolver.js.map +1 -1
- package/dist/production/src/lib/project/docs/components/EntityInfo.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/components/EntityInfo.js.map +1 -1
- package/dist/production/src/lib/project/docs/components/FieldPermissions.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/components/FieldPermissions.js.map +1 -1
- package/dist/production/src/lib/project/docs/components/FieldType.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/components/FieldType.js.map +1 -1
- package/dist/production/src/lib/project/docs/components/OnDelete.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/components/OnDelete.js.map +1 -1
- package/dist/production/src/lib/project/docs/components/ProjectInfo.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/components/ProjectInfo.js.map +1 -1
- package/dist/production/src/lib/project/docs/components/SinglePermission.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/components/SinglePermission.js.map +1 -1
- package/dist/production/src/lib/project/docs/projectDescribe.cjs +2 -4
- package/dist/production/src/lib/project/docs/projectDescribe.cjs.map +1 -1
- package/dist/production/src/lib/project/docs/projectDescribe.js +2 -3
- package/dist/production/src/lib/project/docs/projectDescribe.js.map +1 -1
- package/dist/production/src/lib/schema/SchemaLoader.cjs.map +1 -1
- package/dist/production/src/lib/schema/SchemaLoader.js.map +1 -1
- package/dist/production/src/lib/schema/SchemaValidationHelper.cjs.map +1 -1
- package/dist/production/src/lib/schema/SchemaValidationPrinter.cjs.map +1 -1
- package/dist/production/src/lib/schema/SchemaValidationPrinter.js.map +1 -1
- package/dist/production/src/lib/schema/collectReferences.cjs.map +1 -1
- package/dist/production/src/lib/schema/collectReferences.js.map +1 -1
- package/dist/production/src/lib/stream.cjs.map +1 -1
- package/dist/production/src/lib/stream.js.map +1 -1
- package/dist/production/src/lib/tenant/TenantClient.cjs +4 -8
- package/dist/production/src/lib/tenant/TenantClient.cjs.map +1 -1
- package/dist/production/src/lib/tenant/TenantClient.js +3 -7
- package/dist/production/src/lib/tenant/TenantClient.js.map +1 -1
- package/dist/production/src/lib/transfer/DataTransferClient.cjs +2 -2
- package/dist/production/src/lib/transfer/DataTransferClient.cjs.map +1 -1
- package/dist/production/src/lib/transfer/DataTransferClient.js +2 -2
- package/dist/production/src/lib/transfer/DataTransferClient.js.map +1 -1
- package/dist/production/src/lib/transfer/stdio.cjs.map +1 -1
- package/dist/production/src/lib/transfer/stdio.js.map +1 -1
- package/dist/production/src/lib/workspace/WorkspaceResolver.cjs.map +1 -1
- package/dist/production/src/lib/workspace/WorkspaceResolver.js.map +1 -1
- package/dist/types/commands/deploy/DeployCommand.d.ts.map +1 -1
- package/dist/types/commands/migrations/MigrationAmendCommand.d.ts +1 -0
- package/dist/types/commands/migrations/MigrationAmendCommand.d.ts.map +1 -1
- package/dist/types/commands/project/ProjectPrintSchemaCommand.d.ts +4 -0
- package/dist/types/commands/project/ProjectPrintSchemaCommand.d.ts.map +1 -1
- package/dist/types/commands/transfer/ExportCommand.d.ts +1 -0
- package/dist/types/commands/transfer/ExportCommand.d.ts.map +1 -1
- package/dist/types/commands/transfer/TransferCommand.d.ts +1 -0
- package/dist/types/commands/transfer/TransferCommand.d.ts.map +1 -1
- package/dist/types/consts.d.ts.map +1 -1
- package/dist/types/dic.d.ts.map +1 -1
- package/dist/types/lib/env.d.ts +3 -0
- package/dist/types/lib/env.d.ts.map +1 -1
- package/dist/types/lib/js/EsBuildBuilder.d.ts.map +1 -1
- package/dist/types/lib/migrations/MigrationExecutionFacade.d.ts +2 -2
- package/dist/types/lib/migrations/MigrationExecutionFacade.d.ts.map +1 -1
- package/dist/types/lib/migrations/MigrationPrinter.d.ts.map +1 -1
- package/dist/types/lib/project/RemoteProjectResolver.d.ts +1 -1
- package/dist/types/lib/project/RemoteProjectResolver.d.ts.map +1 -1
- package/dist/types/lib/project/docs/projectDescribe.d.ts.map +1 -1
- package/dist/types/lib/tenant/TenantClient.d.ts +2 -2
- package/dist/types/lib/tenant/TenantClient.d.ts.map +1 -1
- package/dist/types/lib/transfer/DataTransferClient.d.ts +2 -1
- package/dist/types/lib/transfer/DataTransferClient.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +34 -31
- package/src/commands/deploy/DeployCommand.ts +6 -5
- package/src/commands/migrations/MigrationAmendCommand.ts +16 -3
- package/src/commands/migrations/MigrationDiffCommand.ts +1 -1
- package/src/commands/project/ProjectPrintSchemaCommand.ts +19 -3
- package/src/commands/transfer/ExportCommand.ts +3 -0
- package/src/commands/transfer/TransferCommand.ts +3 -0
- package/src/consts.ts +4 -2
- package/src/dic.ts +3 -1
- package/src/lib/admin/AdminClient.ts +1 -1
- package/src/lib/env.ts +6 -0
- package/src/lib/js/EsBuildBuilder.ts +1 -1
- package/src/lib/js/EvalExecutor.ts +2 -2
- package/src/lib/migrations/MigrationExecutionFacade.ts +3 -3
- package/src/lib/migrations/MigrationPrinter.ts +3 -0
- package/src/lib/project/RemoteProjectResolver.ts +10 -2
- package/src/lib/project/docs/projectDescribe.tsx +2 -3
- package/src/lib/tenant/TenantClient.ts +5 -9
- package/src/lib/transfer/DataTransferClient.ts +3 -2
- package/src/tsconfig.json +1 -0
- package/tsconfig.settings.json +0 -1
- package/Dockerfile +0 -20
- package/build.sh +0 -11
- package/esbuild.cjs +0 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationStatusCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationStatusCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationFilesManager, MigrationState, sortMigrations, SystemClient } from '@contember/migrations-client'\nimport chalk from 'chalk'\nimport { MigrationsStatusFacade } from '../../lib/migrations/MigrationsStatusFacade'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { SystemClientProvider } from '../../lib/SystemClientProvider'\n\ntype Args = {\n}\n\ntype Options = {\n\t['only-to-execute']?: true\n\t['only-errors']?: true\n\t['restore-missing']?: true\n}\n\nexport class MigrationStatusCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationsStatusFacade: MigrationsStatusFacade,\n\t\tprivate readonly migrationFilesManager: MigrationFilesManager,\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Shows status of executed migrations on an instance & sync status')\n\t\tconfiguration //\n\t\t\t.option('only-errors')\n\t\t\t.valueNone()\n\t\t\t.description('Show only migrations with an error.')\n\t\tconfiguration //\n\t\t\t.option('only-to-execute')\n\t\t\t.valueNone()\n\t\t\t.description('Show only migrations to execute.')\n\t\tconfiguration //\n\t\t\t.option('restore-missing')\n\t\t\t.valueNone()\n\t\t\t.description('Restores migrations locally missing')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\n\t\tconst onlyErrors = input.getOption('only-errors')\n\t\tconst onlyToExecute = input.getOption('only-to-execute')\n\t\tconst restoreMissing = input.getOption('restore-missing')\n\n\t\tlet status = await this.migrationsStatusFacade.resolveMigrationsStatus({})\n\n\t\tif (restoreMissing) {\n\t\t\tconst missing = status.errorMigrations.filter(it => it.state === MigrationState.EXECUTED_MISSING)\n\t\t\tfor (const migration of missing) {\n\t\t\t\tconsole.log(`Restoring migration ${migration.name}`)\n\t\t\t\tconst fullMigration = await this.systemClientProvider.get().getExecutedMigration(migration.version)\n\t\t\t\tawait this.migrationFilesManager.createFile(\n\t\t\t\t\tJSON.stringify(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformatVersion: fullMigration.formatVersion,\n\t\t\t\t\t\t\tmodifications: fullMigration.modifications,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t'\\t',\n\t\t\t\t\t) + '\\n',\n\t\t\t\t\tfullMigration.name,\n\t\t\t\t)\n\t\t\t}\n\t\t\tstatus = await this.migrationsStatusFacade.resolveMigrationsStatus({})\n\t\t}\n\n\n\n\t\tconst filtered =\n\t\t\tonlyErrors || onlyToExecute\n\t\t\t\t? sortMigrations([\n\t\t\t\t\t...(onlyErrors ? status.errorMigrations : []),\n\t\t\t\t\t...(onlyToExecute ? status.migrationsToExecute : []),\n\t\t\t\t ])\n\t\t\t\t: status.allMigrations\n\n\t\tthis.migrationPrinter.printStatusTable(filtered)\n\n\t\tconst hasErrors = status.errorMigrations.length > 0\n\n\t\tif (hasErrors) {\n\t\t\tconsole.error(chalk.redBright('Some migrations are broken'))\n\t\t}\n\n\t\treturn hasErrors ? 1 : 0\n\t}\n}\n"],"names":["Command","MigrationState","sortMigrations"],"mappings":";;;;;AAgBO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,wBACA,uBACA,sBACA,kBAChB;AACK;AALW,SAAA,yBAAA;AACA,SAAA,wBAAA;AACA,SAAA,uBAAA;AACA,SAAA,mBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"MigrationStatusCommand.cjs","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationStatusCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationFilesManager, MigrationState, sortMigrations, SystemClient } from '@contember/migrations-client'\nimport chalk from 'chalk'\nimport { MigrationsStatusFacade } from '../../lib/migrations/MigrationsStatusFacade'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { SystemClientProvider } from '../../lib/SystemClientProvider'\n\ntype Args = {\n}\n\ntype Options = {\n\t['only-to-execute']?: true\n\t['only-errors']?: true\n\t['restore-missing']?: true\n}\n\nexport class MigrationStatusCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationsStatusFacade: MigrationsStatusFacade,\n\t\tprivate readonly migrationFilesManager: MigrationFilesManager,\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Shows status of executed migrations on an instance & sync status')\n\t\tconfiguration //\n\t\t\t.option('only-errors')\n\t\t\t.valueNone()\n\t\t\t.description('Show only migrations with an error.')\n\t\tconfiguration //\n\t\t\t.option('only-to-execute')\n\t\t\t.valueNone()\n\t\t\t.description('Show only migrations to execute.')\n\t\tconfiguration //\n\t\t\t.option('restore-missing')\n\t\t\t.valueNone()\n\t\t\t.description('Restores migrations locally missing')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\n\t\tconst onlyErrors = input.getOption('only-errors')\n\t\tconst onlyToExecute = input.getOption('only-to-execute')\n\t\tconst restoreMissing = input.getOption('restore-missing')\n\n\t\tlet status = await this.migrationsStatusFacade.resolveMigrationsStatus({})\n\n\t\tif (restoreMissing) {\n\t\t\tconst missing = status.errorMigrations.filter(it => it.state === MigrationState.EXECUTED_MISSING)\n\t\t\tfor (const migration of missing) {\n\t\t\t\tconsole.log(`Restoring migration ${migration.name}`)\n\t\t\t\tconst fullMigration = await this.systemClientProvider.get().getExecutedMigration(migration.version)\n\t\t\t\tawait this.migrationFilesManager.createFile(\n\t\t\t\t\tJSON.stringify(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformatVersion: fullMigration.formatVersion,\n\t\t\t\t\t\t\tmodifications: fullMigration.modifications,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t'\\t',\n\t\t\t\t\t) + '\\n',\n\t\t\t\t\tfullMigration.name,\n\t\t\t\t)\n\t\t\t}\n\t\t\tstatus = await this.migrationsStatusFacade.resolveMigrationsStatus({})\n\t\t}\n\n\n\n\t\tconst filtered =\n\t\t\tonlyErrors || onlyToExecute\n\t\t\t\t? sortMigrations([\n\t\t\t\t\t...(onlyErrors ? status.errorMigrations : []),\n\t\t\t\t\t...(onlyToExecute ? status.migrationsToExecute : []),\n\t\t\t\t ])\n\t\t\t\t: status.allMigrations\n\n\t\tthis.migrationPrinter.printStatusTable(filtered)\n\n\t\tconst hasErrors = status.errorMigrations.length > 0\n\n\t\tif (hasErrors) {\n\t\t\tconsole.error(chalk.redBright('Some migrations are broken'))\n\t\t}\n\n\t\treturn hasErrors ? 1 : 0\n\t}\n}\n"],"names":["Command","MigrationState","sortMigrations"],"mappings":";;;;;AAgBO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,wBACA,uBACA,sBACA,kBAChB;AACK,UAAA;AALW,SAAA,yBAAA;AACA,SAAA,wBAAA;AACA,SAAA,uBAAA;AACA,SAAA,mBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,kEAAkE;AAC5F,kBACE,OAAO,aAAa,EACpB,UAAU,EACV,YAAY,qCAAqC;AACnD,kBACE,OAAO,iBAAiB,EACxB,UAAU,EACV,YAAY,kCAAkC;AAChD,kBACE,OAAO,iBAAiB,EACxB,UAAU,EACV,YAAY,qCAAqC;AAAA,EAAA;AAAA,EAGpD,MAAgB,QAAQ,OAA8C;AAE/D,UAAA,aAAa,MAAM,UAAU,aAAa;AAC1C,UAAA,gBAAgB,MAAM,UAAU,iBAAiB;AACjD,UAAA,iBAAiB,MAAM,UAAU,iBAAiB;AAExD,QAAI,SAAS,MAAM,KAAK,uBAAuB,wBAAwB,CAAA,CAAE;AAEzE,QAAI,gBAAgB;AACb,YAAA,UAAU,OAAO,gBAAgB,OAAO,QAAM,GAAG,UAAUC,gCAAe,gBAAgB;AAChG,iBAAW,aAAa,SAAS;AAChC,gBAAQ,IAAI,uBAAuB,UAAU,IAAI,EAAE;AAC7C,cAAA,gBAAgB,MAAM,KAAK,qBAAqB,MAAM,qBAAqB,UAAU,OAAO;AAClG,cAAM,KAAK,sBAAsB;AAAA,UAChC,KAAK;AAAA,YACJ;AAAA,cACC,eAAe,cAAc;AAAA,cAC7B,eAAe,cAAc;AAAA,YAC9B;AAAA,YACA;AAAA,YACA;AAAA,UAAA,IACG;AAAA,UACJ,cAAc;AAAA,QACf;AAAA,MAAA;AAED,eAAS,MAAM,KAAK,uBAAuB,wBAAwB,CAAA,CAAE;AAAA,IAAA;AAKhE,UAAA,WACL,cAAc,gBACXC,gCAAe;AAAA,MAChB,GAAI,aAAa,OAAO,kBAAkB,CAAC;AAAA,MAC3C,GAAI,gBAAgB,OAAO,sBAAsB,CAAA;AAAA,IAAC,CAChD,IACD,OAAO;AAEN,SAAA,iBAAiB,iBAAiB,QAAQ;AAEzC,UAAA,YAAY,OAAO,gBAAgB,SAAS;AAElD,QAAI,WAAW;AACd,cAAQ,MAAM,MAAM,UAAU,4BAA4B,CAAC;AAAA,IAAA;AAG5D,WAAO,YAAY,IAAI;AAAA,EAAA;AAEzB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrationStatusCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationStatusCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationFilesManager, MigrationState, sortMigrations, SystemClient } from '@contember/migrations-client'\nimport chalk from 'chalk'\nimport { MigrationsStatusFacade } from '../../lib/migrations/MigrationsStatusFacade'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { SystemClientProvider } from '../../lib/SystemClientProvider'\n\ntype Args = {\n}\n\ntype Options = {\n\t['only-to-execute']?: true\n\t['only-errors']?: true\n\t['restore-missing']?: true\n}\n\nexport class MigrationStatusCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationsStatusFacade: MigrationsStatusFacade,\n\t\tprivate readonly migrationFilesManager: MigrationFilesManager,\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Shows status of executed migrations on an instance & sync status')\n\t\tconfiguration //\n\t\t\t.option('only-errors')\n\t\t\t.valueNone()\n\t\t\t.description('Show only migrations with an error.')\n\t\tconfiguration //\n\t\t\t.option('only-to-execute')\n\t\t\t.valueNone()\n\t\t\t.description('Show only migrations to execute.')\n\t\tconfiguration //\n\t\t\t.option('restore-missing')\n\t\t\t.valueNone()\n\t\t\t.description('Restores migrations locally missing')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\n\t\tconst onlyErrors = input.getOption('only-errors')\n\t\tconst onlyToExecute = input.getOption('only-to-execute')\n\t\tconst restoreMissing = input.getOption('restore-missing')\n\n\t\tlet status = await this.migrationsStatusFacade.resolveMigrationsStatus({})\n\n\t\tif (restoreMissing) {\n\t\t\tconst missing = status.errorMigrations.filter(it => it.state === MigrationState.EXECUTED_MISSING)\n\t\t\tfor (const migration of missing) {\n\t\t\t\tconsole.log(`Restoring migration ${migration.name}`)\n\t\t\t\tconst fullMigration = await this.systemClientProvider.get().getExecutedMigration(migration.version)\n\t\t\t\tawait this.migrationFilesManager.createFile(\n\t\t\t\t\tJSON.stringify(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformatVersion: fullMigration.formatVersion,\n\t\t\t\t\t\t\tmodifications: fullMigration.modifications,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t'\\t',\n\t\t\t\t\t) + '\\n',\n\t\t\t\t\tfullMigration.name,\n\t\t\t\t)\n\t\t\t}\n\t\t\tstatus = await this.migrationsStatusFacade.resolveMigrationsStatus({})\n\t\t}\n\n\n\n\t\tconst filtered =\n\t\t\tonlyErrors || onlyToExecute\n\t\t\t\t? sortMigrations([\n\t\t\t\t\t...(onlyErrors ? status.errorMigrations : []),\n\t\t\t\t\t...(onlyToExecute ? status.migrationsToExecute : []),\n\t\t\t\t ])\n\t\t\t\t: status.allMigrations\n\n\t\tthis.migrationPrinter.printStatusTable(filtered)\n\n\t\tconst hasErrors = status.errorMigrations.length > 0\n\n\t\tif (hasErrors) {\n\t\t\tconsole.error(chalk.redBright('Some migrations are broken'))\n\t\t}\n\n\t\treturn hasErrors ? 1 : 0\n\t}\n}\n"],"names":[],"mappings":";;;AAgBO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,wBACA,uBACA,sBACA,kBAChB;AACK;AALW,SAAA,yBAAA;AACA,SAAA,wBAAA;AACA,SAAA,uBAAA;AACA,SAAA,mBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"MigrationStatusCommand.js","sources":["../../../../../../packages/cli/src/commands/migrations/MigrationStatusCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { MigrationFilesManager, MigrationState, sortMigrations, SystemClient } from '@contember/migrations-client'\nimport chalk from 'chalk'\nimport { MigrationsStatusFacade } from '../../lib/migrations/MigrationsStatusFacade'\nimport { MigrationPrinter } from '../../lib/migrations/MigrationPrinter'\nimport { SystemClientProvider } from '../../lib/SystemClientProvider'\n\ntype Args = {\n}\n\ntype Options = {\n\t['only-to-execute']?: true\n\t['only-errors']?: true\n\t['restore-missing']?: true\n}\n\nexport class MigrationStatusCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly migrationsStatusFacade: MigrationsStatusFacade,\n\t\tprivate readonly migrationFilesManager: MigrationFilesManager,\n\t\tprivate readonly systemClientProvider: SystemClientProvider,\n\t\tprivate readonly migrationPrinter: MigrationPrinter,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Shows status of executed migrations on an instance & sync status')\n\t\tconfiguration //\n\t\t\t.option('only-errors')\n\t\t\t.valueNone()\n\t\t\t.description('Show only migrations with an error.')\n\t\tconfiguration //\n\t\t\t.option('only-to-execute')\n\t\t\t.valueNone()\n\t\t\t.description('Show only migrations to execute.')\n\t\tconfiguration //\n\t\t\t.option('restore-missing')\n\t\t\t.valueNone()\n\t\t\t.description('Restores migrations locally missing')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\n\t\tconst onlyErrors = input.getOption('only-errors')\n\t\tconst onlyToExecute = input.getOption('only-to-execute')\n\t\tconst restoreMissing = input.getOption('restore-missing')\n\n\t\tlet status = await this.migrationsStatusFacade.resolveMigrationsStatus({})\n\n\t\tif (restoreMissing) {\n\t\t\tconst missing = status.errorMigrations.filter(it => it.state === MigrationState.EXECUTED_MISSING)\n\t\t\tfor (const migration of missing) {\n\t\t\t\tconsole.log(`Restoring migration ${migration.name}`)\n\t\t\t\tconst fullMigration = await this.systemClientProvider.get().getExecutedMigration(migration.version)\n\t\t\t\tawait this.migrationFilesManager.createFile(\n\t\t\t\t\tJSON.stringify(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformatVersion: fullMigration.formatVersion,\n\t\t\t\t\t\t\tmodifications: fullMigration.modifications,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t'\\t',\n\t\t\t\t\t) + '\\n',\n\t\t\t\t\tfullMigration.name,\n\t\t\t\t)\n\t\t\t}\n\t\t\tstatus = await this.migrationsStatusFacade.resolveMigrationsStatus({})\n\t\t}\n\n\n\n\t\tconst filtered =\n\t\t\tonlyErrors || onlyToExecute\n\t\t\t\t? sortMigrations([\n\t\t\t\t\t...(onlyErrors ? status.errorMigrations : []),\n\t\t\t\t\t...(onlyToExecute ? status.migrationsToExecute : []),\n\t\t\t\t ])\n\t\t\t\t: status.allMigrations\n\n\t\tthis.migrationPrinter.printStatusTable(filtered)\n\n\t\tconst hasErrors = status.errorMigrations.length > 0\n\n\t\tif (hasErrors) {\n\t\t\tconsole.error(chalk.redBright('Some migrations are broken'))\n\t\t}\n\n\t\treturn hasErrors ? 1 : 0\n\t}\n}\n"],"names":[],"mappings":";;;AAgBO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,wBACA,uBACA,sBACA,kBAChB;AACK,UAAA;AALW,SAAA,yBAAA;AACA,SAAA,wBAAA;AACA,SAAA,uBAAA;AACA,SAAA,mBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,kEAAkE;AAC5F,kBACE,OAAO,aAAa,EACpB,UAAU,EACV,YAAY,qCAAqC;AACnD,kBACE,OAAO,iBAAiB,EACxB,UAAU,EACV,YAAY,kCAAkC;AAChD,kBACE,OAAO,iBAAiB,EACxB,UAAU,EACV,YAAY,qCAAqC;AAAA,EAAA;AAAA,EAGpD,MAAgB,QAAQ,OAA8C;AAE/D,UAAA,aAAa,MAAM,UAAU,aAAa;AAC1C,UAAA,gBAAgB,MAAM,UAAU,iBAAiB;AACjD,UAAA,iBAAiB,MAAM,UAAU,iBAAiB;AAExD,QAAI,SAAS,MAAM,KAAK,uBAAuB,wBAAwB,CAAA,CAAE;AAEzE,QAAI,gBAAgB;AACb,YAAA,UAAU,OAAO,gBAAgB,OAAO,QAAM,GAAG,UAAU,eAAe,gBAAgB;AAChG,iBAAW,aAAa,SAAS;AAChC,gBAAQ,IAAI,uBAAuB,UAAU,IAAI,EAAE;AAC7C,cAAA,gBAAgB,MAAM,KAAK,qBAAqB,MAAM,qBAAqB,UAAU,OAAO;AAClG,cAAM,KAAK,sBAAsB;AAAA,UAChC,KAAK;AAAA,YACJ;AAAA,cACC,eAAe,cAAc;AAAA,cAC7B,eAAe,cAAc;AAAA,YAC9B;AAAA,YACA;AAAA,YACA;AAAA,UAAA,IACG;AAAA,UACJ,cAAc;AAAA,QACf;AAAA,MAAA;AAED,eAAS,MAAM,KAAK,uBAAuB,wBAAwB,CAAA,CAAE;AAAA,IAAA;AAKhE,UAAA,WACL,cAAc,gBACX,eAAe;AAAA,MAChB,GAAI,aAAa,OAAO,kBAAkB,CAAC;AAAA,MAC3C,GAAI,gBAAgB,OAAO,sBAAsB,CAAA;AAAA,IAAC,CAChD,IACD,OAAO;AAEN,SAAA,iBAAiB,iBAAiB,QAAQ;AAEzC,UAAA,YAAY,OAAO,gBAAgB,SAAS;AAElD,QAAI,WAAW;AACd,cAAQ,MAAM,MAAM,UAAU,4BAA4B,CAAC;AAAA,IAAA;AAG5D,WAAO,YAAY,IAAI;AAAA,EAAA;AAEzB;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VersionCommand.cjs","sources":["../../../../../../packages/cli/src/commands/misc/VersionCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration } from '@contember/cli-common'\n\nexport class VersionCommand extends Command<{}, {}> {\n\tconstructor(\n\t\tprivate readonly version: string,\n\t) {\n\t\tsuper()\n\t}\n\tprotected configure(configuration: CommandConfiguration<{}, {}>): void {\n\t\tconfiguration.description('Prints Contember CLI version')\n\t}\n\n\tprotected async execute(): Promise<void | number> {\n\t\tconsole.log(this.version)\n\t\treturn 0\n\t}\n}\n"],"names":["Command"],"mappings":";;;AAEO,MAAM,uBAAuBA,UAAAA,QAAgB;AAAA,EACnD,YACkB,SAChB;AACK;AAFW,SAAA,UAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"VersionCommand.cjs","sources":["../../../../../../packages/cli/src/commands/misc/VersionCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration } from '@contember/cli-common'\n\nexport class VersionCommand extends Command<{}, {}> {\n\tconstructor(\n\t\tprivate readonly version: string,\n\t) {\n\t\tsuper()\n\t}\n\tprotected configure(configuration: CommandConfiguration<{}, {}>): void {\n\t\tconfiguration.description('Prints Contember CLI version')\n\t}\n\n\tprotected async execute(): Promise<void | number> {\n\t\tconsole.log(this.version)\n\t\treturn 0\n\t}\n}\n"],"names":["Command"],"mappings":";;;AAEO,MAAM,uBAAuBA,UAAAA,QAAgB;AAAA,EACnD,YACkB,SAChB;AACK,UAAA;AAFW,SAAA,UAAA;AAAA,EAAA;AAAA,EAIR,UAAU,eAAmD;AACtE,kBAAc,YAAY,8BAA8B;AAAA,EAAA;AAAA,EAGzD,MAAgB,UAAkC;AACzC,YAAA,IAAI,KAAK,OAAO;AACjB,WAAA;AAAA,EAAA;AAET;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VersionCommand.js","sources":["../../../../../../packages/cli/src/commands/misc/VersionCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration } from '@contember/cli-common'\n\nexport class VersionCommand extends Command<{}, {}> {\n\tconstructor(\n\t\tprivate readonly version: string,\n\t) {\n\t\tsuper()\n\t}\n\tprotected configure(configuration: CommandConfiguration<{}, {}>): void {\n\t\tconfiguration.description('Prints Contember CLI version')\n\t}\n\n\tprotected async execute(): Promise<void | number> {\n\t\tconsole.log(this.version)\n\t\treturn 0\n\t}\n}\n"],"names":[],"mappings":";AAEO,MAAM,uBAAuB,QAAgB;AAAA,EACnD,YACkB,SAChB;AACK;AAFW,SAAA,UAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"VersionCommand.js","sources":["../../../../../../packages/cli/src/commands/misc/VersionCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration } from '@contember/cli-common'\n\nexport class VersionCommand extends Command<{}, {}> {\n\tconstructor(\n\t\tprivate readonly version: string,\n\t) {\n\t\tsuper()\n\t}\n\tprotected configure(configuration: CommandConfiguration<{}, {}>): void {\n\t\tconfiguration.description('Prints Contember CLI version')\n\t}\n\n\tprotected async execute(): Promise<void | number> {\n\t\tconsole.log(this.version)\n\t\treturn 0\n\t}\n}\n"],"names":[],"mappings":";AAEO,MAAM,uBAAuB,QAAgB;AAAA,EACnD,YACkB,SAChB;AACK,UAAA;AAFW,SAAA,UAAA;AAAA,EAAA;AAAA,EAIR,UAAU,eAAmD;AACtE,kBAAc,YAAY,8BAA8B;AAAA,EAAA;AAAA,EAGzD,MAAgB,UAAkC;AACzC,YAAA,IAAI,KAAK,OAAO;AACjB,WAAA;AAAA,EAAA;AAET;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectGenerateDocumentationCommand.cjs","sources":["../../../../../../packages/cli/src/commands/project/ProjectGenerateDocumentationCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { renderProjectInfoHtml } from '../../lib/project/docs/projectDescribe'\nimport { writeFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\n\ntype Args = {\n}\n\ntype Options = {\n\tname?: string\n\toutput?: string\n}\n\nexport class ProjectGenerateDocumentationCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Generates HTML documentation from project schema')\n\t\tconfiguration.option('output').valueRequired().description('file name or \"-\" for stdout')\n\t\tconfiguration.option('name').valueRequired().description('project name (for the title)')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\tif (!validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')) {\n\t\t\treturn 1\n\t\t}\n\t\tconst name = input.getOption('name') ?? 'Contember project'\n\n\t\tconst html = await renderProjectInfoHtml(schema, name)\n\t\tconst output = input.getOption('output') ?? `${name.toLowerCase().replace(/\\s+/g, '-')}.html`\n\t\tif (output === '-') {\n\t\t\tconsole.log(html)\n\t\t} else {\n\t\t\tconsole.log(`Documentation saved to ${output}`)\n\t\t\tawait writeFile(join(process.cwd(), output), html)\n\t\t}\n\n\t\treturn 0\n\t}\n}\n"],"names":["Command","validateSchemaAndPrintErrors","renderProjectInfoHtml","writeFile","join"],"mappings":";;;;;;;AAeO,MAAM,4CAA4CA,UAAAA,QAAuB;AAAA,EAC/E,YACkB,cAChB;AACK;AAFW,SAAA,eAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"ProjectGenerateDocumentationCommand.cjs","sources":["../../../../../../packages/cli/src/commands/project/ProjectGenerateDocumentationCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { renderProjectInfoHtml } from '../../lib/project/docs/projectDescribe'\nimport { writeFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\n\ntype Args = {\n}\n\ntype Options = {\n\tname?: string\n\toutput?: string\n}\n\nexport class ProjectGenerateDocumentationCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Generates HTML documentation from project schema')\n\t\tconfiguration.option('output').valueRequired().description('file name or \"-\" for stdout')\n\t\tconfiguration.option('name').valueRequired().description('project name (for the title)')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\tif (!validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')) {\n\t\t\treturn 1\n\t\t}\n\t\tconst name = input.getOption('name') ?? 'Contember project'\n\n\t\tconst html = await renderProjectInfoHtml(schema, name)\n\t\tconst output = input.getOption('output') ?? `${name.toLowerCase().replace(/\\s+/g, '-')}.html`\n\t\tif (output === '-') {\n\t\t\tconsole.log(html)\n\t\t} else {\n\t\t\tconsole.log(`Documentation saved to ${output}`)\n\t\t\tawait writeFile(join(process.cwd(), output), html)\n\t\t}\n\n\t\treturn 0\n\t}\n}\n"],"names":["Command","validateSchemaAndPrintErrors","renderProjectInfoHtml","writeFile","join"],"mappings":";;;;;;;AAeO,MAAM,4CAA4CA,UAAAA,QAAuB;AAAA,EAC/E,YACkB,cAChB;AACK,UAAA;AAFW,SAAA,eAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,kDAAkD;AAC5E,kBAAc,OAAO,QAAQ,EAAE,cAAc,EAAE,YAAY,6BAA6B;AACxF,kBAAc,OAAO,MAAM,EAAE,cAAc,EAAE,YAAY,8BAA8B;AAAA,EAAA;AAAA,EAGxF,MAAgB,QAAQ,OAA8C;AACrE,UAAM,SAAS,MAAM,KAAK,aAAa,WAAW;AAClD,QAAI,CAACC,uBAAA,6BAA6B,QAAQ,4BAA4B,GAAG;AACjE,aAAA;AAAA,IAAA;AAER,UAAM,OAAO,MAAM,UAAU,MAAM,KAAK;AAExC,UAAM,OAAO,MAAMC,sCAAsB,QAAQ,IAAI;AACrD,UAAM,SAAS,MAAM,UAAU,QAAQ,KAAK,GAAG,KAAK,YAAc,EAAA,QAAQ,QAAQ,GAAG,CAAC;AACtF,QAAI,WAAW,KAAK;AACnB,cAAQ,IAAI,IAAI;AAAA,IAAA,OACV;AACE,cAAA,IAAI,0BAA0B,MAAM,EAAE;AAC9C,YAAMC,GAAAA,UAAUC,UAAAA,KAAK,QAAQ,OAAO,MAAM,GAAG,IAAI;AAAA,IAAA;AAG3C,WAAA;AAAA,EAAA;AAET;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectGenerateDocumentationCommand.js","sources":["../../../../../../packages/cli/src/commands/project/ProjectGenerateDocumentationCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { renderProjectInfoHtml } from '../../lib/project/docs/projectDescribe'\nimport { writeFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\n\ntype Args = {\n}\n\ntype Options = {\n\tname?: string\n\toutput?: string\n}\n\nexport class ProjectGenerateDocumentationCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Generates HTML documentation from project schema')\n\t\tconfiguration.option('output').valueRequired().description('file name or \"-\" for stdout')\n\t\tconfiguration.option('name').valueRequired().description('project name (for the title)')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\tif (!validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')) {\n\t\t\treturn 1\n\t\t}\n\t\tconst name = input.getOption('name') ?? 'Contember project'\n\n\t\tconst html = await renderProjectInfoHtml(schema, name)\n\t\tconst output = input.getOption('output') ?? `${name.toLowerCase().replace(/\\s+/g, '-')}.html`\n\t\tif (output === '-') {\n\t\t\tconsole.log(html)\n\t\t} else {\n\t\t\tconsole.log(`Documentation saved to ${output}`)\n\t\t\tawait writeFile(join(process.cwd(), output), html)\n\t\t}\n\n\t\treturn 0\n\t}\n}\n"],"names":[],"mappings":";;;;;AAeO,MAAM,4CAA4C,QAAuB;AAAA,EAC/E,YACkB,cAChB;AACK;AAFW,SAAA,eAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"ProjectGenerateDocumentationCommand.js","sources":["../../../../../../packages/cli/src/commands/project/ProjectGenerateDocumentationCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { renderProjectInfoHtml } from '../../lib/project/docs/projectDescribe'\nimport { writeFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\n\ntype Args = {\n}\n\ntype Options = {\n\tname?: string\n\toutput?: string\n}\n\nexport class ProjectGenerateDocumentationCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Generates HTML documentation from project schema')\n\t\tconfiguration.option('output').valueRequired().description('file name or \"-\" for stdout')\n\t\tconfiguration.option('name').valueRequired().description('project name (for the title)')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\tif (!validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')) {\n\t\t\treturn 1\n\t\t}\n\t\tconst name = input.getOption('name') ?? 'Contember project'\n\n\t\tconst html = await renderProjectInfoHtml(schema, name)\n\t\tconst output = input.getOption('output') ?? `${name.toLowerCase().replace(/\\s+/g, '-')}.html`\n\t\tif (output === '-') {\n\t\t\tconsole.log(html)\n\t\t} else {\n\t\t\tconsole.log(`Documentation saved to ${output}`)\n\t\t\tawait writeFile(join(process.cwd(), output), html)\n\t\t}\n\n\t\treturn 0\n\t}\n}\n"],"names":[],"mappings":";;;;;AAeO,MAAM,4CAA4C,QAAuB;AAAA,EAC/E,YACkB,cAChB;AACK,UAAA;AAFW,SAAA,eAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,kDAAkD;AAC5E,kBAAc,OAAO,QAAQ,EAAE,cAAc,EAAE,YAAY,6BAA6B;AACxF,kBAAc,OAAO,MAAM,EAAE,cAAc,EAAE,YAAY,8BAA8B;AAAA,EAAA;AAAA,EAGxF,MAAgB,QAAQ,OAA8C;AACrE,UAAM,SAAS,MAAM,KAAK,aAAa,WAAW;AAClD,QAAI,CAAC,6BAA6B,QAAQ,4BAA4B,GAAG;AACjE,aAAA;AAAA,IAAA;AAER,UAAM,OAAO,MAAM,UAAU,MAAM,KAAK;AAExC,UAAM,OAAO,MAAM,sBAAsB,QAAQ,IAAI;AACrD,UAAM,SAAS,MAAM,UAAU,QAAQ,KAAK,GAAG,KAAK,YAAc,EAAA,QAAQ,QAAQ,GAAG,CAAC;AACtF,QAAI,WAAW,KAAK;AACnB,cAAQ,IAAI,IAAI;AAAA,IAAA,OACV;AACE,cAAA,IAAI,0BAA0B,MAAM,EAAE;AAC9C,YAAM,UAAU,KAAK,QAAQ,OAAO,MAAM,GAAG,IAAI;AAAA,IAAA;AAG3C,WAAA;AAAA,EAAA;AAET;"}
|
|
@@ -18,16 +18,27 @@ class ProjectPrintSchemaCommand extends cliCommon.Command {
|
|
|
18
18
|
configuration.option("source").valueRequired().description("migrations|definition");
|
|
19
19
|
configuration.option("role").valueArray();
|
|
20
20
|
configuration.option("normalize").valueNone();
|
|
21
|
+
configuration.option("omit-acl").valueNone();
|
|
22
|
+
configuration.option("omit-validation").valueNone();
|
|
23
|
+
configuration.option("omit-actions").valueNone();
|
|
24
|
+
configuration.option("omit-settings").valueNone();
|
|
21
25
|
}
|
|
22
26
|
async execute(input) {
|
|
23
27
|
const format = input.getOption("format") || "graphql";
|
|
24
28
|
const schema$1 = input.getOption("source") === "migrations" ? await this.schemaVersionBuilder.buildSchema() : await this.schemaLoader.loadSchema();
|
|
25
|
-
|
|
29
|
+
const filteredSchema = {
|
|
30
|
+
model: schema$1.model,
|
|
31
|
+
acl: input.getOption("omit-acl") ? schemaUtils.emptySchema.acl : schema$1.acl,
|
|
32
|
+
validation: input.getOption("omit-validation") ? schemaUtils.emptySchema.validation : schema$1.validation,
|
|
33
|
+
actions: input.getOption("omit-actions") ? schemaUtils.emptySchema.actions : schema$1.actions,
|
|
34
|
+
settings: input.getOption("omit-settings") ? schemaUtils.emptySchema.settings : schema$1.settings
|
|
35
|
+
};
|
|
36
|
+
if (!SchemaValidationHelper.validateSchemaAndPrintErrors(filteredSchema, "Defined schema is invalid:")) {
|
|
26
37
|
return 1;
|
|
27
38
|
}
|
|
28
39
|
const permissionFactory = new engineContentApi.PermissionFactory();
|
|
29
40
|
const inputRoles = input.getOption("role");
|
|
30
|
-
const schemaNormalized = input.getOption("normalize") ? schemaUtils.normalizeSchema(
|
|
41
|
+
const schemaNormalized = input.getOption("normalize") ? schemaUtils.normalizeSchema(filteredSchema) : filteredSchema;
|
|
31
42
|
const permissions = permissionFactory.create(schemaNormalized, inputRoles || ["admin"]);
|
|
32
43
|
const schemaBuilderFactory = new engineContentApi.GraphQlSchemaBuilderFactory();
|
|
33
44
|
const authorizator = new engineContentApi.Authorizator(permissions, schemaNormalized.acl.customPrimary ?? false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectPrintSchemaCommand.cjs","sources":["../../../../../../packages/cli/src/commands/project/ProjectPrintSchemaCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport {\n\tAuthorizator,\n\tEntityRulesResolver,\n\tGraphQlSchemaBuilderFactory,\n\tIntrospectionSchemaDefinitionFactory,\n\tIntrospectionSchemaFactory,\n\tPermissionFactory,\n} from '@contember/engine-content-api'\nimport { printSchema } from 'graphql'\nimport { mergeSchemas } from '@graphql-tools/schema'\nimport { normalizeSchema } from '@contember/schema-utils'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { SchemaVersionBuilder } from '@contember/migrations-client'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\n\ntype Args = {\n}\n\ntype Options = {\n\trole?: string[]\n\tnormalize?: boolean\n\tformat?: 'graphql' | 'introspection' | 'schema'\n\tsource?: 'migrations' | 'definition'\n}\n\nexport class ProjectPrintSchemaCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Prints project schema')\n\t\tconfiguration.option('format').valueRequired().description('graphql|introspection|schema')\n\t\tconfiguration.option('source').valueRequired().description('migrations|definition')\n\t\tconfiguration.option('role').valueArray()\n\t\tconfiguration.option('normalize').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst format = input.getOption('format') || 'graphql'\n\n\n\t\tconst schema = input.getOption('source') === 'migrations'\n\t\t\t? await this.schemaVersionBuilder.buildSchema()\n\t\t\t: await this.schemaLoader.loadSchema()\n\n\t\tif (!validateSchemaAndPrintErrors(
|
|
1
|
+
{"version":3,"file":"ProjectPrintSchemaCommand.cjs","sources":["../../../../../../packages/cli/src/commands/project/ProjectPrintSchemaCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport {\n\tAuthorizator,\n\tEntityRulesResolver,\n\tGraphQlSchemaBuilderFactory,\n\tIntrospectionSchemaDefinitionFactory,\n\tIntrospectionSchemaFactory,\n\tPermissionFactory,\n} from '@contember/engine-content-api'\nimport { printSchema } from 'graphql'\nimport { mergeSchemas } from '@graphql-tools/schema'\nimport { emptySchema, normalizeSchema } from '@contember/schema-utils'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { SchemaVersionBuilder } from '@contember/migrations-client'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\n\ntype Args = {\n}\n\ntype Options = {\n\trole?: string[]\n\tnormalize?: boolean\n\tformat?: 'graphql' | 'introspection' | 'schema'\n\tsource?: 'migrations' | 'definition'\n\t['omit-acl']?: boolean\n\t['omit-validation']?: boolean\n\t['omit-actions']?: boolean\n\t['omit-settings']?: boolean\n}\n\nexport class ProjectPrintSchemaCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Prints project schema')\n\t\tconfiguration.option('format').valueRequired().description('graphql|introspection|schema')\n\t\tconfiguration.option('source').valueRequired().description('migrations|definition')\n\t\tconfiguration.option('role').valueArray()\n\t\tconfiguration.option('normalize').valueNone()\n\t\tconfiguration.option('omit-acl').valueNone()\n\t\tconfiguration.option('omit-validation').valueNone()\n\t\tconfiguration.option('omit-actions').valueNone()\n\t\tconfiguration.option('omit-settings').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst format = input.getOption('format') || 'graphql'\n\n\n\t\tconst schema = input.getOption('source') === 'migrations'\n\t\t\t? await this.schemaVersionBuilder.buildSchema()\n\t\t\t: await this.schemaLoader.loadSchema()\n\n\t\tconst filteredSchema = {\n\t\t\tmodel: schema.model,\n\t\t\tacl: input.getOption('omit-acl') ? emptySchema.acl : schema.acl,\n\t\t\tvalidation: input.getOption('omit-validation') ? emptySchema.validation : schema.validation,\n\t\t\tactions: input.getOption('omit-actions') ? emptySchema.actions : schema.actions,\n\t\t\tsettings: input.getOption('omit-settings') ? emptySchema.settings : schema.settings,\n\t\t}\n\n\t\tif (!validateSchemaAndPrintErrors(filteredSchema, 'Defined schema is invalid:')) {\n\t\t\treturn 1\n\t\t}\n\n\t\tconst permissionFactory = new PermissionFactory()\n\t\tconst inputRoles = input.getOption('role')\n\t\tconst schemaNormalized = input.getOption('normalize') ? normalizeSchema(filteredSchema) : filteredSchema\n\t\tconst permissions = permissionFactory.create(schemaNormalized, inputRoles || ['admin'])\n\t\tconst schemaBuilderFactory = new GraphQlSchemaBuilderFactory()\n\t\tconst authorizator = new Authorizator(permissions, schemaNormalized.acl.customPrimary ?? false)\n\t\tconst introspection = new IntrospectionSchemaFactory(\n\t\t\tschemaNormalized.model,\n\t\t\tnew EntityRulesResolver(schemaNormalized.validation, schemaNormalized.model),\n\t\t\tauthorizator,\n\t\t)\n\n\t\tconst printByLine = (out: string) => {\n\t\t\tout.split('\\n').forEach(line => {\n\t\t\t\tprocess.stdout.write(line + '\\n')\n\t\t\t})\n\t\t}\n\t\tif (format === 'schema') {\n\t\t\tif (inputRoles) {\n\t\t\t\tthrow `--roles option is not supported for \"schema\" format`\n\t\t\t}\n\t\t\tconst jsonString = JSON.stringify(schemaNormalized, null, '\\t')\n\t\t\tprintByLine(jsonString)\n\t\t} else if (format === 'introspection') {\n\t\t\tprintByLine(JSON.stringify(introspection.create(), null, '\\t'))\n\t\t} else if (format === 'graphql') {\n\t\t\tconst contentSchema = schemaBuilderFactory.create(schemaNormalized.model, authorizator).build()\n\t\t\tconst introspectionSchemaFactory = new IntrospectionSchemaDefinitionFactory(introspection)\n\t\t\tconst introspectionSchema = introspectionSchemaFactory.create()\n\t\t\tconst gqlSchema = mergeSchemas({\n\t\t\t\tschemas: [contentSchema, introspectionSchema],\n\t\t\t})\n\t\t\tgqlSchema.description = '' // this enforces schema definition print\n\t\t\tconst printedSchema = printSchema(gqlSchema).replace('\"\"\"\"\"\"\\n', '') // remove empty comment\n\t\t\tprintByLine(printedSchema)\n\t\t} else {\n\t\t\tthrow `Unknown format ${format}`\n\t\t}\n\n\t\treturn 0\n\t}\n}\n"],"names":["Command","schema","emptySchema","validateSchemaAndPrintErrors","PermissionFactory","normalizeSchema","GraphQlSchemaBuilderFactory","Authorizator","IntrospectionSchemaFactory","EntityRulesResolver","IntrospectionSchemaDefinitionFactory","mergeSchemas","printSchema"],"mappings":";;;;;;;;AA8BO,MAAM,kCAAkCA,UAAAA,QAAuB;AAAA,EACrE,YACkB,cACA,sBAChB;AACK,UAAA;AAHW,SAAA,eAAA;AACA,SAAA,uBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,uBAAuB;AACjD,kBAAc,OAAO,QAAQ,EAAE,cAAc,EAAE,YAAY,8BAA8B;AACzF,kBAAc,OAAO,QAAQ,EAAE,cAAc,EAAE,YAAY,uBAAuB;AACpE,kBAAA,OAAO,MAAM,EAAE,WAAW;AAC1B,kBAAA,OAAO,WAAW,EAAE,UAAU;AAC9B,kBAAA,OAAO,UAAU,EAAE,UAAU;AAC7B,kBAAA,OAAO,iBAAiB,EAAE,UAAU;AACpC,kBAAA,OAAO,cAAc,EAAE,UAAU;AACjC,kBAAA,OAAO,eAAe,EAAE,UAAU;AAAA,EAAA;AAAA,EAGjD,MAAgB,QAAQ,OAA8C;AACrE,UAAM,SAAS,MAAM,UAAU,QAAQ,KAAK;AAG5C,UAAMC,WAAS,MAAM,UAAU,QAAQ,MAAM,eAC1C,MAAM,KAAK,qBAAqB,YAAY,IAC5C,MAAM,KAAK,aAAa,WAAW;AAEtC,UAAM,iBAAiB;AAAA,MACtB,OAAOA,SAAO;AAAA,MACd,KAAK,MAAM,UAAU,UAAU,IAAIC,wBAAY,MAAMD,SAAO;AAAA,MAC5D,YAAY,MAAM,UAAU,iBAAiB,IAAIC,wBAAY,aAAaD,SAAO;AAAA,MACjF,SAAS,MAAM,UAAU,cAAc,IAAIC,wBAAY,UAAUD,SAAO;AAAA,MACxE,UAAU,MAAM,UAAU,eAAe,IAAIC,YAAA,YAAY,WAAWD,SAAO;AAAA,IAC5E;AAEA,QAAI,CAACE,uBAAA,6BAA6B,gBAAgB,4BAA4B,GAAG;AACzE,aAAA;AAAA,IAAA;AAGF,UAAA,oBAAoB,IAAIC,mCAAkB;AAC1C,UAAA,aAAa,MAAM,UAAU,MAAM;AACzC,UAAM,mBAAmB,MAAM,UAAU,WAAW,IAAIC,YAAA,gBAAgB,cAAc,IAAI;AAC1F,UAAM,cAAc,kBAAkB,OAAO,kBAAkB,cAAc,CAAC,OAAO,CAAC;AAChF,UAAA,uBAAuB,IAAIC,6CAA4B;AAC7D,UAAM,eAAe,IAAIC,8BAAa,aAAa,iBAAiB,IAAI,iBAAiB,KAAK;AAC9F,UAAM,gBAAgB,IAAIC,iBAAA;AAAA,MACzB,iBAAiB;AAAA,MACjB,IAAIC,iBAAA,oBAAoB,iBAAiB,YAAY,iBAAiB,KAAK;AAAA,MAC3E;AAAA,IACD;AAEM,UAAA,cAAc,CAAC,QAAgB;AACpC,UAAI,MAAM,IAAI,EAAE,QAAQ,CAAQ,SAAA;AACvB,gBAAA,OAAO,MAAM,OAAO,IAAI;AAAA,MAAA,CAChC;AAAA,IACF;AACA,QAAI,WAAW,UAAU;AACxB,UAAI,YAAY;AACT,cAAA;AAAA,MAAA;AAEP,YAAM,aAAa,KAAK,UAAU,kBAAkB,MAAM,GAAI;AAC9D,kBAAY,UAAU;AAAA,IAAA,WACZ,WAAW,iBAAiB;AACtC,kBAAY,KAAK,UAAU,cAAc,UAAU,MAAM,GAAI,CAAC;AAAA,IAAA,WACpD,WAAW,WAAW;AAChC,YAAM,gBAAgB,qBAAqB,OAAO,iBAAiB,OAAO,YAAY,EAAE,MAAM;AACxF,YAAA,6BAA6B,IAAIC,iBAAA,qCAAqC,aAAa;AACnF,YAAA,sBAAsB,2BAA2B,OAAO;AAC9D,YAAM,YAAYC,OAAAA,aAAa;AAAA,QAC9B,SAAS,CAAC,eAAe,mBAAmB;AAAA,MAAA,CAC5C;AACD,gBAAU,cAAc;AACxB,YAAM,gBAAgBC,QAAAA,YAAY,SAAS,EAAE,QAAQ,YAAY,EAAE;AACnE,kBAAY,aAAa;AAAA,IAAA,OACnB;AACN,YAAM,kBAAkB,MAAM;AAAA,IAAA;AAGxB,WAAA;AAAA,EAAA;AAET;;"}
|
|
@@ -2,7 +2,7 @@ import { Command } from "@contember/cli-common";
|
|
|
2
2
|
import { PermissionFactory, GraphQlSchemaBuilderFactory, Authorizator, IntrospectionSchemaFactory, EntityRulesResolver, IntrospectionSchemaDefinitionFactory } from "@contember/engine-content-api";
|
|
3
3
|
import { printSchema } from "graphql";
|
|
4
4
|
import { mergeSchemas } from "@graphql-tools/schema";
|
|
5
|
-
import { normalizeSchema } from "@contember/schema-utils";
|
|
5
|
+
import { emptySchema, normalizeSchema } from "@contember/schema-utils";
|
|
6
6
|
import { validateSchemaAndPrintErrors } from "../../lib/schema/SchemaValidationHelper.js";
|
|
7
7
|
class ProjectPrintSchemaCommand extends Command {
|
|
8
8
|
constructor(schemaLoader, schemaVersionBuilder) {
|
|
@@ -16,16 +16,27 @@ class ProjectPrintSchemaCommand extends Command {
|
|
|
16
16
|
configuration.option("source").valueRequired().description("migrations|definition");
|
|
17
17
|
configuration.option("role").valueArray();
|
|
18
18
|
configuration.option("normalize").valueNone();
|
|
19
|
+
configuration.option("omit-acl").valueNone();
|
|
20
|
+
configuration.option("omit-validation").valueNone();
|
|
21
|
+
configuration.option("omit-actions").valueNone();
|
|
22
|
+
configuration.option("omit-settings").valueNone();
|
|
19
23
|
}
|
|
20
24
|
async execute(input) {
|
|
21
25
|
const format = input.getOption("format") || "graphql";
|
|
22
26
|
const schema = input.getOption("source") === "migrations" ? await this.schemaVersionBuilder.buildSchema() : await this.schemaLoader.loadSchema();
|
|
23
|
-
|
|
27
|
+
const filteredSchema = {
|
|
28
|
+
model: schema.model,
|
|
29
|
+
acl: input.getOption("omit-acl") ? emptySchema.acl : schema.acl,
|
|
30
|
+
validation: input.getOption("omit-validation") ? emptySchema.validation : schema.validation,
|
|
31
|
+
actions: input.getOption("omit-actions") ? emptySchema.actions : schema.actions,
|
|
32
|
+
settings: input.getOption("omit-settings") ? emptySchema.settings : schema.settings
|
|
33
|
+
};
|
|
34
|
+
if (!validateSchemaAndPrintErrors(filteredSchema, "Defined schema is invalid:")) {
|
|
24
35
|
return 1;
|
|
25
36
|
}
|
|
26
37
|
const permissionFactory = new PermissionFactory();
|
|
27
38
|
const inputRoles = input.getOption("role");
|
|
28
|
-
const schemaNormalized = input.getOption("normalize") ? normalizeSchema(
|
|
39
|
+
const schemaNormalized = input.getOption("normalize") ? normalizeSchema(filteredSchema) : filteredSchema;
|
|
29
40
|
const permissions = permissionFactory.create(schemaNormalized, inputRoles || ["admin"]);
|
|
30
41
|
const schemaBuilderFactory = new GraphQlSchemaBuilderFactory();
|
|
31
42
|
const authorizator = new Authorizator(permissions, schemaNormalized.acl.customPrimary ?? false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectPrintSchemaCommand.js","sources":["../../../../../../packages/cli/src/commands/project/ProjectPrintSchemaCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport {\n\tAuthorizator,\n\tEntityRulesResolver,\n\tGraphQlSchemaBuilderFactory,\n\tIntrospectionSchemaDefinitionFactory,\n\tIntrospectionSchemaFactory,\n\tPermissionFactory,\n} from '@contember/engine-content-api'\nimport { printSchema } from 'graphql'\nimport { mergeSchemas } from '@graphql-tools/schema'\nimport { normalizeSchema } from '@contember/schema-utils'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { SchemaVersionBuilder } from '@contember/migrations-client'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\n\ntype Args = {\n}\n\ntype Options = {\n\trole?: string[]\n\tnormalize?: boolean\n\tformat?: 'graphql' | 'introspection' | 'schema'\n\tsource?: 'migrations' | 'definition'\n}\n\nexport class ProjectPrintSchemaCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Prints project schema')\n\t\tconfiguration.option('format').valueRequired().description('graphql|introspection|schema')\n\t\tconfiguration.option('source').valueRequired().description('migrations|definition')\n\t\tconfiguration.option('role').valueArray()\n\t\tconfiguration.option('normalize').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst format = input.getOption('format') || 'graphql'\n\n\n\t\tconst schema = input.getOption('source') === 'migrations'\n\t\t\t? await this.schemaVersionBuilder.buildSchema()\n\t\t\t: await this.schemaLoader.loadSchema()\n\n\t\tif (!validateSchemaAndPrintErrors(
|
|
1
|
+
{"version":3,"file":"ProjectPrintSchemaCommand.js","sources":["../../../../../../packages/cli/src/commands/project/ProjectPrintSchemaCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport {\n\tAuthorizator,\n\tEntityRulesResolver,\n\tGraphQlSchemaBuilderFactory,\n\tIntrospectionSchemaDefinitionFactory,\n\tIntrospectionSchemaFactory,\n\tPermissionFactory,\n} from '@contember/engine-content-api'\nimport { printSchema } from 'graphql'\nimport { mergeSchemas } from '@graphql-tools/schema'\nimport { emptySchema, normalizeSchema } from '@contember/schema-utils'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { SchemaVersionBuilder } from '@contember/migrations-client'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\n\ntype Args = {\n}\n\ntype Options = {\n\trole?: string[]\n\tnormalize?: boolean\n\tformat?: 'graphql' | 'introspection' | 'schema'\n\tsource?: 'migrations' | 'definition'\n\t['omit-acl']?: boolean\n\t['omit-validation']?: boolean\n\t['omit-actions']?: boolean\n\t['omit-settings']?: boolean\n}\n\nexport class ProjectPrintSchemaCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Prints project schema')\n\t\tconfiguration.option('format').valueRequired().description('graphql|introspection|schema')\n\t\tconfiguration.option('source').valueRequired().description('migrations|definition')\n\t\tconfiguration.option('role').valueArray()\n\t\tconfiguration.option('normalize').valueNone()\n\t\tconfiguration.option('omit-acl').valueNone()\n\t\tconfiguration.option('omit-validation').valueNone()\n\t\tconfiguration.option('omit-actions').valueNone()\n\t\tconfiguration.option('omit-settings').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<number> {\n\t\tconst format = input.getOption('format') || 'graphql'\n\n\n\t\tconst schema = input.getOption('source') === 'migrations'\n\t\t\t? await this.schemaVersionBuilder.buildSchema()\n\t\t\t: await this.schemaLoader.loadSchema()\n\n\t\tconst filteredSchema = {\n\t\t\tmodel: schema.model,\n\t\t\tacl: input.getOption('omit-acl') ? emptySchema.acl : schema.acl,\n\t\t\tvalidation: input.getOption('omit-validation') ? emptySchema.validation : schema.validation,\n\t\t\tactions: input.getOption('omit-actions') ? emptySchema.actions : schema.actions,\n\t\t\tsettings: input.getOption('omit-settings') ? emptySchema.settings : schema.settings,\n\t\t}\n\n\t\tif (!validateSchemaAndPrintErrors(filteredSchema, 'Defined schema is invalid:')) {\n\t\t\treturn 1\n\t\t}\n\n\t\tconst permissionFactory = new PermissionFactory()\n\t\tconst inputRoles = input.getOption('role')\n\t\tconst schemaNormalized = input.getOption('normalize') ? normalizeSchema(filteredSchema) : filteredSchema\n\t\tconst permissions = permissionFactory.create(schemaNormalized, inputRoles || ['admin'])\n\t\tconst schemaBuilderFactory = new GraphQlSchemaBuilderFactory()\n\t\tconst authorizator = new Authorizator(permissions, schemaNormalized.acl.customPrimary ?? false)\n\t\tconst introspection = new IntrospectionSchemaFactory(\n\t\t\tschemaNormalized.model,\n\t\t\tnew EntityRulesResolver(schemaNormalized.validation, schemaNormalized.model),\n\t\t\tauthorizator,\n\t\t)\n\n\t\tconst printByLine = (out: string) => {\n\t\t\tout.split('\\n').forEach(line => {\n\t\t\t\tprocess.stdout.write(line + '\\n')\n\t\t\t})\n\t\t}\n\t\tif (format === 'schema') {\n\t\t\tif (inputRoles) {\n\t\t\t\tthrow `--roles option is not supported for \"schema\" format`\n\t\t\t}\n\t\t\tconst jsonString = JSON.stringify(schemaNormalized, null, '\\t')\n\t\t\tprintByLine(jsonString)\n\t\t} else if (format === 'introspection') {\n\t\t\tprintByLine(JSON.stringify(introspection.create(), null, '\\t'))\n\t\t} else if (format === 'graphql') {\n\t\t\tconst contentSchema = schemaBuilderFactory.create(schemaNormalized.model, authorizator).build()\n\t\t\tconst introspectionSchemaFactory = new IntrospectionSchemaDefinitionFactory(introspection)\n\t\t\tconst introspectionSchema = introspectionSchemaFactory.create()\n\t\t\tconst gqlSchema = mergeSchemas({\n\t\t\t\tschemas: [contentSchema, introspectionSchema],\n\t\t\t})\n\t\t\tgqlSchema.description = '' // this enforces schema definition print\n\t\t\tconst printedSchema = printSchema(gqlSchema).replace('\"\"\"\"\"\"\\n', '') // remove empty comment\n\t\t\tprintByLine(printedSchema)\n\t\t} else {\n\t\t\tthrow `Unknown format ${format}`\n\t\t}\n\n\t\treturn 0\n\t}\n}\n"],"names":[],"mappings":";;;;;;AA8BO,MAAM,kCAAkC,QAAuB;AAAA,EACrE,YACkB,cACA,sBAChB;AACK,UAAA;AAHW,SAAA,eAAA;AACA,SAAA,uBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,uBAAuB;AACjD,kBAAc,OAAO,QAAQ,EAAE,cAAc,EAAE,YAAY,8BAA8B;AACzF,kBAAc,OAAO,QAAQ,EAAE,cAAc,EAAE,YAAY,uBAAuB;AACpE,kBAAA,OAAO,MAAM,EAAE,WAAW;AAC1B,kBAAA,OAAO,WAAW,EAAE,UAAU;AAC9B,kBAAA,OAAO,UAAU,EAAE,UAAU;AAC7B,kBAAA,OAAO,iBAAiB,EAAE,UAAU;AACpC,kBAAA,OAAO,cAAc,EAAE,UAAU;AACjC,kBAAA,OAAO,eAAe,EAAE,UAAU;AAAA,EAAA;AAAA,EAGjD,MAAgB,QAAQ,OAA8C;AACrE,UAAM,SAAS,MAAM,UAAU,QAAQ,KAAK;AAG5C,UAAM,SAAS,MAAM,UAAU,QAAQ,MAAM,eAC1C,MAAM,KAAK,qBAAqB,YAAY,IAC5C,MAAM,KAAK,aAAa,WAAW;AAEtC,UAAM,iBAAiB;AAAA,MACtB,OAAO,OAAO;AAAA,MACd,KAAK,MAAM,UAAU,UAAU,IAAI,YAAY,MAAM,OAAO;AAAA,MAC5D,YAAY,MAAM,UAAU,iBAAiB,IAAI,YAAY,aAAa,OAAO;AAAA,MACjF,SAAS,MAAM,UAAU,cAAc,IAAI,YAAY,UAAU,OAAO;AAAA,MACxE,UAAU,MAAM,UAAU,eAAe,IAAI,YAAY,WAAW,OAAO;AAAA,IAC5E;AAEA,QAAI,CAAC,6BAA6B,gBAAgB,4BAA4B,GAAG;AACzE,aAAA;AAAA,IAAA;AAGF,UAAA,oBAAoB,IAAI,kBAAkB;AAC1C,UAAA,aAAa,MAAM,UAAU,MAAM;AACzC,UAAM,mBAAmB,MAAM,UAAU,WAAW,IAAI,gBAAgB,cAAc,IAAI;AAC1F,UAAM,cAAc,kBAAkB,OAAO,kBAAkB,cAAc,CAAC,OAAO,CAAC;AAChF,UAAA,uBAAuB,IAAI,4BAA4B;AAC7D,UAAM,eAAe,IAAI,aAAa,aAAa,iBAAiB,IAAI,iBAAiB,KAAK;AAC9F,UAAM,gBAAgB,IAAI;AAAA,MACzB,iBAAiB;AAAA,MACjB,IAAI,oBAAoB,iBAAiB,YAAY,iBAAiB,KAAK;AAAA,MAC3E;AAAA,IACD;AAEM,UAAA,cAAc,CAAC,QAAgB;AACpC,UAAI,MAAM,IAAI,EAAE,QAAQ,CAAQ,SAAA;AACvB,gBAAA,OAAO,MAAM,OAAO,IAAI;AAAA,MAAA,CAChC;AAAA,IACF;AACA,QAAI,WAAW,UAAU;AACxB,UAAI,YAAY;AACT,cAAA;AAAA,MAAA;AAEP,YAAM,aAAa,KAAK,UAAU,kBAAkB,MAAM,GAAI;AAC9D,kBAAY,UAAU;AAAA,IAAA,WACZ,WAAW,iBAAiB;AACtC,kBAAY,KAAK,UAAU,cAAc,UAAU,MAAM,GAAI,CAAC;AAAA,IAAA,WACpD,WAAW,WAAW;AAChC,YAAM,gBAAgB,qBAAqB,OAAO,iBAAiB,OAAO,YAAY,EAAE,MAAM;AACxF,YAAA,6BAA6B,IAAI,qCAAqC,aAAa;AACnF,YAAA,sBAAsB,2BAA2B,OAAO;AAC9D,YAAM,YAAY,aAAa;AAAA,QAC9B,SAAS,CAAC,eAAe,mBAAmB;AAAA,MAAA,CAC5C;AACD,gBAAU,cAAc;AACxB,YAAM,gBAAgB,YAAY,SAAS,EAAE,QAAQ,YAAY,EAAE;AACnE,kBAAY,aAAa;AAAA,IAAA,OACnB;AACN,YAAM,kBAAkB,MAAM;AAAA,IAAA;AAGxB,WAAA;AAAA,EAAA;AAET;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectValidateCommand.cjs","sources":["../../../../../../packages/cli/src/commands/project/ProjectValidateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration } from '@contember/cli-common'\nimport { emptySchema } from '@contember/schema-utils'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\nimport { MigrationsValidator } from '../../lib/migrations/MigrationsValidator'\nimport { MigrationsResolver, SchemaVersionBuilder } from '@contember/migrations-client'\nimport { SchemaDiffer } from '@contember/schema-migrations'\n\ntype Args = {}\n\ntype Options = {}\n\nexport class ProjectValidateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly migrationValidator: MigrationsValidator,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly schemaDiffer: SchemaDiffer,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Validates project schema')\n\t}\n\n\tprotected async execute(): Promise<number> {\n\t\tlet projectValid = true\n\n\t\tconst migrations = await this.migrationsResolver.getSchemaMigrations()\n\t\tprojectValid = this.migrationValidator.validate(emptySchema, migrations)\n\t\t\t&& projectValid\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\tprojectValid = validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')\n\t\t\t&& projectValid\n\n\t\tconst builtSchema = await this.schemaVersionBuilder.buildSchema()\n\t\tprojectValid = validateSchemaAndPrintErrors(builtSchema, 'Schema built from migrations is invalid:')\n\t\t\t&& projectValid\n\n\t\tif (projectValid) {\n\t\t\tconst diff = await this.schemaDiffer.diffSchemas(builtSchema, schema)\n\t\t\tif (diff.length > 0) {\n\t\t\t\tconsole.log('Migrations are not in sync with a defined schema')\n\t\t\t\tprojectValid = false\n\t\t\t}\n\t\t}\n\n\t\tif (projectValid) {\n\t\t\tconsole.log('Project schema is valid')\n\t\t}\n\n\t\treturn projectValid ? 0 : 1\n\t}\n}\n"],"names":["Command","emptySchema","validateSchemaAndPrintErrors"],"mappings":";;;;;AAYO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,cACA,oBACA,oBACA,cACA,sBAChB;AACK;AANW,SAAA,eAAA;AACA,SAAA,qBAAA;AACA,SAAA,qBAAA;AACA,SAAA,eAAA;AACA,SAAA,uBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"ProjectValidateCommand.cjs","sources":["../../../../../../packages/cli/src/commands/project/ProjectValidateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration } from '@contember/cli-common'\nimport { emptySchema } from '@contember/schema-utils'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\nimport { MigrationsValidator } from '../../lib/migrations/MigrationsValidator'\nimport { MigrationsResolver, SchemaVersionBuilder } from '@contember/migrations-client'\nimport { SchemaDiffer } from '@contember/schema-migrations'\n\ntype Args = {}\n\ntype Options = {}\n\nexport class ProjectValidateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly migrationValidator: MigrationsValidator,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly schemaDiffer: SchemaDiffer,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Validates project schema')\n\t}\n\n\tprotected async execute(): Promise<number> {\n\t\tlet projectValid = true\n\n\t\tconst migrations = await this.migrationsResolver.getSchemaMigrations()\n\t\tprojectValid = this.migrationValidator.validate(emptySchema, migrations)\n\t\t\t&& projectValid\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\tprojectValid = validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')\n\t\t\t&& projectValid\n\n\t\tconst builtSchema = await this.schemaVersionBuilder.buildSchema()\n\t\tprojectValid = validateSchemaAndPrintErrors(builtSchema, 'Schema built from migrations is invalid:')\n\t\t\t&& projectValid\n\n\t\tif (projectValid) {\n\t\t\tconst diff = await this.schemaDiffer.diffSchemas(builtSchema, schema)\n\t\t\tif (diff.length > 0) {\n\t\t\t\tconsole.log('Migrations are not in sync with a defined schema')\n\t\t\t\tprojectValid = false\n\t\t\t}\n\t\t}\n\n\t\tif (projectValid) {\n\t\t\tconsole.log('Project schema is valid')\n\t\t}\n\n\t\treturn projectValid ? 0 : 1\n\t}\n}\n"],"names":["Command","emptySchema","validateSchemaAndPrintErrors"],"mappings":";;;;;AAYO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,cACA,oBACA,oBACA,cACA,sBAChB;AACK,UAAA;AANW,SAAA,eAAA;AACA,SAAA,qBAAA;AACA,SAAA,qBAAA;AACA,SAAA,eAAA;AACA,SAAA,uBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,0BAA0B;AAAA,EAAA;AAAA,EAGrD,MAAgB,UAA2B;AAC1C,QAAI,eAAe;AAEnB,UAAM,aAAa,MAAM,KAAK,mBAAmB,oBAAoB;AACrE,mBAAe,KAAK,mBAAmB,SAASC,YAAA,aAAa,UAAU,KACnE;AAEJ,UAAM,SAAS,MAAM,KAAK,aAAa,WAAW;AACnC,mBAAAC,uBAAA,6BAA6B,QAAQ,4BAA4B,KAC5E;AAEJ,UAAM,cAAc,MAAM,KAAK,qBAAqB,YAAY;AACjD,mBAAAA,uBAAA,6BAA6B,aAAa,0CAA0C,KAC/F;AAEJ,QAAI,cAAc;AACjB,YAAM,OAAO,MAAM,KAAK,aAAa,YAAY,aAAa,MAAM;AAChE,UAAA,KAAK,SAAS,GAAG;AACpB,gBAAQ,IAAI,kDAAkD;AAC/C,uBAAA;AAAA,MAAA;AAAA,IAChB;AAGD,QAAI,cAAc;AACjB,cAAQ,IAAI,yBAAyB;AAAA,IAAA;AAGtC,WAAO,eAAe,IAAI;AAAA,EAAA;AAE5B;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectValidateCommand.js","sources":["../../../../../../packages/cli/src/commands/project/ProjectValidateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration } from '@contember/cli-common'\nimport { emptySchema } from '@contember/schema-utils'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\nimport { MigrationsValidator } from '../../lib/migrations/MigrationsValidator'\nimport { MigrationsResolver, SchemaVersionBuilder } from '@contember/migrations-client'\nimport { SchemaDiffer } from '@contember/schema-migrations'\n\ntype Args = {}\n\ntype Options = {}\n\nexport class ProjectValidateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly migrationValidator: MigrationsValidator,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly schemaDiffer: SchemaDiffer,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Validates project schema')\n\t}\n\n\tprotected async execute(): Promise<number> {\n\t\tlet projectValid = true\n\n\t\tconst migrations = await this.migrationsResolver.getSchemaMigrations()\n\t\tprojectValid = this.migrationValidator.validate(emptySchema, migrations)\n\t\t\t&& projectValid\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\tprojectValid = validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')\n\t\t\t&& projectValid\n\n\t\tconst builtSchema = await this.schemaVersionBuilder.buildSchema()\n\t\tprojectValid = validateSchemaAndPrintErrors(builtSchema, 'Schema built from migrations is invalid:')\n\t\t\t&& projectValid\n\n\t\tif (projectValid) {\n\t\t\tconst diff = await this.schemaDiffer.diffSchemas(builtSchema, schema)\n\t\t\tif (diff.length > 0) {\n\t\t\t\tconsole.log('Migrations are not in sync with a defined schema')\n\t\t\t\tprojectValid = false\n\t\t\t}\n\t\t}\n\n\t\tif (projectValid) {\n\t\t\tconsole.log('Project schema is valid')\n\t\t}\n\n\t\treturn projectValid ? 0 : 1\n\t}\n}\n"],"names":[],"mappings":";;;AAYO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,cACA,oBACA,oBACA,cACA,sBAChB;AACK;AANW,SAAA,eAAA;AACA,SAAA,qBAAA;AACA,SAAA,qBAAA;AACA,SAAA,eAAA;AACA,SAAA,uBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"ProjectValidateCommand.js","sources":["../../../../../../packages/cli/src/commands/project/ProjectValidateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration } from '@contember/cli-common'\nimport { emptySchema } from '@contember/schema-utils'\nimport { SchemaLoader } from '../../lib/schema/SchemaLoader'\nimport { validateSchemaAndPrintErrors } from '../../lib/schema/SchemaValidationHelper'\nimport { MigrationsValidator } from '../../lib/migrations/MigrationsValidator'\nimport { MigrationsResolver, SchemaVersionBuilder } from '@contember/migrations-client'\nimport { SchemaDiffer } from '@contember/schema-migrations'\n\ntype Args = {}\n\ntype Options = {}\n\nexport class ProjectValidateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly schemaLoader: SchemaLoader,\n\t\tprivate readonly migrationValidator: MigrationsValidator,\n\t\tprivate readonly migrationsResolver: MigrationsResolver,\n\t\tprivate readonly schemaDiffer: SchemaDiffer,\n\t\tprivate readonly schemaVersionBuilder: SchemaVersionBuilder,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Validates project schema')\n\t}\n\n\tprotected async execute(): Promise<number> {\n\t\tlet projectValid = true\n\n\t\tconst migrations = await this.migrationsResolver.getSchemaMigrations()\n\t\tprojectValid = this.migrationValidator.validate(emptySchema, migrations)\n\t\t\t&& projectValid\n\n\t\tconst schema = await this.schemaLoader.loadSchema()\n\t\tprojectValid = validateSchemaAndPrintErrors(schema, 'Defined schema is invalid:')\n\t\t\t&& projectValid\n\n\t\tconst builtSchema = await this.schemaVersionBuilder.buildSchema()\n\t\tprojectValid = validateSchemaAndPrintErrors(builtSchema, 'Schema built from migrations is invalid:')\n\t\t\t&& projectValid\n\n\t\tif (projectValid) {\n\t\t\tconst diff = await this.schemaDiffer.diffSchemas(builtSchema, schema)\n\t\t\tif (diff.length > 0) {\n\t\t\t\tconsole.log('Migrations are not in sync with a defined schema')\n\t\t\t\tprojectValid = false\n\t\t\t}\n\t\t}\n\n\t\tif (projectValid) {\n\t\t\tconsole.log('Project schema is valid')\n\t\t}\n\n\t\treturn projectValid ? 0 : 1\n\t}\n}\n"],"names":[],"mappings":";;;AAYO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,cACA,oBACA,oBACA,cACA,sBAChB;AACK,UAAA;AANW,SAAA,eAAA;AACA,SAAA,qBAAA;AACA,SAAA,qBAAA;AACA,SAAA,eAAA;AACA,SAAA,uBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,0BAA0B;AAAA,EAAA;AAAA,EAGrD,MAAgB,UAA2B;AAC1C,QAAI,eAAe;AAEnB,UAAM,aAAa,MAAM,KAAK,mBAAmB,oBAAoB;AACrE,mBAAe,KAAK,mBAAmB,SAAS,aAAa,UAAU,KACnE;AAEJ,UAAM,SAAS,MAAM,KAAK,aAAa,WAAW;AACnC,mBAAA,6BAA6B,QAAQ,4BAA4B,KAC5E;AAEJ,UAAM,cAAc,MAAM,KAAK,qBAAqB,YAAY;AACjD,mBAAA,6BAA6B,aAAa,0CAA0C,KAC/F;AAEJ,QAAI,cAAc;AACjB,YAAM,OAAO,MAAM,KAAK,aAAa,YAAY,aAAa,MAAM;AAChE,UAAA,KAAK,SAAS,GAAG;AACpB,gBAAQ,IAAI,kDAAkD;AAC/C,uBAAA;AAAA,MAAA;AAAA,IAChB;AAGD,QAAI,cAAc;AACjB,cAAQ,IAAI,yBAAyB;AAAA,IAAA;AAGtC,WAAO,eAAe,IAAI;AAAA,EAAA;AAE5B;"}
|
|
@@ -20,6 +20,7 @@ class ExportCommand extends cliCommon.Command {
|
|
|
20
20
|
configuration.option("no-gzip-transfer").valueNone();
|
|
21
21
|
configuration.option("no-gzip-output").valueNone();
|
|
22
22
|
configuration.option("output").valueRequired();
|
|
23
|
+
configuration.option("exclude-table").valueArray();
|
|
23
24
|
}
|
|
24
25
|
async execute(input) {
|
|
25
26
|
const from = input.getArgument("source");
|
|
@@ -38,6 +39,7 @@ class ExportCommand extends cliCommon.Command {
|
|
|
38
39
|
const includeSystem = input.getOption("include-system") === true;
|
|
39
40
|
const response = await this.dataTransferClient.dataExport({
|
|
40
41
|
project,
|
|
42
|
+
excludeTables: input.getOption("exclude-table") ?? [],
|
|
41
43
|
includeSystem,
|
|
42
44
|
gzip: gzipTransfer
|
|
43
45
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportCommand.cjs","sources":["../../../../../../packages/cli/src/commands/transfer/ExportCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { createWriteStream } from 'node:fs'\nimport { maskToken } from '../../lib/maskToken'\nimport { pipeline } from 'node:stream/promises'\nimport { printProgressLine } from '../../lib/transfer/stdio'\nimport { createGunzip, createGzip } from 'node:zlib'\nimport { RemoteProjectResolver } from '../../lib/project/RemoteProjectResolver'\nimport { DataTransferClient } from '../../lib/transfer/DataTransferClient'\n\ntype Args = {\n\tsource?: string\n}\ntype Options = {\n\t'include-system'?: boolean\n\t/** @deprecated */\n\t'no-gzip'?: boolean\n\t'no-gzip-output'?: boolean\n\t'no-gzip-transfer'?: boolean\n\toutput?: string\n}\n\nexport class ExportCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly remoteProjectResolver: RemoteProjectResolver,\n\t\tprivate readonly dataTransferClient: DataTransferClient,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Export data from a project')\n\t\tconfiguration.argument('source').optional()\n\t\tconfiguration.option('include-system').valueNone()\n\t\tconfiguration.option('no-gzip').valueNone().deprecated()\n\t\tconfiguration.option('no-gzip-transfer').valueNone()\n\t\tconfiguration.option('no-gzip-output').valueNone()\n\t\tconfiguration.option('output').valueRequired()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void | number> {\n\t\tconst from = input.getArgument('source')\n\t\tconst project = await this.remoteProjectResolver.resolve(from)\n\t\tif (!project) {\n\t\t\tthrow `Project not defined`\n\t\t}\n\n\t\tconsole.log('')\n\t\tconsole.log('Exporting data from a following project')\n\t\tconsole.log('')\n\t\tconsole.log(`Project name: ${project.name}`)\n\t\tconsole.log(`API URL: ${project.endpoint}`)\n\t\tconsole.log(`Token: ${maskToken(project.token)}`)\n\n\t\tconst gzipOutput = !input.getOption('no-gzip-output') && !input.getOption('no-gzip')\n\t\tconst gzipTransfer = !input.getOption('no-gzip-transfer')\n\n\t\tconst includeSystem = input.getOption('include-system') === true\n\n\t\tconst response = await this.dataTransferClient.dataExport({\n\t\t\tproject,\n\t\t\tincludeSystem,\n\t\t\tgzip: gzipTransfer,\n\t\t})\n\n\t\tlet transferred = 0\n\t\tlet start = Date.now()\n\t\tlet lastMbReported = 0\n\t\tconsole.log('')\n\t\tresponse.on('data', chunk => {\n\t\t\ttransferred += chunk.length\n\t\t\tconst currentMb = Math.floor(transferred / 1024 / 1024)\n\t\t\tif (currentMb > lastMbReported) {\n\t\t\t\tconst durationS = Math.floor((Date.now() - start) / 1000)\n\t\t\t\tprintProgressLine(`transferred ${currentMb} MiB; ${durationS} seconds`)\n\t\t\t\tlastMbReported = currentMb\n\t\t\t}\n\t\t})\n\n\t\tconst fileName = input.getOption('output') ?? `${project.name}.jsonl${gzipOutput ? '.gz' : ''}`\n\t\tconst fileStream = createWriteStream(fileName)\n\n\t\tconst responseStream = gzipOutput === gzipTransfer\n\t\t\t? response\n\t\t\t: response.pipe(gzipOutput ? createGzip() : createGunzip())\n\n\t\tawait pipeline(responseStream, fileStream)\n\n\t\tconsole.log('\\nExport done.')\n\t\tconsole.log(`Data saved to ${fileName}`)\n\t}\n}\n"],"names":["Command","maskToken","printProgressLine","createWriteStream","createGzip","createGunzip","pipeline"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"ExportCommand.cjs","sources":["../../../../../../packages/cli/src/commands/transfer/ExportCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { createWriteStream } from 'node:fs'\nimport { maskToken } from '../../lib/maskToken'\nimport { pipeline } from 'node:stream/promises'\nimport { printProgressLine } from '../../lib/transfer/stdio'\nimport { createGunzip, createGzip } from 'node:zlib'\nimport { RemoteProjectResolver } from '../../lib/project/RemoteProjectResolver'\nimport { DataTransferClient } from '../../lib/transfer/DataTransferClient'\n\ntype Args = {\n\tsource?: string\n}\ntype Options = {\n\t'include-system'?: boolean\n\t/** @deprecated */\n\t'no-gzip'?: boolean\n\t'no-gzip-output'?: boolean\n\t'no-gzip-transfer'?: boolean\n\toutput?: string\n\t'exclude-table'?: string[]\n}\n\nexport class ExportCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly remoteProjectResolver: RemoteProjectResolver,\n\t\tprivate readonly dataTransferClient: DataTransferClient,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Export data from a project')\n\t\tconfiguration.argument('source').optional()\n\t\tconfiguration.option('include-system').valueNone()\n\t\tconfiguration.option('no-gzip').valueNone().deprecated()\n\t\tconfiguration.option('no-gzip-transfer').valueNone()\n\t\tconfiguration.option('no-gzip-output').valueNone()\n\t\tconfiguration.option('output').valueRequired()\n\t\tconfiguration.option('exclude-table').valueArray()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void | number> {\n\t\tconst from = input.getArgument('source')\n\t\tconst project = await this.remoteProjectResolver.resolve(from)\n\t\tif (!project) {\n\t\t\tthrow `Project not defined`\n\t\t}\n\n\t\tconsole.log('')\n\t\tconsole.log('Exporting data from a following project')\n\t\tconsole.log('')\n\t\tconsole.log(`Project name: ${project.name}`)\n\t\tconsole.log(`API URL: ${project.endpoint}`)\n\t\tconsole.log(`Token: ${maskToken(project.token)}`)\n\n\t\tconst gzipOutput = !input.getOption('no-gzip-output') && !input.getOption('no-gzip')\n\t\tconst gzipTransfer = !input.getOption('no-gzip-transfer')\n\n\t\tconst includeSystem = input.getOption('include-system') === true\n\n\t\tconst response = await this.dataTransferClient.dataExport({\n\t\t\tproject,\n\t\t\texcludeTables: input.getOption('exclude-table') ?? [],\n\t\t\tincludeSystem,\n\t\t\tgzip: gzipTransfer,\n\t\t})\n\n\t\tlet transferred = 0\n\t\tlet start = Date.now()\n\t\tlet lastMbReported = 0\n\t\tconsole.log('')\n\t\tresponse.on('data', chunk => {\n\t\t\ttransferred += chunk.length\n\t\t\tconst currentMb = Math.floor(transferred / 1024 / 1024)\n\t\t\tif (currentMb > lastMbReported) {\n\t\t\t\tconst durationS = Math.floor((Date.now() - start) / 1000)\n\t\t\t\tprintProgressLine(`transferred ${currentMb} MiB; ${durationS} seconds`)\n\t\t\t\tlastMbReported = currentMb\n\t\t\t}\n\t\t})\n\n\t\tconst fileName = input.getOption('output') ?? `${project.name}.jsonl${gzipOutput ? '.gz' : ''}`\n\t\tconst fileStream = createWriteStream(fileName)\n\n\t\tconst responseStream = gzipOutput === gzipTransfer\n\t\t\t? response\n\t\t\t: response.pipe(gzipOutput ? createGzip() : createGunzip())\n\n\t\tawait pipeline(responseStream, fileStream)\n\n\t\tconsole.log('\\nExport done.')\n\t\tconsole.log(`Data saved to ${fileName}`)\n\t}\n}\n"],"names":["Command","maskToken","printProgressLine","createWriteStream","createGzip","createGunzip","pipeline"],"mappings":";;;;;;;;AAsBO,MAAM,sBAAsBA,UAAAA,QAAuB;AAAA,EACzD,YACkB,uBACA,oBAChB;AACK,UAAA;AAHW,SAAA,wBAAA;AACA,SAAA,qBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,4BAA4B;AACxC,kBAAA,SAAS,QAAQ,EAAE,SAAS;AAC5B,kBAAA,OAAO,gBAAgB,EAAE,UAAU;AACjD,kBAAc,OAAO,SAAS,EAAE,UAAA,EAAY,WAAW;AACzC,kBAAA,OAAO,kBAAkB,EAAE,UAAU;AACrC,kBAAA,OAAO,gBAAgB,EAAE,UAAU;AACnC,kBAAA,OAAO,QAAQ,EAAE,cAAc;AAC/B,kBAAA,OAAO,eAAe,EAAE,WAAW;AAAA,EAAA;AAAA,EAGlD,MAAgB,QAAQ,OAAqD;AACtE,UAAA,OAAO,MAAM,YAAY,QAAQ;AACvC,UAAM,UAAU,MAAM,KAAK,sBAAsB,QAAQ,IAAI;AAC7D,QAAI,CAAC,SAAS;AACP,YAAA;AAAA,IAAA;AAGP,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,yCAAyC;AACrD,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,iBAAiB,QAAQ,IAAI,EAAE;AAC3C,YAAQ,IAAI,YAAY,QAAQ,QAAQ,EAAE;AAC1C,YAAQ,IAAI,UAAUC,UAAA,UAAU,QAAQ,KAAK,CAAC,EAAE;AAE1C,UAAA,aAAa,CAAC,MAAM,UAAU,gBAAgB,KAAK,CAAC,MAAM,UAAU,SAAS;AACnF,UAAM,eAAe,CAAC,MAAM,UAAU,kBAAkB;AAExD,UAAM,gBAAgB,MAAM,UAAU,gBAAgB,MAAM;AAE5D,UAAM,WAAW,MAAM,KAAK,mBAAmB,WAAW;AAAA,MACzD;AAAA,MACA,eAAe,MAAM,UAAU,eAAe,KAAK,CAAC;AAAA,MACpD;AAAA,MACA,MAAM;AAAA,IAAA,CACN;AAED,QAAI,cAAc;AACd,QAAA,QAAQ,KAAK,IAAI;AACrB,QAAI,iBAAiB;AACrB,YAAQ,IAAI,EAAE;AACL,aAAA,GAAG,QAAQ,CAAS,UAAA;AAC5B,qBAAe,MAAM;AACrB,YAAM,YAAY,KAAK,MAAM,cAAc,OAAO,IAAI;AACtD,UAAI,YAAY,gBAAgB;AAC/B,cAAM,YAAY,KAAK,OAAO,KAAK,IAAI,IAAI,SAAS,GAAI;AACxDC,cAAA,kBAAkB,eAAe,SAAS,SAAS,SAAS,UAAU;AACrD,yBAAA;AAAA,MAAA;AAAA,IAClB,CACA;AAEK,UAAA,WAAW,MAAM,UAAU,QAAQ,KAAK,GAAG,QAAQ,IAAI,SAAS,aAAa,QAAQ,EAAE;AACvF,UAAA,aAAaC,0BAAkB,QAAQ;AAEvC,UAAA,iBAAiB,eAAe,eACnC,WACA,SAAS,KAAK,aAAaC,UAAAA,eAAeC,UAAAA,cAAc;AAErD,UAAAC,SAAA,SAAS,gBAAgB,UAAU;AAEzC,YAAQ,IAAI,gBAAgB;AACpB,YAAA,IAAI,iBAAiB,QAAQ,EAAE;AAAA,EAAA;AAEzC;;"}
|
|
@@ -18,6 +18,7 @@ class ExportCommand extends Command {
|
|
|
18
18
|
configuration.option("no-gzip-transfer").valueNone();
|
|
19
19
|
configuration.option("no-gzip-output").valueNone();
|
|
20
20
|
configuration.option("output").valueRequired();
|
|
21
|
+
configuration.option("exclude-table").valueArray();
|
|
21
22
|
}
|
|
22
23
|
async execute(input) {
|
|
23
24
|
const from = input.getArgument("source");
|
|
@@ -36,6 +37,7 @@ class ExportCommand extends Command {
|
|
|
36
37
|
const includeSystem = input.getOption("include-system") === true;
|
|
37
38
|
const response = await this.dataTransferClient.dataExport({
|
|
38
39
|
project,
|
|
40
|
+
excludeTables: input.getOption("exclude-table") ?? [],
|
|
39
41
|
includeSystem,
|
|
40
42
|
gzip: gzipTransfer
|
|
41
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportCommand.js","sources":["../../../../../../packages/cli/src/commands/transfer/ExportCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { createWriteStream } from 'node:fs'\nimport { maskToken } from '../../lib/maskToken'\nimport { pipeline } from 'node:stream/promises'\nimport { printProgressLine } from '../../lib/transfer/stdio'\nimport { createGunzip, createGzip } from 'node:zlib'\nimport { RemoteProjectResolver } from '../../lib/project/RemoteProjectResolver'\nimport { DataTransferClient } from '../../lib/transfer/DataTransferClient'\n\ntype Args = {\n\tsource?: string\n}\ntype Options = {\n\t'include-system'?: boolean\n\t/** @deprecated */\n\t'no-gzip'?: boolean\n\t'no-gzip-output'?: boolean\n\t'no-gzip-transfer'?: boolean\n\toutput?: string\n}\n\nexport class ExportCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly remoteProjectResolver: RemoteProjectResolver,\n\t\tprivate readonly dataTransferClient: DataTransferClient,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Export data from a project')\n\t\tconfiguration.argument('source').optional()\n\t\tconfiguration.option('include-system').valueNone()\n\t\tconfiguration.option('no-gzip').valueNone().deprecated()\n\t\tconfiguration.option('no-gzip-transfer').valueNone()\n\t\tconfiguration.option('no-gzip-output').valueNone()\n\t\tconfiguration.option('output').valueRequired()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void | number> {\n\t\tconst from = input.getArgument('source')\n\t\tconst project = await this.remoteProjectResolver.resolve(from)\n\t\tif (!project) {\n\t\t\tthrow `Project not defined`\n\t\t}\n\n\t\tconsole.log('')\n\t\tconsole.log('Exporting data from a following project')\n\t\tconsole.log('')\n\t\tconsole.log(`Project name: ${project.name}`)\n\t\tconsole.log(`API URL: ${project.endpoint}`)\n\t\tconsole.log(`Token: ${maskToken(project.token)}`)\n\n\t\tconst gzipOutput = !input.getOption('no-gzip-output') && !input.getOption('no-gzip')\n\t\tconst gzipTransfer = !input.getOption('no-gzip-transfer')\n\n\t\tconst includeSystem = input.getOption('include-system') === true\n\n\t\tconst response = await this.dataTransferClient.dataExport({\n\t\t\tproject,\n\t\t\tincludeSystem,\n\t\t\tgzip: gzipTransfer,\n\t\t})\n\n\t\tlet transferred = 0\n\t\tlet start = Date.now()\n\t\tlet lastMbReported = 0\n\t\tconsole.log('')\n\t\tresponse.on('data', chunk => {\n\t\t\ttransferred += chunk.length\n\t\t\tconst currentMb = Math.floor(transferred / 1024 / 1024)\n\t\t\tif (currentMb > lastMbReported) {\n\t\t\t\tconst durationS = Math.floor((Date.now() - start) / 1000)\n\t\t\t\tprintProgressLine(`transferred ${currentMb} MiB; ${durationS} seconds`)\n\t\t\t\tlastMbReported = currentMb\n\t\t\t}\n\t\t})\n\n\t\tconst fileName = input.getOption('output') ?? `${project.name}.jsonl${gzipOutput ? '.gz' : ''}`\n\t\tconst fileStream = createWriteStream(fileName)\n\n\t\tconst responseStream = gzipOutput === gzipTransfer\n\t\t\t? response\n\t\t\t: response.pipe(gzipOutput ? createGzip() : createGunzip())\n\n\t\tawait pipeline(responseStream, fileStream)\n\n\t\tconsole.log('\\nExport done.')\n\t\tconsole.log(`Data saved to ${fileName}`)\n\t}\n}\n"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"ExportCommand.js","sources":["../../../../../../packages/cli/src/commands/transfer/ExportCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { createWriteStream } from 'node:fs'\nimport { maskToken } from '../../lib/maskToken'\nimport { pipeline } from 'node:stream/promises'\nimport { printProgressLine } from '../../lib/transfer/stdio'\nimport { createGunzip, createGzip } from 'node:zlib'\nimport { RemoteProjectResolver } from '../../lib/project/RemoteProjectResolver'\nimport { DataTransferClient } from '../../lib/transfer/DataTransferClient'\n\ntype Args = {\n\tsource?: string\n}\ntype Options = {\n\t'include-system'?: boolean\n\t/** @deprecated */\n\t'no-gzip'?: boolean\n\t'no-gzip-output'?: boolean\n\t'no-gzip-transfer'?: boolean\n\toutput?: string\n\t'exclude-table'?: string[]\n}\n\nexport class ExportCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly remoteProjectResolver: RemoteProjectResolver,\n\t\tprivate readonly dataTransferClient: DataTransferClient,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Export data from a project')\n\t\tconfiguration.argument('source').optional()\n\t\tconfiguration.option('include-system').valueNone()\n\t\tconfiguration.option('no-gzip').valueNone().deprecated()\n\t\tconfiguration.option('no-gzip-transfer').valueNone()\n\t\tconfiguration.option('no-gzip-output').valueNone()\n\t\tconfiguration.option('output').valueRequired()\n\t\tconfiguration.option('exclude-table').valueArray()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void | number> {\n\t\tconst from = input.getArgument('source')\n\t\tconst project = await this.remoteProjectResolver.resolve(from)\n\t\tif (!project) {\n\t\t\tthrow `Project not defined`\n\t\t}\n\n\t\tconsole.log('')\n\t\tconsole.log('Exporting data from a following project')\n\t\tconsole.log('')\n\t\tconsole.log(`Project name: ${project.name}`)\n\t\tconsole.log(`API URL: ${project.endpoint}`)\n\t\tconsole.log(`Token: ${maskToken(project.token)}`)\n\n\t\tconst gzipOutput = !input.getOption('no-gzip-output') && !input.getOption('no-gzip')\n\t\tconst gzipTransfer = !input.getOption('no-gzip-transfer')\n\n\t\tconst includeSystem = input.getOption('include-system') === true\n\n\t\tconst response = await this.dataTransferClient.dataExport({\n\t\t\tproject,\n\t\t\texcludeTables: input.getOption('exclude-table') ?? [],\n\t\t\tincludeSystem,\n\t\t\tgzip: gzipTransfer,\n\t\t})\n\n\t\tlet transferred = 0\n\t\tlet start = Date.now()\n\t\tlet lastMbReported = 0\n\t\tconsole.log('')\n\t\tresponse.on('data', chunk => {\n\t\t\ttransferred += chunk.length\n\t\t\tconst currentMb = Math.floor(transferred / 1024 / 1024)\n\t\t\tif (currentMb > lastMbReported) {\n\t\t\t\tconst durationS = Math.floor((Date.now() - start) / 1000)\n\t\t\t\tprintProgressLine(`transferred ${currentMb} MiB; ${durationS} seconds`)\n\t\t\t\tlastMbReported = currentMb\n\t\t\t}\n\t\t})\n\n\t\tconst fileName = input.getOption('output') ?? `${project.name}.jsonl${gzipOutput ? '.gz' : ''}`\n\t\tconst fileStream = createWriteStream(fileName)\n\n\t\tconst responseStream = gzipOutput === gzipTransfer\n\t\t\t? response\n\t\t\t: response.pipe(gzipOutput ? createGzip() : createGunzip())\n\n\t\tawait pipeline(responseStream, fileStream)\n\n\t\tconsole.log('\\nExport done.')\n\t\tconsole.log(`Data saved to ${fileName}`)\n\t}\n}\n"],"names":[],"mappings":";;;;;;AAsBO,MAAM,sBAAsB,QAAuB;AAAA,EACzD,YACkB,uBACA,oBAChB;AACK,UAAA;AAHW,SAAA,wBAAA;AACA,SAAA,qBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,4BAA4B;AACxC,kBAAA,SAAS,QAAQ,EAAE,SAAS;AAC5B,kBAAA,OAAO,gBAAgB,EAAE,UAAU;AACjD,kBAAc,OAAO,SAAS,EAAE,UAAA,EAAY,WAAW;AACzC,kBAAA,OAAO,kBAAkB,EAAE,UAAU;AACrC,kBAAA,OAAO,gBAAgB,EAAE,UAAU;AACnC,kBAAA,OAAO,QAAQ,EAAE,cAAc;AAC/B,kBAAA,OAAO,eAAe,EAAE,WAAW;AAAA,EAAA;AAAA,EAGlD,MAAgB,QAAQ,OAAqD;AACtE,UAAA,OAAO,MAAM,YAAY,QAAQ;AACvC,UAAM,UAAU,MAAM,KAAK,sBAAsB,QAAQ,IAAI;AAC7D,QAAI,CAAC,SAAS;AACP,YAAA;AAAA,IAAA;AAGP,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,yCAAyC;AACrD,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,iBAAiB,QAAQ,IAAI,EAAE;AAC3C,YAAQ,IAAI,YAAY,QAAQ,QAAQ,EAAE;AAC1C,YAAQ,IAAI,UAAU,UAAU,QAAQ,KAAK,CAAC,EAAE;AAE1C,UAAA,aAAa,CAAC,MAAM,UAAU,gBAAgB,KAAK,CAAC,MAAM,UAAU,SAAS;AACnF,UAAM,eAAe,CAAC,MAAM,UAAU,kBAAkB;AAExD,UAAM,gBAAgB,MAAM,UAAU,gBAAgB,MAAM;AAE5D,UAAM,WAAW,MAAM,KAAK,mBAAmB,WAAW;AAAA,MACzD;AAAA,MACA,eAAe,MAAM,UAAU,eAAe,KAAK,CAAC;AAAA,MACpD;AAAA,MACA,MAAM;AAAA,IAAA,CACN;AAED,QAAI,cAAc;AACd,QAAA,QAAQ,KAAK,IAAI;AACrB,QAAI,iBAAiB;AACrB,YAAQ,IAAI,EAAE;AACL,aAAA,GAAG,QAAQ,CAAS,UAAA;AAC5B,qBAAe,MAAM;AACrB,YAAM,YAAY,KAAK,MAAM,cAAc,OAAO,IAAI;AACtD,UAAI,YAAY,gBAAgB;AAC/B,cAAM,YAAY,KAAK,OAAO,KAAK,IAAI,IAAI,SAAS,GAAI;AACxD,0BAAkB,eAAe,SAAS,SAAS,SAAS,UAAU;AACrD,yBAAA;AAAA,MAAA;AAAA,IAClB,CACA;AAEK,UAAA,WAAW,MAAM,UAAU,QAAQ,KAAK,GAAG,QAAQ,IAAI,SAAS,aAAa,QAAQ,EAAE;AACvF,UAAA,aAAa,kBAAkB,QAAQ;AAEvC,UAAA,iBAAiB,eAAe,eACnC,WACA,SAAS,KAAK,aAAa,eAAe,cAAc;AAErD,UAAA,SAAS,gBAAgB,UAAU;AAEzC,YAAQ,IAAI,gBAAgB;AACpB,YAAA,IAAI,iBAAiB,QAAQ,EAAE;AAAA,EAAA;AAEzC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImportCommand.cjs","sources":["../../../../../../packages/cli/src/commands/transfer/ImportCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { createReadStream } from 'node:fs'\nimport { createGunzip } from 'node:zlib'\nimport { confirmImport } from './utils'\nimport { maskToken } from '../../lib/maskToken'\nimport { printProgressLine } from '../../lib/transfer/stdio'\nimport { readStream } from '../../lib/stream'\nimport { RemoteProjectResolver } from '../../lib/project/RemoteProjectResolver'\nimport { DataTransferClient } from '../../lib/transfer/DataTransferClient'\n\ntype Args = {\n\tfile: string\n\ttarget?: string\n}\ntype Options = {\n\t'yes': boolean\n\t'no-gzip-transfer'?: boolean\n}\n\nexport class ImportCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly remoteProjectResolver: RemoteProjectResolver,\n\t\tprivate readonly dataTransferClient: DataTransferClient,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Import data into a project')\n\t\tconfiguration.argument('file')\n\t\tconfiguration.argument('target').optional()\n\t\tconfiguration.option('no-gzip-transfer').valueNone()\n\t\tconfiguration.option('yes').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void | number> {\n\t\tconst target = input.getArgument('target')\n\t\tconst project = await this.remoteProjectResolver.resolve(target)\n\t\tif (!project) {\n\t\t\tthrow `Target project not defined`\n\t\t}\n\t\tconsole.log('')\n\t\tconsole.log('Importing data into a following project')\n\t\tconsole.log('')\n\t\tconsole.log(`Project name: ${project.name}`)\n\t\tconsole.log(`API URL: ${project.endpoint}`)\n\t\tconsole.log(`Token: ${maskToken(project.token)}`)\n\t\tconsole.log('')\n\t\tif (!await confirmImport(input)) {\n\t\t\treturn 1\n\t\t}\n\t\tconst file = input.getArgument('file')\n\t\tconst baseInputStream = createReadStream(file)\n\t\tconst stream = (file.endsWith('.gz') ? baseInputStream.pipe(createGunzip()) : baseInputStream)\n\t\tconst gzipTransfer = !input.getOption('no-gzip-transfer')\n\t\tconst response = await this.dataTransferClient.dataImport({\n\t\t\tstream: stream,\n\t\t\tproject,\n\t\t\tprintProgress: printProgressLine,\n\t\t\tgzip: gzipTransfer,\n\t\t})\n\t\tconsole.log('')\n\t\tconst responseData = JSON.parse((await readStream(response)).toString())\n\t\tif (responseData.ok) {\n\t\t\tconsole.log('Import done.')\n\t\t} else {\n\t\t\tconsole.error('Import failed:')\n\t\t\tconsole.log(responseData)\n\t\t}\n\t}\n}\n\n"],"names":["Command","maskToken","confirmImport","createReadStream","stream","createGunzip","printProgressLine","readStream"],"mappings":";;;;;;;;;AAmBO,MAAM,sBAAsBA,UAAAA,QAAuB;AAAA,EACzD,YACkB,uBACA,oBAChB;AACK;AAHW,SAAA,wBAAA;AACA,SAAA,qBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"ImportCommand.cjs","sources":["../../../../../../packages/cli/src/commands/transfer/ImportCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { createReadStream } from 'node:fs'\nimport { createGunzip } from 'node:zlib'\nimport { confirmImport } from './utils'\nimport { maskToken } from '../../lib/maskToken'\nimport { printProgressLine } from '../../lib/transfer/stdio'\nimport { readStream } from '../../lib/stream'\nimport { RemoteProjectResolver } from '../../lib/project/RemoteProjectResolver'\nimport { DataTransferClient } from '../../lib/transfer/DataTransferClient'\n\ntype Args = {\n\tfile: string\n\ttarget?: string\n}\ntype Options = {\n\t'yes': boolean\n\t'no-gzip-transfer'?: boolean\n}\n\nexport class ImportCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly remoteProjectResolver: RemoteProjectResolver,\n\t\tprivate readonly dataTransferClient: DataTransferClient,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Import data into a project')\n\t\tconfiguration.argument('file')\n\t\tconfiguration.argument('target').optional()\n\t\tconfiguration.option('no-gzip-transfer').valueNone()\n\t\tconfiguration.option('yes').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void | number> {\n\t\tconst target = input.getArgument('target')\n\t\tconst project = await this.remoteProjectResolver.resolve(target)\n\t\tif (!project) {\n\t\t\tthrow `Target project not defined`\n\t\t}\n\t\tconsole.log('')\n\t\tconsole.log('Importing data into a following project')\n\t\tconsole.log('')\n\t\tconsole.log(`Project name: ${project.name}`)\n\t\tconsole.log(`API URL: ${project.endpoint}`)\n\t\tconsole.log(`Token: ${maskToken(project.token)}`)\n\t\tconsole.log('')\n\t\tif (!await confirmImport(input)) {\n\t\t\treturn 1\n\t\t}\n\t\tconst file = input.getArgument('file')\n\t\tconst baseInputStream = createReadStream(file)\n\t\tconst stream = (file.endsWith('.gz') ? baseInputStream.pipe(createGunzip()) : baseInputStream)\n\t\tconst gzipTransfer = !input.getOption('no-gzip-transfer')\n\t\tconst response = await this.dataTransferClient.dataImport({\n\t\t\tstream: stream,\n\t\t\tproject,\n\t\t\tprintProgress: printProgressLine,\n\t\t\tgzip: gzipTransfer,\n\t\t})\n\t\tconsole.log('')\n\t\tconst responseData = JSON.parse((await readStream(response)).toString())\n\t\tif (responseData.ok) {\n\t\t\tconsole.log('Import done.')\n\t\t} else {\n\t\t\tconsole.error('Import failed:')\n\t\t\tconsole.log(responseData)\n\t\t}\n\t}\n}\n\n"],"names":["Command","maskToken","confirmImport","createReadStream","stream","createGunzip","printProgressLine","readStream"],"mappings":";;;;;;;;;AAmBO,MAAM,sBAAsBA,UAAAA,QAAuB;AAAA,EACzD,YACkB,uBACA,oBAChB;AACK,UAAA;AAHW,SAAA,wBAAA;AACA,SAAA,qBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,4BAA4B;AACtD,kBAAc,SAAS,MAAM;AACf,kBAAA,SAAS,QAAQ,EAAE,SAAS;AAC5B,kBAAA,OAAO,kBAAkB,EAAE,UAAU;AACrC,kBAAA,OAAO,KAAK,EAAE,UAAU;AAAA,EAAA;AAAA,EAGvC,MAAgB,QAAQ,OAAqD;AACtE,UAAA,SAAS,MAAM,YAAY,QAAQ;AACzC,UAAM,UAAU,MAAM,KAAK,sBAAsB,QAAQ,MAAM;AAC/D,QAAI,CAAC,SAAS;AACP,YAAA;AAAA,IAAA;AAEP,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,yCAAyC;AACrD,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,iBAAiB,QAAQ,IAAI,EAAE;AAC3C,YAAQ,IAAI,YAAY,QAAQ,QAAQ,EAAE;AAC1C,YAAQ,IAAI,UAAUC,UAAA,UAAU,QAAQ,KAAK,CAAC,EAAE;AAChD,YAAQ,IAAI,EAAE;AACd,QAAI,CAAC,MAAMC,oBAAc,KAAK,GAAG;AACzB,aAAA;AAAA,IAAA;AAEF,UAAA,OAAO,MAAM,YAAY,MAAM;AAC/B,UAAA,kBAAkBC,yBAAiB,IAAI;AACvC,UAAAC,WAAU,KAAK,SAAS,KAAK,IAAI,gBAAgB,KAAKC,uBAAc,CAAA,IAAI;AAC9E,UAAM,eAAe,CAAC,MAAM,UAAU,kBAAkB;AACxD,UAAM,WAAW,MAAM,KAAK,mBAAmB,WAAW;AAAA,MAAA,QACzDD;AAAAA,MACA;AAAA,MACA,eAAeE,MAAA;AAAA,MACf,MAAM;AAAA,IAAA,CACN;AACD,YAAQ,IAAI,EAAE;AACR,UAAA,eAAe,KAAK,OAAO,MAAMC,OAAAA,WAAW,QAAQ,GAAG,UAAU;AACvE,QAAI,aAAa,IAAI;AACpB,cAAQ,IAAI,cAAc;AAAA,IAAA,OACpB;AACN,cAAQ,MAAM,gBAAgB;AAC9B,cAAQ,IAAI,YAAY;AAAA,IAAA;AAAA,EACzB;AAEF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImportCommand.js","sources":["../../../../../../packages/cli/src/commands/transfer/ImportCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { createReadStream } from 'node:fs'\nimport { createGunzip } from 'node:zlib'\nimport { confirmImport } from './utils'\nimport { maskToken } from '../../lib/maskToken'\nimport { printProgressLine } from '../../lib/transfer/stdio'\nimport { readStream } from '../../lib/stream'\nimport { RemoteProjectResolver } from '../../lib/project/RemoteProjectResolver'\nimport { DataTransferClient } from '../../lib/transfer/DataTransferClient'\n\ntype Args = {\n\tfile: string\n\ttarget?: string\n}\ntype Options = {\n\t'yes': boolean\n\t'no-gzip-transfer'?: boolean\n}\n\nexport class ImportCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly remoteProjectResolver: RemoteProjectResolver,\n\t\tprivate readonly dataTransferClient: DataTransferClient,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Import data into a project')\n\t\tconfiguration.argument('file')\n\t\tconfiguration.argument('target').optional()\n\t\tconfiguration.option('no-gzip-transfer').valueNone()\n\t\tconfiguration.option('yes').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void | number> {\n\t\tconst target = input.getArgument('target')\n\t\tconst project = await this.remoteProjectResolver.resolve(target)\n\t\tif (!project) {\n\t\t\tthrow `Target project not defined`\n\t\t}\n\t\tconsole.log('')\n\t\tconsole.log('Importing data into a following project')\n\t\tconsole.log('')\n\t\tconsole.log(`Project name: ${project.name}`)\n\t\tconsole.log(`API URL: ${project.endpoint}`)\n\t\tconsole.log(`Token: ${maskToken(project.token)}`)\n\t\tconsole.log('')\n\t\tif (!await confirmImport(input)) {\n\t\t\treturn 1\n\t\t}\n\t\tconst file = input.getArgument('file')\n\t\tconst baseInputStream = createReadStream(file)\n\t\tconst stream = (file.endsWith('.gz') ? baseInputStream.pipe(createGunzip()) : baseInputStream)\n\t\tconst gzipTransfer = !input.getOption('no-gzip-transfer')\n\t\tconst response = await this.dataTransferClient.dataImport({\n\t\t\tstream: stream,\n\t\t\tproject,\n\t\t\tprintProgress: printProgressLine,\n\t\t\tgzip: gzipTransfer,\n\t\t})\n\t\tconsole.log('')\n\t\tconst responseData = JSON.parse((await readStream(response)).toString())\n\t\tif (responseData.ok) {\n\t\t\tconsole.log('Import done.')\n\t\t} else {\n\t\t\tconsole.error('Import failed:')\n\t\t\tconsole.log(responseData)\n\t\t}\n\t}\n}\n\n"],"names":[],"mappings":";;;;;;;AAmBO,MAAM,sBAAsB,QAAuB;AAAA,EACzD,YACkB,uBACA,oBAChB;AACK;AAHW,SAAA,wBAAA;AACA,SAAA,qBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"ImportCommand.js","sources":["../../../../../../packages/cli/src/commands/transfer/ImportCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { createReadStream } from 'node:fs'\nimport { createGunzip } from 'node:zlib'\nimport { confirmImport } from './utils'\nimport { maskToken } from '../../lib/maskToken'\nimport { printProgressLine } from '../../lib/transfer/stdio'\nimport { readStream } from '../../lib/stream'\nimport { RemoteProjectResolver } from '../../lib/project/RemoteProjectResolver'\nimport { DataTransferClient } from '../../lib/transfer/DataTransferClient'\n\ntype Args = {\n\tfile: string\n\ttarget?: string\n}\ntype Options = {\n\t'yes': boolean\n\t'no-gzip-transfer'?: boolean\n}\n\nexport class ImportCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly remoteProjectResolver: RemoteProjectResolver,\n\t\tprivate readonly dataTransferClient: DataTransferClient,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Import data into a project')\n\t\tconfiguration.argument('file')\n\t\tconfiguration.argument('target').optional()\n\t\tconfiguration.option('no-gzip-transfer').valueNone()\n\t\tconfiguration.option('yes').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void | number> {\n\t\tconst target = input.getArgument('target')\n\t\tconst project = await this.remoteProjectResolver.resolve(target)\n\t\tif (!project) {\n\t\t\tthrow `Target project not defined`\n\t\t}\n\t\tconsole.log('')\n\t\tconsole.log('Importing data into a following project')\n\t\tconsole.log('')\n\t\tconsole.log(`Project name: ${project.name}`)\n\t\tconsole.log(`API URL: ${project.endpoint}`)\n\t\tconsole.log(`Token: ${maskToken(project.token)}`)\n\t\tconsole.log('')\n\t\tif (!await confirmImport(input)) {\n\t\t\treturn 1\n\t\t}\n\t\tconst file = input.getArgument('file')\n\t\tconst baseInputStream = createReadStream(file)\n\t\tconst stream = (file.endsWith('.gz') ? baseInputStream.pipe(createGunzip()) : baseInputStream)\n\t\tconst gzipTransfer = !input.getOption('no-gzip-transfer')\n\t\tconst response = await this.dataTransferClient.dataImport({\n\t\t\tstream: stream,\n\t\t\tproject,\n\t\t\tprintProgress: printProgressLine,\n\t\t\tgzip: gzipTransfer,\n\t\t})\n\t\tconsole.log('')\n\t\tconst responseData = JSON.parse((await readStream(response)).toString())\n\t\tif (responseData.ok) {\n\t\t\tconsole.log('Import done.')\n\t\t} else {\n\t\t\tconsole.error('Import failed:')\n\t\t\tconsole.log(responseData)\n\t\t}\n\t}\n}\n\n"],"names":[],"mappings":";;;;;;;AAmBO,MAAM,sBAAsB,QAAuB;AAAA,EACzD,YACkB,uBACA,oBAChB;AACK,UAAA;AAHW,SAAA,wBAAA;AACA,SAAA,qBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,4BAA4B;AACtD,kBAAc,SAAS,MAAM;AACf,kBAAA,SAAS,QAAQ,EAAE,SAAS;AAC5B,kBAAA,OAAO,kBAAkB,EAAE,UAAU;AACrC,kBAAA,OAAO,KAAK,EAAE,UAAU;AAAA,EAAA;AAAA,EAGvC,MAAgB,QAAQ,OAAqD;AACtE,UAAA,SAAS,MAAM,YAAY,QAAQ;AACzC,UAAM,UAAU,MAAM,KAAK,sBAAsB,QAAQ,MAAM;AAC/D,QAAI,CAAC,SAAS;AACP,YAAA;AAAA,IAAA;AAEP,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,yCAAyC;AACrD,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,iBAAiB,QAAQ,IAAI,EAAE;AAC3C,YAAQ,IAAI,YAAY,QAAQ,QAAQ,EAAE;AAC1C,YAAQ,IAAI,UAAU,UAAU,QAAQ,KAAK,CAAC,EAAE;AAChD,YAAQ,IAAI,EAAE;AACd,QAAI,CAAC,MAAM,cAAc,KAAK,GAAG;AACzB,aAAA;AAAA,IAAA;AAEF,UAAA,OAAO,MAAM,YAAY,MAAM;AAC/B,UAAA,kBAAkB,iBAAiB,IAAI;AACvC,UAAA,SAAU,KAAK,SAAS,KAAK,IAAI,gBAAgB,KAAK,aAAc,CAAA,IAAI;AAC9E,UAAM,eAAe,CAAC,MAAM,UAAU,kBAAkB;AACxD,UAAM,WAAW,MAAM,KAAK,mBAAmB,WAAW;AAAA,MACzD;AAAA,MACA;AAAA,MACA,eAAe;AAAA,MACf,MAAM;AAAA,IAAA,CACN;AACD,YAAQ,IAAI,EAAE;AACR,UAAA,eAAe,KAAK,OAAO,MAAM,WAAW,QAAQ,GAAG,UAAU;AACvE,QAAI,aAAa,IAAI;AACpB,cAAQ,IAAI,cAAc;AAAA,IAAA,OACpB;AACN,cAAQ,MAAM,gBAAgB;AAC9B,cAAQ,IAAI,YAAY;AAAA,IAAA;AAAA,EACzB;AAEF;"}
|
|
@@ -19,6 +19,7 @@ class TransferCommand extends cliCommon.Command {
|
|
|
19
19
|
configuration.option("include-system").valueNone();
|
|
20
20
|
configuration.option("no-gzip-transfer").valueNone();
|
|
21
21
|
configuration.option("yes").valueNone();
|
|
22
|
+
configuration.option("exclude-table").valueArray();
|
|
22
23
|
}
|
|
23
24
|
async execute(input) {
|
|
24
25
|
const source = input.getArgument("source");
|
|
@@ -50,6 +51,7 @@ class TransferCommand extends cliCommon.Command {
|
|
|
50
51
|
const exportResponse = await this.dataTransferClient.dataExport({
|
|
51
52
|
project: sourceProject,
|
|
52
53
|
includeSystem,
|
|
54
|
+
excludeTables: input.getOption("exclude-table") ?? [],
|
|
53
55
|
gzip: gzipTransfer
|
|
54
56
|
});
|
|
55
57
|
const ungzipedResponse = gzipTransfer ? exportResponse.pipe(node_zlib.createGunzip()) : exportResponse;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransferCommand.cjs","sources":["../../../../../../packages/cli/src/commands/transfer/TransferCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { confirmImport } from './utils'\nimport { maskToken } from '../../lib/maskToken'\nimport { printProgressLine } from '../../lib/transfer/stdio'\nimport { readStream } from '../../lib/stream'\nimport { createGunzip } from 'node:zlib'\nimport { RemoteProjectResolver } from '../../lib/project/RemoteProjectResolver'\nimport { DataTransferClient } from '../../lib/transfer/DataTransferClient'\n\ntype Args = {\n\tsource: string\n\ttarget: string\n}\ntype Options = {\n\t'include-system'?: boolean\n\t'no-gzip-transfer'?: boolean\n\tyes: boolean\n}\n\nexport class TransferCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly remoteProjectResolver: RemoteProjectResolver,\n\t\tprivate readonly dataTransferClient: DataTransferClient,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Transfer data between projects')\n\t\tconfiguration.argument('source')\n\t\tconfiguration.argument('target').optional()\n\t\tconfiguration.option('include-system').valueNone()\n\t\tconfiguration.option('no-gzip-transfer').valueNone()\n\t\tconfiguration.option('yes').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void | number> {\n\t\tconst source = input.getArgument('source')\n\t\tconst sourceProject = await this.remoteProjectResolver.resolve(source)\n\t\tif (!sourceProject) {\n\t\t\tthrow `Source project not defined`\n\t\t}\n\n\t\tconst target = input.getArgument('target')\n\t\tconst targetProject = await this.remoteProjectResolver.resolve(target)\n\t\tif (!targetProject) {\n\t\t\tthrow `Target project not defined`\n\t\t}\n\n\n\t\tconsole.log('')\n\t\tconsole.log('Transferring data between projects:')\n\t\tconsole.log('')\n\t\tconsole.log(`Source project name: ${sourceProject.name}`)\n\t\tconsole.log(`Source API URL: ${sourceProject.endpoint}`)\n\t\tconsole.log(`Source token: ${maskToken(sourceProject.token)}`)\n\t\tconsole.log('')\n\t\tconsole.log(`Target project name: ${targetProject.name}`)\n\t\tconsole.log(`Target API URL: ${targetProject.endpoint}`)\n\t\tconsole.log(`Target token: ${maskToken(targetProject.token)}`)\n\t\tconsole.log('')\n\t\tif (!await confirmImport(input)) {\n\t\t\treturn 1\n\t\t}\n\n\t\tconst includeSystem = input.getOption('include-system') === true\n\t\tconst gzipTransfer = !input.getOption('no-gzip-transfer')\n\t\tconst exportResponse = (await this.dataTransferClient.dataExport({\n\t\t\tproject: sourceProject,\n\t\t\tincludeSystem,\n\t\t\tgzip: gzipTransfer,\n\t\t}))\n\t\tconst ungzipedResponse = gzipTransfer ? exportResponse.pipe(createGunzip()) : exportResponse\n\t\tconst importResponse = await this.dataTransferClient.dataImport({\n\t\t\tstream: ungzipedResponse,\n\t\t\tproject: targetProject,\n\t\t\tprintProgress: printProgressLine,\n\t\t\tgzip: gzipTransfer,\n\t\t})\n\t\tconsole.log('')\n\n\t\tconst responseData = JSON.parse((await readStream(importResponse)).toString())\n\t\tif (responseData.ok) {\n\t\t\tconsole.log('Transfer done.')\n\t\t} else {\n\t\t\tconsole.error('Transfer failed:')\n\t\t\tconsole.log(responseData)\n\t\t}\n\t}\n}\n"],"names":["Command","maskToken","confirmImport","createGunzip","printProgressLine","readStream"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"TransferCommand.cjs","sources":["../../../../../../packages/cli/src/commands/transfer/TransferCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { confirmImport } from './utils'\nimport { maskToken } from '../../lib/maskToken'\nimport { printProgressLine } from '../../lib/transfer/stdio'\nimport { readStream } from '../../lib/stream'\nimport { createGunzip } from 'node:zlib'\nimport { RemoteProjectResolver } from '../../lib/project/RemoteProjectResolver'\nimport { DataTransferClient } from '../../lib/transfer/DataTransferClient'\n\ntype Args = {\n\tsource: string\n\ttarget: string\n}\ntype Options = {\n\t'include-system'?: boolean\n\t'no-gzip-transfer'?: boolean\n\tyes: boolean\n\t'exclude-table'?: string[]\n}\n\nexport class TransferCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly remoteProjectResolver: RemoteProjectResolver,\n\t\tprivate readonly dataTransferClient: DataTransferClient,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Transfer data between projects')\n\t\tconfiguration.argument('source')\n\t\tconfiguration.argument('target').optional()\n\t\tconfiguration.option('include-system').valueNone()\n\t\tconfiguration.option('no-gzip-transfer').valueNone()\n\t\tconfiguration.option('yes').valueNone()\n\t\tconfiguration.option('exclude-table').valueArray()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void | number> {\n\t\tconst source = input.getArgument('source')\n\t\tconst sourceProject = await this.remoteProjectResolver.resolve(source)\n\t\tif (!sourceProject) {\n\t\t\tthrow `Source project not defined`\n\t\t}\n\n\t\tconst target = input.getArgument('target')\n\t\tconst targetProject = await this.remoteProjectResolver.resolve(target)\n\t\tif (!targetProject) {\n\t\t\tthrow `Target project not defined`\n\t\t}\n\n\n\t\tconsole.log('')\n\t\tconsole.log('Transferring data between projects:')\n\t\tconsole.log('')\n\t\tconsole.log(`Source project name: ${sourceProject.name}`)\n\t\tconsole.log(`Source API URL: ${sourceProject.endpoint}`)\n\t\tconsole.log(`Source token: ${maskToken(sourceProject.token)}`)\n\t\tconsole.log('')\n\t\tconsole.log(`Target project name: ${targetProject.name}`)\n\t\tconsole.log(`Target API URL: ${targetProject.endpoint}`)\n\t\tconsole.log(`Target token: ${maskToken(targetProject.token)}`)\n\t\tconsole.log('')\n\t\tif (!await confirmImport(input)) {\n\t\t\treturn 1\n\t\t}\n\n\t\tconst includeSystem = input.getOption('include-system') === true\n\t\tconst gzipTransfer = !input.getOption('no-gzip-transfer')\n\t\tconst exportResponse = (await this.dataTransferClient.dataExport({\n\t\t\tproject: sourceProject,\n\t\t\tincludeSystem,\n\t\t\texcludeTables: input.getOption('exclude-table') ?? [],\n\t\t\tgzip: gzipTransfer,\n\t\t}))\n\t\tconst ungzipedResponse = gzipTransfer ? exportResponse.pipe(createGunzip()) : exportResponse\n\t\tconst importResponse = await this.dataTransferClient.dataImport({\n\t\t\tstream: ungzipedResponse,\n\t\t\tproject: targetProject,\n\t\t\tprintProgress: printProgressLine,\n\t\t\tgzip: gzipTransfer,\n\t\t})\n\t\tconsole.log('')\n\n\t\tconst responseData = JSON.parse((await readStream(importResponse)).toString())\n\t\tif (responseData.ok) {\n\t\t\tconsole.log('Transfer done.')\n\t\t} else {\n\t\t\tconsole.error('Transfer failed:')\n\t\t\tconsole.log(responseData)\n\t\t}\n\t}\n}\n"],"names":["Command","maskToken","confirmImport","createGunzip","printProgressLine","readStream"],"mappings":";;;;;;;;AAoBO,MAAM,wBAAwBA,UAAAA,QAAuB;AAAA,EAC3D,YACkB,uBACA,oBAChB;AACK,UAAA;AAHW,SAAA,wBAAA;AACA,SAAA,qBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,gCAAgC;AAC1D,kBAAc,SAAS,QAAQ;AACjB,kBAAA,SAAS,QAAQ,EAAE,SAAS;AAC5B,kBAAA,OAAO,gBAAgB,EAAE,UAAU;AACnC,kBAAA,OAAO,kBAAkB,EAAE,UAAU;AACrC,kBAAA,OAAO,KAAK,EAAE,UAAU;AACxB,kBAAA,OAAO,eAAe,EAAE,WAAW;AAAA,EAAA;AAAA,EAGlD,MAAgB,QAAQ,OAAqD;AACtE,UAAA,SAAS,MAAM,YAAY,QAAQ;AACzC,UAAM,gBAAgB,MAAM,KAAK,sBAAsB,QAAQ,MAAM;AACrE,QAAI,CAAC,eAAe;AACb,YAAA;AAAA,IAAA;AAGD,UAAA,SAAS,MAAM,YAAY,QAAQ;AACzC,UAAM,gBAAgB,MAAM,KAAK,sBAAsB,QAAQ,MAAM;AACrE,QAAI,CAAC,eAAe;AACb,YAAA;AAAA,IAAA;AAIP,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,qCAAqC;AACjD,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,wBAAwB,cAAc,IAAI,EAAE;AACxD,YAAQ,IAAI,mBAAmB,cAAc,QAAQ,EAAE;AACvD,YAAQ,IAAI,iBAAiBC,UAAA,UAAU,cAAc,KAAK,CAAC,EAAE;AAC7D,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,wBAAwB,cAAc,IAAI,EAAE;AACxD,YAAQ,IAAI,mBAAmB,cAAc,QAAQ,EAAE;AACvD,YAAQ,IAAI,iBAAiBA,UAAA,UAAU,cAAc,KAAK,CAAC,EAAE;AAC7D,YAAQ,IAAI,EAAE;AACd,QAAI,CAAC,MAAMC,oBAAc,KAAK,GAAG;AACzB,aAAA;AAAA,IAAA;AAGR,UAAM,gBAAgB,MAAM,UAAU,gBAAgB,MAAM;AAC5D,UAAM,eAAe,CAAC,MAAM,UAAU,kBAAkB;AACxD,UAAM,iBAAkB,MAAM,KAAK,mBAAmB,WAAW;AAAA,MAChE,SAAS;AAAA,MACT;AAAA,MACA,eAAe,MAAM,UAAU,eAAe,KAAK,CAAC;AAAA,MACpD,MAAM;AAAA,IAAA,CACN;AACD,UAAM,mBAAmB,eAAe,eAAe,KAAKC,UAAAA,aAAc,CAAA,IAAI;AAC9E,UAAM,iBAAiB,MAAM,KAAK,mBAAmB,WAAW;AAAA,MAC/D,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,eAAeC,MAAA;AAAA,MACf,MAAM;AAAA,IAAA,CACN;AACD,YAAQ,IAAI,EAAE;AAER,UAAA,eAAe,KAAK,OAAO,MAAMC,OAAAA,WAAW,cAAc,GAAG,UAAU;AAC7E,QAAI,aAAa,IAAI;AACpB,cAAQ,IAAI,gBAAgB;AAAA,IAAA,OACtB;AACN,cAAQ,MAAM,kBAAkB;AAChC,cAAQ,IAAI,YAAY;AAAA,IAAA;AAAA,EACzB;AAEF;;"}
|
|
@@ -17,6 +17,7 @@ class TransferCommand extends Command {
|
|
|
17
17
|
configuration.option("include-system").valueNone();
|
|
18
18
|
configuration.option("no-gzip-transfer").valueNone();
|
|
19
19
|
configuration.option("yes").valueNone();
|
|
20
|
+
configuration.option("exclude-table").valueArray();
|
|
20
21
|
}
|
|
21
22
|
async execute(input) {
|
|
22
23
|
const source = input.getArgument("source");
|
|
@@ -48,6 +49,7 @@ class TransferCommand extends Command {
|
|
|
48
49
|
const exportResponse = await this.dataTransferClient.dataExport({
|
|
49
50
|
project: sourceProject,
|
|
50
51
|
includeSystem,
|
|
52
|
+
excludeTables: input.getOption("exclude-table") ?? [],
|
|
51
53
|
gzip: gzipTransfer
|
|
52
54
|
});
|
|
53
55
|
const ungzipedResponse = gzipTransfer ? exportResponse.pipe(createGunzip()) : exportResponse;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransferCommand.js","sources":["../../../../../../packages/cli/src/commands/transfer/TransferCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { confirmImport } from './utils'\nimport { maskToken } from '../../lib/maskToken'\nimport { printProgressLine } from '../../lib/transfer/stdio'\nimport { readStream } from '../../lib/stream'\nimport { createGunzip } from 'node:zlib'\nimport { RemoteProjectResolver } from '../../lib/project/RemoteProjectResolver'\nimport { DataTransferClient } from '../../lib/transfer/DataTransferClient'\n\ntype Args = {\n\tsource: string\n\ttarget: string\n}\ntype Options = {\n\t'include-system'?: boolean\n\t'no-gzip-transfer'?: boolean\n\tyes: boolean\n}\n\nexport class TransferCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly remoteProjectResolver: RemoteProjectResolver,\n\t\tprivate readonly dataTransferClient: DataTransferClient,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Transfer data between projects')\n\t\tconfiguration.argument('source')\n\t\tconfiguration.argument('target').optional()\n\t\tconfiguration.option('include-system').valueNone()\n\t\tconfiguration.option('no-gzip-transfer').valueNone()\n\t\tconfiguration.option('yes').valueNone()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void | number> {\n\t\tconst source = input.getArgument('source')\n\t\tconst sourceProject = await this.remoteProjectResolver.resolve(source)\n\t\tif (!sourceProject) {\n\t\t\tthrow `Source project not defined`\n\t\t}\n\n\t\tconst target = input.getArgument('target')\n\t\tconst targetProject = await this.remoteProjectResolver.resolve(target)\n\t\tif (!targetProject) {\n\t\t\tthrow `Target project not defined`\n\t\t}\n\n\n\t\tconsole.log('')\n\t\tconsole.log('Transferring data between projects:')\n\t\tconsole.log('')\n\t\tconsole.log(`Source project name: ${sourceProject.name}`)\n\t\tconsole.log(`Source API URL: ${sourceProject.endpoint}`)\n\t\tconsole.log(`Source token: ${maskToken(sourceProject.token)}`)\n\t\tconsole.log('')\n\t\tconsole.log(`Target project name: ${targetProject.name}`)\n\t\tconsole.log(`Target API URL: ${targetProject.endpoint}`)\n\t\tconsole.log(`Target token: ${maskToken(targetProject.token)}`)\n\t\tconsole.log('')\n\t\tif (!await confirmImport(input)) {\n\t\t\treturn 1\n\t\t}\n\n\t\tconst includeSystem = input.getOption('include-system') === true\n\t\tconst gzipTransfer = !input.getOption('no-gzip-transfer')\n\t\tconst exportResponse = (await this.dataTransferClient.dataExport({\n\t\t\tproject: sourceProject,\n\t\t\tincludeSystem,\n\t\t\tgzip: gzipTransfer,\n\t\t}))\n\t\tconst ungzipedResponse = gzipTransfer ? exportResponse.pipe(createGunzip()) : exportResponse\n\t\tconst importResponse = await this.dataTransferClient.dataImport({\n\t\t\tstream: ungzipedResponse,\n\t\t\tproject: targetProject,\n\t\t\tprintProgress: printProgressLine,\n\t\t\tgzip: gzipTransfer,\n\t\t})\n\t\tconsole.log('')\n\n\t\tconst responseData = JSON.parse((await readStream(importResponse)).toString())\n\t\tif (responseData.ok) {\n\t\t\tconsole.log('Transfer done.')\n\t\t} else {\n\t\t\tconsole.error('Transfer failed:')\n\t\t\tconsole.log(responseData)\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"TransferCommand.js","sources":["../../../../../../packages/cli/src/commands/transfer/TransferCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { confirmImport } from './utils'\nimport { maskToken } from '../../lib/maskToken'\nimport { printProgressLine } from '../../lib/transfer/stdio'\nimport { readStream } from '../../lib/stream'\nimport { createGunzip } from 'node:zlib'\nimport { RemoteProjectResolver } from '../../lib/project/RemoteProjectResolver'\nimport { DataTransferClient } from '../../lib/transfer/DataTransferClient'\n\ntype Args = {\n\tsource: string\n\ttarget: string\n}\ntype Options = {\n\t'include-system'?: boolean\n\t'no-gzip-transfer'?: boolean\n\tyes: boolean\n\t'exclude-table'?: string[]\n}\n\nexport class TransferCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly remoteProjectResolver: RemoteProjectResolver,\n\t\tprivate readonly dataTransferClient: DataTransferClient,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Transfer data between projects')\n\t\tconfiguration.argument('source')\n\t\tconfiguration.argument('target').optional()\n\t\tconfiguration.option('include-system').valueNone()\n\t\tconfiguration.option('no-gzip-transfer').valueNone()\n\t\tconfiguration.option('yes').valueNone()\n\t\tconfiguration.option('exclude-table').valueArray()\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void | number> {\n\t\tconst source = input.getArgument('source')\n\t\tconst sourceProject = await this.remoteProjectResolver.resolve(source)\n\t\tif (!sourceProject) {\n\t\t\tthrow `Source project not defined`\n\t\t}\n\n\t\tconst target = input.getArgument('target')\n\t\tconst targetProject = await this.remoteProjectResolver.resolve(target)\n\t\tif (!targetProject) {\n\t\t\tthrow `Target project not defined`\n\t\t}\n\n\n\t\tconsole.log('')\n\t\tconsole.log('Transferring data between projects:')\n\t\tconsole.log('')\n\t\tconsole.log(`Source project name: ${sourceProject.name}`)\n\t\tconsole.log(`Source API URL: ${sourceProject.endpoint}`)\n\t\tconsole.log(`Source token: ${maskToken(sourceProject.token)}`)\n\t\tconsole.log('')\n\t\tconsole.log(`Target project name: ${targetProject.name}`)\n\t\tconsole.log(`Target API URL: ${targetProject.endpoint}`)\n\t\tconsole.log(`Target token: ${maskToken(targetProject.token)}`)\n\t\tconsole.log('')\n\t\tif (!await confirmImport(input)) {\n\t\t\treturn 1\n\t\t}\n\n\t\tconst includeSystem = input.getOption('include-system') === true\n\t\tconst gzipTransfer = !input.getOption('no-gzip-transfer')\n\t\tconst exportResponse = (await this.dataTransferClient.dataExport({\n\t\t\tproject: sourceProject,\n\t\t\tincludeSystem,\n\t\t\texcludeTables: input.getOption('exclude-table') ?? [],\n\t\t\tgzip: gzipTransfer,\n\t\t}))\n\t\tconst ungzipedResponse = gzipTransfer ? exportResponse.pipe(createGunzip()) : exportResponse\n\t\tconst importResponse = await this.dataTransferClient.dataImport({\n\t\t\tstream: ungzipedResponse,\n\t\t\tproject: targetProject,\n\t\t\tprintProgress: printProgressLine,\n\t\t\tgzip: gzipTransfer,\n\t\t})\n\t\tconsole.log('')\n\n\t\tconst responseData = JSON.parse((await readStream(importResponse)).toString())\n\t\tif (responseData.ok) {\n\t\t\tconsole.log('Transfer done.')\n\t\t} else {\n\t\t\tconsole.error('Transfer failed:')\n\t\t\tconsole.log(responseData)\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;;;AAoBO,MAAM,wBAAwB,QAAuB;AAAA,EAC3D,YACkB,uBACA,oBAChB;AACK,UAAA;AAHW,SAAA,wBAAA;AACA,SAAA,qBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,gCAAgC;AAC1D,kBAAc,SAAS,QAAQ;AACjB,kBAAA,SAAS,QAAQ,EAAE,SAAS;AAC5B,kBAAA,OAAO,gBAAgB,EAAE,UAAU;AACnC,kBAAA,OAAO,kBAAkB,EAAE,UAAU;AACrC,kBAAA,OAAO,KAAK,EAAE,UAAU;AACxB,kBAAA,OAAO,eAAe,EAAE,WAAW;AAAA,EAAA;AAAA,EAGlD,MAAgB,QAAQ,OAAqD;AACtE,UAAA,SAAS,MAAM,YAAY,QAAQ;AACzC,UAAM,gBAAgB,MAAM,KAAK,sBAAsB,QAAQ,MAAM;AACrE,QAAI,CAAC,eAAe;AACb,YAAA;AAAA,IAAA;AAGD,UAAA,SAAS,MAAM,YAAY,QAAQ;AACzC,UAAM,gBAAgB,MAAM,KAAK,sBAAsB,QAAQ,MAAM;AACrE,QAAI,CAAC,eAAe;AACb,YAAA;AAAA,IAAA;AAIP,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,qCAAqC;AACjD,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,wBAAwB,cAAc,IAAI,EAAE;AACxD,YAAQ,IAAI,mBAAmB,cAAc,QAAQ,EAAE;AACvD,YAAQ,IAAI,iBAAiB,UAAU,cAAc,KAAK,CAAC,EAAE;AAC7D,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,wBAAwB,cAAc,IAAI,EAAE;AACxD,YAAQ,IAAI,mBAAmB,cAAc,QAAQ,EAAE;AACvD,YAAQ,IAAI,iBAAiB,UAAU,cAAc,KAAK,CAAC,EAAE;AAC7D,YAAQ,IAAI,EAAE;AACd,QAAI,CAAC,MAAM,cAAc,KAAK,GAAG;AACzB,aAAA;AAAA,IAAA;AAGR,UAAM,gBAAgB,MAAM,UAAU,gBAAgB,MAAM;AAC5D,UAAM,eAAe,CAAC,MAAM,UAAU,kBAAkB;AACxD,UAAM,iBAAkB,MAAM,KAAK,mBAAmB,WAAW;AAAA,MAChE,SAAS;AAAA,MACT;AAAA,MACA,eAAe,MAAM,UAAU,eAAe,KAAK,CAAC;AAAA,MACpD,MAAM;AAAA,IAAA,CACN;AACD,UAAM,mBAAmB,eAAe,eAAe,KAAK,aAAc,CAAA,IAAI;AAC9E,UAAM,iBAAiB,MAAM,KAAK,mBAAmB,WAAW;AAAA,MAC/D,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,eAAe;AAAA,MACf,MAAM;AAAA,IAAA,CACN;AACD,YAAQ,IAAI,EAAE;AAER,UAAA,eAAe,KAAK,OAAO,MAAM,WAAW,cAAc,GAAG,UAAU;AAC7E,QAAI,aAAa,IAAI;AACpB,cAAQ,IAAI,gBAAgB;AAAA,IAAA,OACtB;AACN,cAAQ,MAAM,kBAAkB;AAChC,cAAQ,IAAI,YAAY;AAAA,IAAA;AAAA,EACzB;AAEF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","sources":["../../../../../../packages/cli/src/commands/transfer/utils.ts"],"sourcesContent":["import { Input } from '@contember/cli-common'\nimport prompts from 'prompts'\n\n\nexport const confirmImport = async (input: Input<{}, { yes: boolean }>): Promise<boolean> => {\n\tif (input.getOption('yes')) {\n\t\treturn true\n\t}\n\tif (!process.stdin.isTTY) {\n\t\tthrow 'TTY not available. Pass --yes option to confirm execution.'\n\t}\n\tconsole.log('This will completely wipe the target project.')\n\tconsole.log('(to skip this dialog, you can pass --yes option)')\n\tconsole.log('')\n\tconst { ok } = await prompts({\n\t\ttype: 'confirm',\n\t\tname: 'ok',\n\t\tmessage: `Do you want to continue?`,\n\t})\n\treturn ok\n}\n"],"names":[],"mappings":";;;AAIa,MAAA,gBAAgB,OAAO,UAAyD;AACxF,MAAA,MAAM,UAAU,KAAK,GAAG;AACpB,WAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"utils.cjs","sources":["../../../../../../packages/cli/src/commands/transfer/utils.ts"],"sourcesContent":["import { Input } from '@contember/cli-common'\nimport prompts from 'prompts'\n\n\nexport const confirmImport = async (input: Input<{}, { yes: boolean }>): Promise<boolean> => {\n\tif (input.getOption('yes')) {\n\t\treturn true\n\t}\n\tif (!process.stdin.isTTY) {\n\t\tthrow 'TTY not available. Pass --yes option to confirm execution.'\n\t}\n\tconsole.log('This will completely wipe the target project.')\n\tconsole.log('(to skip this dialog, you can pass --yes option)')\n\tconsole.log('')\n\tconst { ok } = await prompts({\n\t\ttype: 'confirm',\n\t\tname: 'ok',\n\t\tmessage: `Do you want to continue?`,\n\t})\n\treturn ok\n}\n"],"names":[],"mappings":";;;AAIa,MAAA,gBAAgB,OAAO,UAAyD;AACxF,MAAA,MAAM,UAAU,KAAK,GAAG;AACpB,WAAA;AAAA,EAAA;AAEJ,MAAA,CAAC,QAAQ,MAAM,OAAO;AACnB,UAAA;AAAA,EAAA;AAEP,UAAQ,IAAI,+CAA+C;AAC3D,UAAQ,IAAI,kDAAkD;AAC9D,UAAQ,IAAI,EAAE;AACd,QAAM,EAAE,OAAO,MAAM,QAAQ;AAAA,IAC5B,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EAAA,CACT;AACM,SAAA;AACR;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../../../packages/cli/src/commands/transfer/utils.ts"],"sourcesContent":["import { Input } from '@contember/cli-common'\nimport prompts from 'prompts'\n\n\nexport const confirmImport = async (input: Input<{}, { yes: boolean }>): Promise<boolean> => {\n\tif (input.getOption('yes')) {\n\t\treturn true\n\t}\n\tif (!process.stdin.isTTY) {\n\t\tthrow 'TTY not available. Pass --yes option to confirm execution.'\n\t}\n\tconsole.log('This will completely wipe the target project.')\n\tconsole.log('(to skip this dialog, you can pass --yes option)')\n\tconsole.log('')\n\tconst { ok } = await prompts({\n\t\ttype: 'confirm',\n\t\tname: 'ok',\n\t\tmessage: `Do you want to continue?`,\n\t})\n\treturn ok\n}\n"],"names":[],"mappings":";AAIa,MAAA,gBAAgB,OAAO,UAAyD;AACxF,MAAA,MAAM,UAAU,KAAK,GAAG;AACpB,WAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../../packages/cli/src/commands/transfer/utils.ts"],"sourcesContent":["import { Input } from '@contember/cli-common'\nimport prompts from 'prompts'\n\n\nexport const confirmImport = async (input: Input<{}, { yes: boolean }>): Promise<boolean> => {\n\tif (input.getOption('yes')) {\n\t\treturn true\n\t}\n\tif (!process.stdin.isTTY) {\n\t\tthrow 'TTY not available. Pass --yes option to confirm execution.'\n\t}\n\tconsole.log('This will completely wipe the target project.')\n\tconsole.log('(to skip this dialog, you can pass --yes option)')\n\tconsole.log('')\n\tconst { ok } = await prompts({\n\t\ttype: 'confirm',\n\t\tname: 'ok',\n\t\tmessage: `Do you want to continue?`,\n\t})\n\treturn ok\n}\n"],"names":[],"mappings":";AAIa,MAAA,gBAAgB,OAAO,UAAyD;AACxF,MAAA,MAAM,UAAU,KAAK,GAAG;AACpB,WAAA;AAAA,EAAA;AAEJ,MAAA,CAAC,QAAQ,MAAM,OAAO;AACnB,UAAA;AAAA,EAAA;AAEP,UAAQ,IAAI,+CAA+C;AAC3D,UAAQ,IAAI,kDAAkD;AAC9D,UAAQ,IAAI,EAAE;AACd,QAAM,EAAE,OAAO,MAAM,QAAQ;AAAA,IAC5B,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EAAA,CACT;AACM,SAAA;AACR;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkspaceUpdateApiCommand.cjs","sources":["../../../../../../packages/cli/src/commands/workspace/WorkspaceUpdateApiCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input, PackageWorkspaceResolver } from '@contember/cli-common'\nimport { DockerComposeManager } from '../../lib/fs/DockerComposeManager'\nimport { contemberDockerImages } from '../../consts'\n\ntype Args = {\n\tversion: string\n}\n\ntype Options = {}\n\nexport class WorkspaceUpdateApiCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly packageWorkspaceResolver: PackageWorkspaceResolver,\n\t\tprivate readonly dockerComposeManager: DockerComposeManager,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Updates Contember API version and all related packages')\n\t\tconfiguration.argument('version')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst version = input.getArgument('version')\n\t\tconst packageWorkspace = await this.packageWorkspaceResolver.resolve()\n\n\t\tawait packageWorkspace.updateEverywhere({\n\t\t\t'@contember/schema': version,\n\t\t\t'@contember/schema-definition': version,\n\t\t\t'@contember/cli': version,\n\t\t})\n\n\t\tconsole.log('Updating docker-compose')\n\t\tconst getNewImage = (currentImage: string): string | null => {\n\t\t\tfor (const candidate of contemberDockerImages) {\n\t\t\t\tif (currentImage.startsWith(`${candidate}:`)) {\n\t\t\t\t\treturn `${candidate.replace(/-ee$/, '')}:${version}`\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null\n\t\t}\n\t\tawait this.dockerComposeManager.updateMainDockerComposeConfig(data => ({\n\t\t\t...data,\n\t\t\tservices: Object.fromEntries(Object.entries(data?.services ?? {}).map(([name, service]: [string, any]) => {\n\t\t\t\tconst newImage = getNewImage(service.image)\n\t\t\t\tif (newImage) {\n\t\t\t\t\tconsole.log(`docker-compose service ${name} updated`)\n\t\t\t\t\treturn [\n\t\t\t\t\t\tname,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...service,\n\t\t\t\t\t\t\timage: newImage,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t\treturn [name, service]\n\t\t\t})),\n\t\t}))\n\t\tconsole.log('API versions updated')\n\t\tconsole.log('Restart server to apply changes')\n\t}\n}\n"],"names":["Command","contemberDockerImages"],"mappings":";;;;AAUO,MAAM,kCAAkCA,UAAAA,QAAuB;AAAA,EACrE,YACkB,0BACA,sBAChB;AACK;AAHW,SAAA,2BAAA;AACA,SAAA,uBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"WorkspaceUpdateApiCommand.cjs","sources":["../../../../../../packages/cli/src/commands/workspace/WorkspaceUpdateApiCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input, PackageWorkspaceResolver } from '@contember/cli-common'\nimport { DockerComposeManager } from '../../lib/fs/DockerComposeManager'\nimport { contemberDockerImages } from '../../consts'\n\ntype Args = {\n\tversion: string\n}\n\ntype Options = {}\n\nexport class WorkspaceUpdateApiCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly packageWorkspaceResolver: PackageWorkspaceResolver,\n\t\tprivate readonly dockerComposeManager: DockerComposeManager,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Updates Contember API version and all related packages')\n\t\tconfiguration.argument('version')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst version = input.getArgument('version')\n\t\tconst packageWorkspace = await this.packageWorkspaceResolver.resolve()\n\n\t\tawait packageWorkspace.updateEverywhere({\n\t\t\t'@contember/schema': version,\n\t\t\t'@contember/schema-definition': version,\n\t\t\t'@contember/cli': version,\n\t\t})\n\n\t\tconsole.log('Updating docker-compose')\n\t\tconst getNewImage = (currentImage: string): string | null => {\n\t\t\tfor (const candidate of contemberDockerImages) {\n\t\t\t\tif (currentImage.startsWith(`${candidate}:`)) {\n\t\t\t\t\treturn `${candidate.replace(/-ee$/, '')}:${version}`\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null\n\t\t}\n\t\tawait this.dockerComposeManager.updateMainDockerComposeConfig(data => ({\n\t\t\t...data,\n\t\t\tservices: Object.fromEntries(Object.entries(data?.services ?? {}).map(([name, service]: [string, any]) => {\n\t\t\t\tconst newImage = getNewImage(service.image)\n\t\t\t\tif (newImage) {\n\t\t\t\t\tconsole.log(`docker-compose service ${name} updated`)\n\t\t\t\t\treturn [\n\t\t\t\t\t\tname,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...service,\n\t\t\t\t\t\t\timage: newImage,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t\treturn [name, service]\n\t\t\t})),\n\t\t}))\n\t\tconsole.log('API versions updated')\n\t\tconsole.log('Restart server to apply changes')\n\t}\n}\n"],"names":["Command","contemberDockerImages"],"mappings":";;;;AAUO,MAAM,kCAAkCA,UAAAA,QAAuB;AAAA,EACrE,YACkB,0BACA,sBAChB;AACK,UAAA;AAHW,SAAA,2BAAA;AACA,SAAA,uBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,wDAAwD;AAClF,kBAAc,SAAS,SAAS;AAAA,EAAA;AAAA,EAGjC,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,UAAU,MAAM,YAAY,SAAS;AAC3C,UAAM,mBAAmB,MAAM,KAAK,yBAAyB,QAAQ;AAErE,UAAM,iBAAiB,iBAAiB;AAAA,MACvC,qBAAqB;AAAA,MACrB,gCAAgC;AAAA,MAChC,kBAAkB;AAAA,IAAA,CAClB;AAED,YAAQ,IAAI,yBAAyB;AAC/B,UAAA,cAAc,CAAC,iBAAwC;AAC5D,iBAAW,aAAaC,8BAAuB;AAC9C,YAAI,aAAa,WAAW,GAAG,SAAS,GAAG,GAAG;AAC7C,iBAAO,GAAG,UAAU,QAAQ,QAAQ,EAAE,CAAC,IAAI,OAAO;AAAA,QAAA;AAAA,MACnD;AAEM,aAAA;AAAA,IACR;AACM,UAAA,KAAK,qBAAqB,8BAA8B,CAAS,UAAA;AAAA,MACtE,GAAG;AAAA,MACH,UAAU,OAAO,YAAY,OAAO,QAAQ,MAAM,YAAY,CAAA,CAAE,EAAE,IAAI,CAAC,CAAC,MAAM,OAAO,MAAqB;AACnG,cAAA,WAAW,YAAY,QAAQ,KAAK;AAC1C,YAAI,UAAU;AACL,kBAAA,IAAI,0BAA0B,IAAI,UAAU;AAC7C,iBAAA;AAAA,YACN;AAAA,YACA;AAAA,cACC,GAAG;AAAA,cACH,OAAO;AAAA,YAAA;AAAA,UAET;AAAA,QAAA;AAEM,eAAA,CAAC,MAAM,OAAO;AAAA,MAAA,CACrB,CAAC;AAAA,IAAA,EACD;AACF,YAAQ,IAAI,sBAAsB;AAClC,YAAQ,IAAI,iCAAiC;AAAA,EAAA;AAE/C;;"}
|