spindb 0.37.2 → 0.38.0
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/dist/cli/bin.js +9 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/commands/attach.js +102 -0
- package/dist/cli/commands/attach.js.map +1 -0
- package/dist/cli/commands/backup.js +197 -0
- package/dist/cli/commands/backup.js.map +1 -0
- package/dist/cli/commands/backups.js +190 -0
- package/dist/cli/commands/backups.js.map +1 -0
- package/dist/cli/commands/clone.js +119 -0
- package/dist/cli/commands/clone.js.map +1 -0
- package/dist/cli/commands/config.js +276 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/connect.js +559 -0
- package/dist/cli/commands/connect.js.map +1 -0
- package/dist/cli/commands/create.js +952 -0
- package/dist/cli/commands/create.js.map +1 -0
- package/dist/cli/commands/databases.js +485 -0
- package/dist/cli/commands/databases.js.map +1 -0
- package/dist/cli/commands/delete.js +106 -0
- package/dist/cli/commands/delete.js.map +1 -0
- package/dist/cli/commands/deps.js +238 -0
- package/dist/cli/commands/deps.js.map +1 -0
- package/dist/cli/commands/detach.js +81 -0
- package/dist/cli/commands/detach.js.map +1 -0
- package/dist/cli/commands/doctor.js +567 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/duckdb.js +207 -0
- package/dist/cli/commands/duckdb.js.map +1 -0
- package/dist/cli/commands/edit.js +524 -0
- package/dist/cli/commands/edit.js.map +1 -0
- package/dist/cli/commands/engines.js +1414 -0
- package/dist/cli/commands/engines.js.map +1 -0
- package/dist/cli/commands/export.js +383 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/commands/info.js +270 -0
- package/dist/cli/commands/info.js.map +1 -0
- package/dist/cli/commands/list.js +215 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/logs.js +81 -0
- package/dist/cli/commands/logs.js.map +1 -0
- package/dist/cli/commands/menu/backup-handlers.js +1202 -0
- package/dist/cli/commands/menu/backup-handlers.js.map +1 -0
- package/dist/cli/commands/menu/container-handlers.js +1788 -0
- package/dist/cli/commands/menu/container-handlers.js.map +1 -0
- package/dist/cli/commands/menu/engine-handlers.js +235 -0
- package/dist/cli/commands/menu/engine-handlers.js.map +1 -0
- package/dist/cli/commands/menu/index.js +266 -0
- package/dist/cli/commands/menu/index.js.map +1 -0
- package/dist/cli/commands/menu/settings-handlers.js +320 -0
- package/dist/cli/commands/menu/settings-handlers.js.map +1 -0
- package/dist/cli/commands/menu/shared.js +13 -0
- package/dist/cli/commands/menu/shared.js.map +1 -0
- package/dist/cli/commands/menu/shell-handlers.js +1573 -0
- package/dist/cli/commands/menu/shell-handlers.js.map +1 -0
- package/dist/cli/commands/menu/sql-handlers.js +185 -0
- package/dist/cli/commands/menu/sql-handlers.js.map +1 -0
- package/dist/cli/commands/menu/update-handlers.js +322 -0
- package/dist/cli/commands/menu/update-handlers.js.map +1 -0
- package/dist/cli/commands/menu/validators.js +9 -0
- package/dist/cli/commands/menu/validators.js.map +1 -0
- package/dist/cli/commands/ports.js +166 -0
- package/dist/cli/commands/ports.js.map +1 -0
- package/dist/cli/commands/pull.js +166 -0
- package/dist/cli/commands/pull.js.map +1 -0
- package/dist/cli/commands/query.js +180 -0
- package/dist/cli/commands/query.js.map +1 -0
- package/dist/cli/commands/restore.js +428 -0
- package/dist/cli/commands/restore.js.map +1 -0
- package/dist/cli/commands/run.js +115 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/commands/self-update.js +99 -0
- package/dist/cli/commands/self-update.js.map +1 -0
- package/dist/cli/commands/sqlite.js +207 -0
- package/dist/cli/commands/sqlite.js.map +1 -0
- package/dist/cli/commands/start.js +196 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/commands/stop.js +182 -0
- package/dist/cli/commands/stop.js.map +1 -0
- package/dist/cli/commands/url.js +88 -0
- package/dist/cli/commands/url.js.map +1 -0
- package/dist/cli/commands/users.js +189 -0
- package/dist/cli/commands/users.js.map +1 -0
- package/dist/cli/commands/version.js +52 -0
- package/dist/cli/commands/version.js.map +1 -0
- package/dist/cli/commands/which.js +258 -0
- package/dist/cli/commands/which.js.map +1 -0
- package/dist/cli/constants.js +212 -0
- package/dist/cli/constants.js.map +1 -0
- package/dist/cli/helpers.js +1120 -0
- package/dist/cli/helpers.js.map +1 -0
- package/dist/cli/index.js +146 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/ui/prompts.js +1002 -0
- package/dist/cli/ui/prompts.js.map +1 -0
- package/dist/cli/ui/spinner.js +74 -0
- package/dist/cli/ui/spinner.js.map +1 -0
- package/dist/cli/ui/theme.js +99 -0
- package/dist/cli/ui/theme.js.map +1 -0
- package/dist/cli/utils/file-follower.js +79 -0
- package/dist/cli/utils/file-follower.js.map +1 -0
- package/dist/config/backup-formats.js +363 -0
- package/dist/config/backup-formats.js.map +1 -0
- package/dist/config/defaults.js +25 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/engine-defaults.js +303 -0
- package/dist/config/engine-defaults.js.map +1 -0
- package/dist/config/engines-registry.js +103 -0
- package/dist/config/engines-registry.js.map +1 -0
- package/dist/config/os-dependencies.js +767 -0
- package/dist/config/os-dependencies.js.map +1 -0
- package/dist/config/paths.js +156 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/config/version.js +3 -0
- package/dist/config/version.js.map +1 -0
- package/dist/core/backup-restore.js +219 -0
- package/dist/core/backup-restore.js.map +1 -0
- package/dist/core/base-binary-manager.js +403 -0
- package/dist/core/base-binary-manager.js.map +1 -0
- package/dist/core/base-document-binary-manager.js +364 -0
- package/dist/core/base-document-binary-manager.js.map +1 -0
- package/dist/core/base-embedded-binary-manager.js +364 -0
- package/dist/core/base-embedded-binary-manager.js.map +1 -0
- package/dist/core/base-server-binary-manager.js +368 -0
- package/dist/core/base-server-binary-manager.js.map +1 -0
- package/dist/core/config-manager.js +495 -0
- package/dist/core/config-manager.js.map +1 -0
- package/dist/core/container-manager.js +609 -0
- package/dist/core/container-manager.js.map +1 -0
- package/dist/core/credential-generator.js +67 -0
- package/dist/core/credential-generator.js.map +1 -0
- package/dist/core/credential-manager.js +211 -0
- package/dist/core/credential-manager.js.map +1 -0
- package/dist/core/dblab-utils.js +105 -0
- package/dist/core/dblab-utils.js.map +1 -0
- package/dist/core/dependency-manager.js +359 -0
- package/dist/core/dependency-manager.js.map +1 -0
- package/dist/core/docker-exporter.js +1077 -0
- package/dist/core/docker-exporter.js.map +1 -0
- package/dist/core/error-handler.js +295 -0
- package/dist/core/error-handler.js.map +1 -0
- package/dist/core/fs-error-utils.js +74 -0
- package/dist/core/fs-error-utils.js.map +1 -0
- package/dist/core/homebrew-version-manager.js +280 -0
- package/dist/core/homebrew-version-manager.js.map +1 -0
- package/dist/core/hostdb-client.js +252 -0
- package/dist/core/hostdb-client.js.map +1 -0
- package/dist/core/hostdb-metadata.js +243 -0
- package/dist/core/hostdb-metadata.js.map +1 -0
- package/dist/core/hostdb-releases-factory.js +161 -0
- package/dist/core/hostdb-releases-factory.js.map +1 -0
- package/dist/core/library-env.js +88 -0
- package/dist/core/library-env.js.map +1 -0
- package/dist/core/pgweb-utils.js +53 -0
- package/dist/core/pgweb-utils.js.map +1 -0
- package/dist/core/platform-service.js +632 -0
- package/dist/core/platform-service.js.map +1 -0
- package/dist/core/port-manager.js +136 -0
- package/dist/core/port-manager.js.map +1 -0
- package/dist/core/process-manager.js +445 -0
- package/dist/core/process-manager.js.map +1 -0
- package/dist/core/pull-manager.js +418 -0
- package/dist/core/pull-manager.js.map +1 -0
- package/dist/core/query-parser.js +449 -0
- package/dist/core/query-parser.js.map +1 -0
- package/dist/core/spawn-utils.js +90 -0
- package/dist/core/spawn-utils.js.map +1 -0
- package/dist/core/start-with-retry.js +90 -0
- package/dist/core/start-with-retry.js.map +1 -0
- package/dist/core/test-cleanup.js +85 -0
- package/dist/core/test-cleanup.js.map +1 -0
- package/dist/core/tls-generator.js +84 -0
- package/dist/core/tls-generator.js.map +1 -0
- package/dist/core/transaction-manager.js +139 -0
- package/dist/core/transaction-manager.js.map +1 -0
- package/dist/core/update-manager.js +241 -0
- package/dist/core/update-manager.js.map +1 -0
- package/dist/core/version-migration.js +260 -0
- package/dist/core/version-migration.js.map +1 -0
- package/dist/core/version-utils.js +91 -0
- package/dist/core/version-utils.js.map +1 -0
- package/dist/engines/base-engine.js +179 -0
- package/dist/engines/base-engine.js.map +1 -0
- package/dist/engines/clickhouse/backup.js +289 -0
- package/dist/engines/clickhouse/backup.js.map +1 -0
- package/dist/engines/clickhouse/binary-manager.js +145 -0
- package/dist/engines/clickhouse/binary-manager.js.map +1 -0
- package/dist/engines/clickhouse/binary-urls.js +100 -0
- package/dist/engines/clickhouse/binary-urls.js.map +1 -0
- package/dist/engines/clickhouse/cli-utils.js +143 -0
- package/dist/engines/clickhouse/cli-utils.js.map +1 -0
- package/dist/engines/clickhouse/hostdb-releases.js +24 -0
- package/dist/engines/clickhouse/hostdb-releases.js.map +1 -0
- package/dist/engines/clickhouse/index.js +1077 -0
- package/dist/engines/clickhouse/index.js.map +1 -0
- package/dist/engines/clickhouse/restore.js +335 -0
- package/dist/engines/clickhouse/restore.js.map +1 -0
- package/dist/engines/clickhouse/version-maps.js +83 -0
- package/dist/engines/clickhouse/version-maps.js.map +1 -0
- package/dist/engines/clickhouse/version-validator.js +133 -0
- package/dist/engines/clickhouse/version-validator.js.map +1 -0
- package/dist/engines/cockroachdb/backup.js +261 -0
- package/dist/engines/cockroachdb/backup.js.map +1 -0
- package/dist/engines/cockroachdb/binary-manager.js +33 -0
- package/dist/engines/cockroachdb/binary-manager.js.map +1 -0
- package/dist/engines/cockroachdb/binary-urls.js +33 -0
- package/dist/engines/cockroachdb/binary-urls.js.map +1 -0
- package/dist/engines/cockroachdb/cli-utils.js +338 -0
- package/dist/engines/cockroachdb/cli-utils.js.map +1 -0
- package/dist/engines/cockroachdb/hostdb-releases.js +21 -0
- package/dist/engines/cockroachdb/hostdb-releases.js.map +1 -0
- package/dist/engines/cockroachdb/index.js +1016 -0
- package/dist/engines/cockroachdb/index.js.map +1 -0
- package/dist/engines/cockroachdb/restore.js +323 -0
- package/dist/engines/cockroachdb/restore.js.map +1 -0
- package/dist/engines/cockroachdb/version-maps.js +37 -0
- package/dist/engines/cockroachdb/version-maps.js.map +1 -0
- package/dist/engines/couchdb/api-client.js +64 -0
- package/dist/engines/couchdb/api-client.js.map +1 -0
- package/dist/engines/couchdb/backup.js +90 -0
- package/dist/engines/couchdb/backup.js.map +1 -0
- package/dist/engines/couchdb/binary-manager.js +62 -0
- package/dist/engines/couchdb/binary-manager.js.map +1 -0
- package/dist/engines/couchdb/binary-urls.js +92 -0
- package/dist/engines/couchdb/binary-urls.js.map +1 -0
- package/dist/engines/couchdb/hostdb-releases.js +21 -0
- package/dist/engines/couchdb/hostdb-releases.js.map +1 -0
- package/dist/engines/couchdb/index.js +1043 -0
- package/dist/engines/couchdb/index.js.map +1 -0
- package/dist/engines/couchdb/restore.js +198 -0
- package/dist/engines/couchdb/restore.js.map +1 -0
- package/dist/engines/couchdb/version-maps.js +67 -0
- package/dist/engines/couchdb/version-maps.js.map +1 -0
- package/dist/engines/couchdb/version-validator.js +88 -0
- package/dist/engines/couchdb/version-validator.js.map +1 -0
- package/dist/engines/duckdb/binary-manager.js +33 -0
- package/dist/engines/duckdb/binary-manager.js.map +1 -0
- package/{engines/duckdb/binary-urls.ts → dist/engines/duckdb/binary-urls.js} +11 -16
- package/dist/engines/duckdb/binary-urls.js.map +1 -0
- package/dist/engines/duckdb/hostdb-releases.js +21 -0
- package/dist/engines/duckdb/hostdb-releases.js.map +1 -0
- package/dist/engines/duckdb/index.js +594 -0
- package/dist/engines/duckdb/index.js.map +1 -0
- package/dist/engines/duckdb/registry.js +265 -0
- package/dist/engines/duckdb/registry.js.map +1 -0
- package/dist/engines/duckdb/scanner.js +12 -0
- package/dist/engines/duckdb/scanner.js.map +1 -0
- package/dist/engines/duckdb/version-maps.js +67 -0
- package/dist/engines/duckdb/version-maps.js.map +1 -0
- package/dist/engines/duckdb/version-validator.js +62 -0
- package/dist/engines/duckdb/version-validator.js.map +1 -0
- package/dist/engines/ferretdb/backup.js +170 -0
- package/dist/engines/ferretdb/backup.js.map +1 -0
- package/dist/engines/ferretdb/binary-manager.js +765 -0
- package/dist/engines/ferretdb/binary-manager.js.map +1 -0
- package/dist/engines/ferretdb/binary-urls.js +135 -0
- package/dist/engines/ferretdb/binary-urls.js.map +1 -0
- package/dist/engines/ferretdb/index.js +1517 -0
- package/dist/engines/ferretdb/index.js.map +1 -0
- package/dist/engines/ferretdb/restore.js +310 -0
- package/dist/engines/ferretdb/restore.js.map +1 -0
- package/{engines/ferretdb/version-maps.ts → dist/engines/ferretdb/version-maps.js} +62 -79
- package/dist/engines/ferretdb/version-maps.js.map +1 -0
- package/dist/engines/file-based-utils.js +184 -0
- package/dist/engines/file-based-utils.js.map +1 -0
- package/dist/engines/index.js +124 -0
- package/dist/engines/index.js.map +1 -0
- package/dist/engines/influxdb/api-client.js +54 -0
- package/dist/engines/influxdb/api-client.js.map +1 -0
- package/dist/engines/influxdb/backup.js +119 -0
- package/dist/engines/influxdb/backup.js.map +1 -0
- package/dist/engines/influxdb/binary-manager.js +87 -0
- package/dist/engines/influxdb/binary-manager.js.map +1 -0
- package/dist/engines/influxdb/binary-urls.js +56 -0
- package/dist/engines/influxdb/binary-urls.js.map +1 -0
- package/dist/engines/influxdb/hostdb-releases.js +21 -0
- package/dist/engines/influxdb/hostdb-releases.js.map +1 -0
- package/dist/engines/influxdb/index.js +962 -0
- package/dist/engines/influxdb/index.js.map +1 -0
- package/dist/engines/influxdb/restore.js +329 -0
- package/dist/engines/influxdb/restore.js.map +1 -0
- package/dist/engines/influxdb/version-maps.js +64 -0
- package/dist/engines/influxdb/version-maps.js.map +1 -0
- package/dist/engines/influxdb/version-validator.js +109 -0
- package/dist/engines/influxdb/version-validator.js.map +1 -0
- package/dist/engines/mariadb/backup.js +178 -0
- package/dist/engines/mariadb/backup.js.map +1 -0
- package/dist/engines/mariadb/binary-manager.js +33 -0
- package/dist/engines/mariadb/binary-manager.js.map +1 -0
- package/{engines/mariadb/binary-urls.ts → dist/engines/mariadb/binary-urls.js} +38 -55
- package/dist/engines/mariadb/binary-urls.js.map +1 -0
- package/dist/engines/mariadb/hostdb-releases.js +21 -0
- package/dist/engines/mariadb/hostdb-releases.js.map +1 -0
- package/dist/engines/mariadb/index.js +1011 -0
- package/dist/engines/mariadb/index.js.map +1 -0
- package/dist/engines/mariadb/restore.js +322 -0
- package/dist/engines/mariadb/restore.js.map +1 -0
- package/dist/engines/mariadb/version-maps.js +63 -0
- package/dist/engines/mariadb/version-maps.js.map +1 -0
- package/dist/engines/mariadb/version-validator.js +143 -0
- package/dist/engines/mariadb/version-validator.js.map +1 -0
- package/dist/engines/meilisearch/api-client.js +50 -0
- package/dist/engines/meilisearch/api-client.js.map +1 -0
- package/dist/engines/meilisearch/backup.js +167 -0
- package/dist/engines/meilisearch/backup.js.map +1 -0
- package/dist/engines/meilisearch/binary-manager.js +31 -0
- package/dist/engines/meilisearch/binary-manager.js.map +1 -0
- package/dist/engines/meilisearch/binary-urls.js +56 -0
- package/dist/engines/meilisearch/binary-urls.js.map +1 -0
- package/dist/engines/meilisearch/hostdb-releases.js +21 -0
- package/dist/engines/meilisearch/hostdb-releases.js.map +1 -0
- package/dist/engines/meilisearch/index.js +992 -0
- package/dist/engines/meilisearch/index.js.map +1 -0
- package/dist/engines/meilisearch/restore.js +167 -0
- package/dist/engines/meilisearch/restore.js.map +1 -0
- package/dist/engines/meilisearch/version-maps.js +67 -0
- package/dist/engines/meilisearch/version-maps.js.map +1 -0
- package/dist/engines/meilisearch/version-validator.js +109 -0
- package/dist/engines/meilisearch/version-validator.js.map +1 -0
- package/dist/engines/mongodb/backup.js +109 -0
- package/dist/engines/mongodb/backup.js.map +1 -0
- package/dist/engines/mongodb/binary-manager.js +36 -0
- package/dist/engines/mongodb/binary-manager.js.map +1 -0
- package/dist/engines/mongodb/binary-urls.js +46 -0
- package/dist/engines/mongodb/binary-urls.js.map +1 -0
- package/dist/engines/mongodb/cli-utils.js +131 -0
- package/dist/engines/mongodb/cli-utils.js.map +1 -0
- package/dist/engines/mongodb/hostdb-releases.js +77 -0
- package/dist/engines/mongodb/hostdb-releases.js.map +1 -0
- package/dist/engines/mongodb/index.js +873 -0
- package/dist/engines/mongodb/index.js.map +1 -0
- package/dist/engines/mongodb/restore.js +276 -0
- package/dist/engines/mongodb/restore.js.map +1 -0
- package/dist/engines/mongodb/version-maps.js +79 -0
- package/dist/engines/mongodb/version-maps.js.map +1 -0
- package/dist/engines/mongodb/version-validator.js +133 -0
- package/dist/engines/mongodb/version-validator.js.map +1 -0
- package/dist/engines/mysql/backup.js +210 -0
- package/dist/engines/mysql/backup.js.map +1 -0
- package/dist/engines/mysql/binary-detection.js +325 -0
- package/dist/engines/mysql/binary-detection.js.map +1 -0
- package/dist/engines/mysql/binary-manager.js +30 -0
- package/dist/engines/mysql/binary-manager.js.map +1 -0
- package/dist/engines/mysql/binary-urls.js +87 -0
- package/dist/engines/mysql/binary-urls.js.map +1 -0
- package/{engines/mysql/hostdb-releases.ts → dist/engines/mysql/hostdb-releases.js} +20 -23
- package/dist/engines/mysql/hostdb-releases.js.map +1 -0
- package/dist/engines/mysql/index.js +1066 -0
- package/dist/engines/mysql/index.js.map +1 -0
- package/dist/engines/mysql/restore.js +361 -0
- package/dist/engines/mysql/restore.js.map +1 -0
- package/dist/engines/mysql/version-maps.js +79 -0
- package/dist/engines/mysql/version-maps.js.map +1 -0
- package/dist/engines/mysql/version-validator.js +266 -0
- package/dist/engines/mysql/version-validator.js.map +1 -0
- package/dist/engines/postgresql/backup.js +118 -0
- package/dist/engines/postgresql/backup.js.map +1 -0
- package/dist/engines/postgresql/binary-manager.js +85 -0
- package/dist/engines/postgresql/binary-manager.js.map +1 -0
- package/dist/engines/postgresql/binary-urls.js +80 -0
- package/dist/engines/postgresql/binary-urls.js.map +1 -0
- package/dist/engines/postgresql/hostdb-releases.js +21 -0
- package/dist/engines/postgresql/hostdb-releases.js.map +1 -0
- package/dist/engines/postgresql/index.js +852 -0
- package/dist/engines/postgresql/index.js.map +1 -0
- package/dist/engines/postgresql/remote-version.js +109 -0
- package/dist/engines/postgresql/remote-version.js.map +1 -0
- package/dist/engines/postgresql/restore.js +254 -0
- package/dist/engines/postgresql/restore.js.map +1 -0
- package/dist/engines/postgresql/version-maps.js +73 -0
- package/dist/engines/postgresql/version-maps.js.map +1 -0
- package/dist/engines/postgresql/version-validator.js +286 -0
- package/dist/engines/postgresql/version-validator.js.map +1 -0
- package/dist/engines/qdrant/api-client.js +50 -0
- package/dist/engines/qdrant/api-client.js.map +1 -0
- package/dist/engines/qdrant/backup.js +115 -0
- package/dist/engines/qdrant/backup.js.map +1 -0
- package/dist/engines/qdrant/binary-manager.js +31 -0
- package/dist/engines/qdrant/binary-manager.js.map +1 -0
- package/dist/engines/qdrant/binary-urls.js +92 -0
- package/dist/engines/qdrant/binary-urls.js.map +1 -0
- package/dist/engines/qdrant/cli-utils.js +39 -0
- package/dist/engines/qdrant/cli-utils.js.map +1 -0
- package/dist/engines/qdrant/hostdb-releases.js +21 -0
- package/dist/engines/qdrant/hostdb-releases.js.map +1 -0
- package/dist/engines/qdrant/index.js +1002 -0
- package/dist/engines/qdrant/index.js.map +1 -0
- package/dist/engines/qdrant/restore.js +154 -0
- package/dist/engines/qdrant/restore.js.map +1 -0
- package/dist/engines/qdrant/version-maps.js +67 -0
- package/dist/engines/qdrant/version-maps.js.map +1 -0
- package/dist/engines/qdrant/version-validator.js +109 -0
- package/dist/engines/qdrant/version-validator.js.map +1 -0
- package/dist/engines/questdb/backup.js +191 -0
- package/dist/engines/questdb/backup.js.map +1 -0
- package/dist/engines/questdb/binary-manager.js +247 -0
- package/dist/engines/questdb/binary-manager.js.map +1 -0
- package/dist/engines/questdb/binary-urls.js +27 -0
- package/dist/engines/questdb/binary-urls.js.map +1 -0
- package/dist/engines/questdb/hostdb-releases.js +21 -0
- package/dist/engines/questdb/hostdb-releases.js.map +1 -0
- package/dist/engines/questdb/index.js +814 -0
- package/dist/engines/questdb/index.js.map +1 -0
- package/dist/engines/questdb/restore.js +202 -0
- package/dist/engines/questdb/restore.js.map +1 -0
- package/dist/engines/questdb/version-maps.js +33 -0
- package/dist/engines/questdb/version-maps.js.map +1 -0
- package/dist/engines/questdb/version-validator.js +99 -0
- package/dist/engines/questdb/version-validator.js.map +1 -0
- package/dist/engines/redis/backup.js +292 -0
- package/dist/engines/redis/backup.js.map +1 -0
- package/dist/engines/redis/binary-manager.js +32 -0
- package/dist/engines/redis/binary-manager.js.map +1 -0
- package/dist/engines/redis/binary-urls.js +96 -0
- package/dist/engines/redis/binary-urls.js.map +1 -0
- package/dist/engines/redis/cli-utils.js +38 -0
- package/dist/engines/redis/cli-utils.js.map +1 -0
- package/dist/engines/redis/hostdb-releases.js +21 -0
- package/dist/engines/redis/hostdb-releases.js.map +1 -0
- package/dist/engines/redis/index.js +1263 -0
- package/dist/engines/redis/index.js.map +1 -0
- package/dist/engines/redis/restore.js +338 -0
- package/dist/engines/redis/restore.js.map +1 -0
- package/dist/engines/redis/version-maps.js +70 -0
- package/dist/engines/redis/version-maps.js.map +1 -0
- package/dist/engines/redis/version-validator.js +109 -0
- package/dist/engines/redis/version-validator.js.map +1 -0
- package/dist/engines/sqlite/binary-manager.js +39 -0
- package/dist/engines/sqlite/binary-manager.js.map +1 -0
- package/{engines/sqlite/binary-urls.ts → dist/engines/sqlite/binary-urls.js} +11 -16
- package/dist/engines/sqlite/binary-urls.js.map +1 -0
- package/dist/engines/sqlite/hostdb-releases.js +21 -0
- package/dist/engines/sqlite/hostdb-releases.js.map +1 -0
- package/dist/engines/sqlite/index.js +493 -0
- package/dist/engines/sqlite/index.js.map +1 -0
- package/dist/engines/sqlite/registry.js +163 -0
- package/dist/engines/sqlite/registry.js.map +1 -0
- package/dist/engines/sqlite/scanner.js +12 -0
- package/dist/engines/sqlite/scanner.js.map +1 -0
- package/dist/engines/sqlite/version-maps.js +57 -0
- package/dist/engines/sqlite/version-maps.js.map +1 -0
- package/dist/engines/surrealdb/backup.js +97 -0
- package/dist/engines/surrealdb/backup.js.map +1 -0
- package/dist/engines/surrealdb/binary-manager.js +33 -0
- package/dist/engines/surrealdb/binary-manager.js.map +1 -0
- package/dist/engines/surrealdb/binary-urls.js +33 -0
- package/dist/engines/surrealdb/binary-urls.js.map +1 -0
- package/dist/engines/surrealdb/cli-utils.js +147 -0
- package/dist/engines/surrealdb/cli-utils.js.map +1 -0
- package/dist/engines/surrealdb/hostdb-releases.js +21 -0
- package/dist/engines/surrealdb/hostdb-releases.js.map +1 -0
- package/dist/engines/surrealdb/index.js +1022 -0
- package/dist/engines/surrealdb/index.js.map +1 -0
- package/dist/engines/surrealdb/restore.js +224 -0
- package/dist/engines/surrealdb/restore.js.map +1 -0
- package/dist/engines/surrealdb/version-maps.js +36 -0
- package/dist/engines/surrealdb/version-maps.js.map +1 -0
- package/dist/engines/tigerbeetle/backup.js +36 -0
- package/dist/engines/tigerbeetle/backup.js.map +1 -0
- package/dist/engines/tigerbeetle/binary-manager.js +72 -0
- package/dist/engines/tigerbeetle/binary-manager.js.map +1 -0
- package/dist/engines/tigerbeetle/binary-urls.js +49 -0
- package/dist/engines/tigerbeetle/binary-urls.js.map +1 -0
- package/dist/engines/tigerbeetle/hostdb-releases.js +21 -0
- package/dist/engines/tigerbeetle/hostdb-releases.js.map +1 -0
- package/dist/engines/tigerbeetle/index.js +559 -0
- package/dist/engines/tigerbeetle/index.js.map +1 -0
- package/dist/engines/tigerbeetle/restore.js +91 -0
- package/dist/engines/tigerbeetle/restore.js.map +1 -0
- package/{engines/tigerbeetle/version-maps.ts → dist/engines/tigerbeetle/version-maps.js} +22 -31
- package/dist/engines/tigerbeetle/version-maps.js.map +1 -0
- package/dist/engines/tigerbeetle/version-validator.js +108 -0
- package/dist/engines/tigerbeetle/version-validator.js.map +1 -0
- package/dist/engines/typedb/backup.js +129 -0
- package/dist/engines/typedb/backup.js.map +1 -0
- package/dist/engines/typedb/binary-manager.js +151 -0
- package/dist/engines/typedb/binary-manager.js.map +1 -0
- package/dist/engines/typedb/binary-urls.js +33 -0
- package/dist/engines/typedb/binary-urls.js.map +1 -0
- package/dist/engines/typedb/cli-utils.js +163 -0
- package/dist/engines/typedb/cli-utils.js.map +1 -0
- package/dist/engines/typedb/hostdb-releases.js +21 -0
- package/dist/engines/typedb/hostdb-releases.js.map +1 -0
- package/dist/engines/typedb/index.js +1003 -0
- package/dist/engines/typedb/index.js.map +1 -0
- package/dist/engines/typedb/restore.js +279 -0
- package/dist/engines/typedb/restore.js.map +1 -0
- package/dist/engines/typedb/version-maps.js +40 -0
- package/dist/engines/typedb/version-maps.js.map +1 -0
- package/dist/engines/typedb/version-validator.js +103 -0
- package/dist/engines/typedb/version-validator.js.map +1 -0
- package/dist/engines/valkey/backup.js +292 -0
- package/dist/engines/valkey/backup.js.map +1 -0
- package/dist/engines/valkey/binary-manager.js +33 -0
- package/dist/engines/valkey/binary-manager.js.map +1 -0
- package/dist/engines/valkey/binary-urls.js +98 -0
- package/dist/engines/valkey/binary-urls.js.map +1 -0
- package/dist/engines/valkey/cli-utils.js +38 -0
- package/dist/engines/valkey/cli-utils.js.map +1 -0
- package/dist/engines/valkey/hostdb-releases.js +21 -0
- package/dist/engines/valkey/hostdb-releases.js.map +1 -0
- package/dist/engines/valkey/index.js +1257 -0
- package/dist/engines/valkey/index.js.map +1 -0
- package/dist/engines/valkey/restore.js +340 -0
- package/dist/engines/valkey/restore.js.map +1 -0
- package/dist/engines/valkey/version-maps.js +70 -0
- package/dist/engines/valkey/version-maps.js.map +1 -0
- package/dist/engines/valkey/version-validator.js +112 -0
- package/dist/engines/valkey/version-validator.js.map +1 -0
- package/dist/engines/weaviate/api-client.js +50 -0
- package/dist/engines/weaviate/api-client.js.map +1 -0
- package/dist/engines/weaviate/backup.js +95 -0
- package/dist/engines/weaviate/backup.js.map +1 -0
- package/dist/engines/weaviate/binary-manager.js +58 -0
- package/dist/engines/weaviate/binary-manager.js.map +1 -0
- package/dist/engines/weaviate/binary-urls.js +92 -0
- package/dist/engines/weaviate/binary-urls.js.map +1 -0
- package/dist/engines/weaviate/cli-utils.js +39 -0
- package/dist/engines/weaviate/cli-utils.js.map +1 -0
- package/dist/engines/weaviate/hostdb-releases.js +21 -0
- package/dist/engines/weaviate/hostdb-releases.js.map +1 -0
- package/dist/engines/weaviate/index.js +871 -0
- package/dist/engines/weaviate/index.js.map +1 -0
- package/dist/engines/weaviate/restore.js +185 -0
- package/dist/engines/weaviate/restore.js.map +1 -0
- package/dist/engines/weaviate/version-maps.js +67 -0
- package/dist/engines/weaviate/version-maps.js.map +1 -0
- package/dist/engines/weaviate/version-validator.js +109 -0
- package/dist/engines/weaviate/version-validator.js.map +1 -0
- package/dist/types/index.js +102 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +12 -9
- package/bin/cli.js +0 -68
- package/cli/bin.ts +0 -10
- package/cli/commands/attach.ts +0 -139
- package/cli/commands/backup.ts +0 -290
- package/cli/commands/backups.ts +0 -247
- package/cli/commands/clone.ts +0 -159
- package/cli/commands/config.ts +0 -367
- package/cli/commands/connect.ts +0 -684
- package/cli/commands/create.ts +0 -1201
- package/cli/commands/databases.ts +0 -630
- package/cli/commands/delete.ts +0 -133
- package/cli/commands/deps.ts +0 -342
- package/cli/commands/detach.ts +0 -107
- package/cli/commands/doctor.ts +0 -689
- package/cli/commands/duckdb.ts +0 -273
- package/cli/commands/edit.ts +0 -683
- package/cli/commands/engines.ts +0 -1914
- package/cli/commands/export.ts +0 -544
- package/cli/commands/info.ts +0 -340
- package/cli/commands/list.ts +0 -284
- package/cli/commands/logs.ts +0 -102
- package/cli/commands/menu/backup-handlers.ts +0 -1571
- package/cli/commands/menu/container-handlers.ts +0 -2288
- package/cli/commands/menu/engine-handlers.ts +0 -355
- package/cli/commands/menu/index.ts +0 -342
- package/cli/commands/menu/settings-handlers.ts +0 -365
- package/cli/commands/menu/shared.ts +0 -23
- package/cli/commands/menu/shell-handlers.ts +0 -1811
- package/cli/commands/menu/sql-handlers.ts +0 -231
- package/cli/commands/menu/update-handlers.ts +0 -378
- package/cli/commands/menu/validators.ts +0 -8
- package/cli/commands/ports.ts +0 -211
- package/cli/commands/pull.ts +0 -223
- package/cli/commands/query.ts +0 -241
- package/cli/commands/restore.ts +0 -587
- package/cli/commands/run.ts +0 -178
- package/cli/commands/self-update.ts +0 -121
- package/cli/commands/sqlite.ts +0 -273
- package/cli/commands/start.ts +0 -218
- package/cli/commands/stop.ts +0 -241
- package/cli/commands/url.ts +0 -104
- package/cli/commands/users.ts +0 -264
- package/cli/commands/version.ts +0 -55
- package/cli/commands/which.ts +0 -290
- package/cli/constants.ts +0 -233
- package/cli/helpers.ts +0 -1593
- package/cli/index.ts +0 -162
- package/cli/ui/prompts.ts +0 -1525
- package/cli/ui/spinner.ts +0 -88
- package/cli/ui/theme.ts +0 -128
- package/cli/utils/file-follower.ts +0 -93
- package/config/backup-formats.ts +0 -446
- package/config/defaults.ts +0 -56
- package/config/engine-defaults.ts +0 -336
- package/config/engines-registry.ts +0 -150
- package/config/engines.schema.json +0 -135
- package/config/os-dependencies.ts +0 -888
- package/config/paths.ts +0 -200
- package/core/backup-restore.ts +0 -330
- package/core/base-binary-manager.ts +0 -562
- package/core/base-document-binary-manager.ts +0 -523
- package/core/base-embedded-binary-manager.ts +0 -547
- package/core/base-server-binary-manager.ts +0 -523
- package/core/config-manager.ts +0 -652
- package/core/container-manager.ts +0 -787
- package/core/credential-generator.ts +0 -93
- package/core/credential-manager.ts +0 -259
- package/core/dblab-utils.ts +0 -113
- package/core/dependency-manager.ts +0 -512
- package/core/docker-exporter.ts +0 -1345
- package/core/error-handler.ts +0 -419
- package/core/fs-error-utils.ts +0 -82
- package/core/homebrew-version-manager.ts +0 -352
- package/core/hostdb-client.ts +0 -344
- package/core/hostdb-metadata.ts +0 -350
- package/core/hostdb-releases-factory.ts +0 -237
- package/core/library-env.ts +0 -118
- package/core/pgweb-utils.ts +0 -62
- package/core/platform-service.ts +0 -829
- package/core/port-manager.ts +0 -165
- package/core/process-manager.ts +0 -576
- package/core/pull-manager.ts +0 -511
- package/core/query-parser.ts +0 -514
- package/core/spawn-utils.ts +0 -122
- package/core/start-with-retry.ts +0 -130
- package/core/test-cleanup.ts +0 -108
- package/core/tls-generator.ts +0 -116
- package/core/transaction-manager.ts +0 -158
- package/core/update-manager.ts +0 -308
- package/core/version-migration.ts +0 -346
- package/core/version-utils.ts +0 -104
- package/engines/base-engine.ts +0 -340
- package/engines/clickhouse/README.md +0 -231
- package/engines/clickhouse/backup.ts +0 -398
- package/engines/clickhouse/binary-manager.ts +0 -201
- package/engines/clickhouse/binary-urls.ts +0 -125
- package/engines/clickhouse/cli-utils.ts +0 -176
- package/engines/clickhouse/hostdb-releases.ts +0 -30
- package/engines/clickhouse/index.ts +0 -1345
- package/engines/clickhouse/restore.ts +0 -466
- package/engines/clickhouse/version-maps.ts +0 -95
- package/engines/clickhouse/version-validator.ts +0 -154
- package/engines/cockroachdb/README.md +0 -170
- package/engines/cockroachdb/backup.ts +0 -376
- package/engines/cockroachdb/binary-manager.ts +0 -45
- package/engines/cockroachdb/binary-urls.ts +0 -40
- package/engines/cockroachdb/cli-utils.ts +0 -384
- package/engines/cockroachdb/hostdb-releases.ts +0 -26
- package/engines/cockroachdb/index.ts +0 -1276
- package/engines/cockroachdb/restore.ts +0 -455
- package/engines/cockroachdb/version-maps.ts +0 -42
- package/engines/couchdb/README.md +0 -257
- package/engines/couchdb/api-client.ts +0 -81
- package/engines/couchdb/backup.ts +0 -137
- package/engines/couchdb/binary-manager.ts +0 -86
- package/engines/couchdb/binary-urls.ts +0 -115
- package/engines/couchdb/hostdb-releases.ts +0 -23
- package/engines/couchdb/index.ts +0 -1429
- package/engines/couchdb/restore.ts +0 -290
- package/engines/couchdb/version-maps.ts +0 -78
- package/engines/couchdb/version-validator.ts +0 -111
- package/engines/duckdb/README.md +0 -154
- package/engines/duckdb/binary-manager.ts +0 -45
- package/engines/duckdb/hostdb-releases.ts +0 -23
- package/engines/duckdb/index.ts +0 -749
- package/engines/duckdb/registry.ts +0 -303
- package/engines/duckdb/scanner.ts +0 -22
- package/engines/duckdb/version-maps.ts +0 -78
- package/engines/duckdb/version-validator.ts +0 -78
- package/engines/ferretdb/README.md +0 -262
- package/engines/ferretdb/backup.ts +0 -173
- package/engines/ferretdb/binary-manager.ts +0 -1095
- package/engines/ferretdb/binary-urls.ts +0 -183
- package/engines/ferretdb/index.ts +0 -1907
- package/engines/ferretdb/restore.ts +0 -357
- package/engines/file-based-utils.ts +0 -262
- package/engines/index.ts +0 -131
- package/engines/influxdb/README.md +0 -180
- package/engines/influxdb/api-client.ts +0 -64
- package/engines/influxdb/backup.ts +0 -160
- package/engines/influxdb/binary-manager.ts +0 -110
- package/engines/influxdb/binary-urls.ts +0 -69
- package/engines/influxdb/hostdb-releases.ts +0 -23
- package/engines/influxdb/index.ts +0 -1272
- package/engines/influxdb/restore.ts +0 -417
- package/engines/influxdb/version-maps.ts +0 -75
- package/engines/influxdb/version-validator.ts +0 -128
- package/engines/mariadb/README.md +0 -141
- package/engines/mariadb/backup.ts +0 -233
- package/engines/mariadb/binary-manager.ts +0 -45
- package/engines/mariadb/hostdb-releases.ts +0 -23
- package/engines/mariadb/index.ts +0 -1300
- package/engines/mariadb/restore.ts +0 -447
- package/engines/mariadb/version-maps.ts +0 -72
- package/engines/mariadb/version-validator.ts +0 -181
- package/engines/meilisearch/README.md +0 -255
- package/engines/meilisearch/api-client.ts +0 -61
- package/engines/meilisearch/backup.ts +0 -233
- package/engines/meilisearch/binary-manager.ts +0 -43
- package/engines/meilisearch/binary-urls.ts +0 -69
- package/engines/meilisearch/hostdb-releases.ts +0 -26
- package/engines/meilisearch/index.ts +0 -1292
- package/engines/meilisearch/restore.ts +0 -219
- package/engines/meilisearch/version-maps.ts +0 -78
- package/engines/meilisearch/version-validator.ts +0 -128
- package/engines/mongodb/README.md +0 -162
- package/engines/mongodb/backup.ts +0 -127
- package/engines/mongodb/binary-manager.ts +0 -48
- package/engines/mongodb/binary-urls.ts +0 -63
- package/engines/mongodb/cli-utils.ts +0 -171
- package/engines/mongodb/hostdb-releases.ts +0 -91
- package/engines/mongodb/index.ts +0 -1118
- package/engines/mongodb/restore.ts +0 -361
- package/engines/mongodb/version-maps.ts +0 -91
- package/engines/mongodb/version-validator.ts +0 -160
- package/engines/mysql/README.md +0 -142
- package/engines/mysql/backup.ts +0 -270
- package/engines/mysql/binary-detection.ts +0 -408
- package/engines/mysql/binary-manager.ts +0 -42
- package/engines/mysql/binary-urls.ts +0 -104
- package/engines/mysql/index.ts +0 -1361
- package/engines/mysql/restore.ts +0 -500
- package/engines/mysql/version-maps.ts +0 -91
- package/engines/mysql/version-validator.ts +0 -369
- package/engines/postgresql/README.md +0 -158
- package/engines/postgresql/backup.ts +0 -151
- package/engines/postgresql/binary-manager.ts +0 -114
- package/engines/postgresql/binary-urls.ts +0 -99
- package/engines/postgresql/hostdb-releases.ts +0 -26
- package/engines/postgresql/index.ts +0 -1143
- package/engines/postgresql/remote-version.ts +0 -161
- package/engines/postgresql/restore.ts +0 -342
- package/engines/postgresql/version-maps.ts +0 -83
- package/engines/postgresql/version-validator.ts +0 -413
- package/engines/qdrant/README.md +0 -222
- package/engines/qdrant/api-client.ts +0 -61
- package/engines/qdrant/backup.ts +0 -165
- package/engines/qdrant/binary-manager.ts +0 -43
- package/engines/qdrant/binary-urls.ts +0 -115
- package/engines/qdrant/cli-utils.ts +0 -43
- package/engines/qdrant/hostdb-releases.ts +0 -23
- package/engines/qdrant/index.ts +0 -1312
- package/engines/qdrant/restore.ts +0 -203
- package/engines/qdrant/version-maps.ts +0 -78
- package/engines/qdrant/version-validator.ts +0 -128
- package/engines/questdb/README.md +0 -334
- package/engines/questdb/backup.ts +0 -220
- package/engines/questdb/binary-manager.ts +0 -310
- package/engines/questdb/binary-urls.ts +0 -34
- package/engines/questdb/hostdb-releases.ts +0 -23
- package/engines/questdb/index.ts +0 -1023
- package/engines/questdb/restore.ts +0 -260
- package/engines/questdb/version-maps.ts +0 -37
- package/engines/questdb/version-validator.ts +0 -121
- package/engines/redis/README.md +0 -173
- package/engines/redis/backup.ts +0 -389
- package/engines/redis/binary-manager.ts +0 -44
- package/engines/redis/binary-urls.ts +0 -117
- package/engines/redis/cli-utils.ts +0 -42
- package/engines/redis/hostdb-releases.ts +0 -23
- package/engines/redis/index.ts +0 -1583
- package/engines/redis/restore.ts +0 -443
- package/engines/redis/version-maps.ts +0 -81
- package/engines/redis/version-validator.ts +0 -131
- package/engines/sqlite/README.md +0 -162
- package/engines/sqlite/binary-manager.ts +0 -52
- package/engines/sqlite/hostdb-releases.ts +0 -23
- package/engines/sqlite/index.ts +0 -641
- package/engines/sqlite/registry.ts +0 -198
- package/engines/sqlite/scanner.ts +0 -22
- package/engines/sqlite/version-maps.ts +0 -64
- package/engines/surrealdb/README.md +0 -218
- package/engines/surrealdb/backup.ts +0 -131
- package/engines/surrealdb/binary-manager.ts +0 -45
- package/engines/surrealdb/binary-urls.ts +0 -40
- package/engines/surrealdb/cli-utils.ts +0 -173
- package/engines/surrealdb/hostdb-releases.ts +0 -23
- package/engines/surrealdb/index.ts +0 -1246
- package/engines/surrealdb/restore.ts +0 -302
- package/engines/surrealdb/version-maps.ts +0 -41
- package/engines/tigerbeetle/README.md +0 -61
- package/engines/tigerbeetle/backup.ts +0 -49
- package/engines/tigerbeetle/binary-manager.ts +0 -95
- package/engines/tigerbeetle/binary-urls.ts +0 -62
- package/engines/tigerbeetle/hostdb-releases.ts +0 -26
- package/engines/tigerbeetle/index.ts +0 -746
- package/engines/tigerbeetle/restore.ts +0 -130
- package/engines/tigerbeetle/version-validator.ts +0 -126
- package/engines/typedb/backup.ts +0 -167
- package/engines/typedb/binary-manager.ts +0 -200
- package/engines/typedb/binary-urls.ts +0 -40
- package/engines/typedb/cli-utils.ts +0 -210
- package/engines/typedb/hostdb-releases.ts +0 -23
- package/engines/typedb/index.ts +0 -1275
- package/engines/typedb/restore.ts +0 -377
- package/engines/typedb/version-maps.ts +0 -48
- package/engines/typedb/version-validator.ts +0 -127
- package/engines/valkey/README.md +0 -219
- package/engines/valkey/backup.ts +0 -389
- package/engines/valkey/binary-manager.ts +0 -45
- package/engines/valkey/binary-urls.ts +0 -122
- package/engines/valkey/cli-utils.ts +0 -42
- package/engines/valkey/hostdb-releases.ts +0 -23
- package/engines/valkey/index.ts +0 -1585
- package/engines/valkey/restore.ts +0 -446
- package/engines/valkey/version-maps.ts +0 -81
- package/engines/valkey/version-validator.ts +0 -131
- package/engines/weaviate/README.md +0 -302
- package/engines/weaviate/api-client.ts +0 -61
- package/engines/weaviate/backup.ts +0 -145
- package/engines/weaviate/binary-manager.ts +0 -80
- package/engines/weaviate/binary-urls.ts +0 -115
- package/engines/weaviate/cli-utils.ts +0 -43
- package/engines/weaviate/hostdb-releases.ts +0 -23
- package/engines/weaviate/index.ts +0 -1139
- package/engines/weaviate/restore.ts +0 -235
- package/engines/weaviate/version-maps.ts +0 -78
- package/engines/weaviate/version-validator.ts +0 -128
- package/types/index.ts +0 -624
- /package/{config → dist/config}/engines.json +0 -0
|
@@ -1,447 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MariaDB Backup Detection and Restore
|
|
3
|
-
*
|
|
4
|
-
* Handles detecting backup formats and restoring MariaDB dumps.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { spawn, type SpawnOptions } from 'child_process'
|
|
8
|
-
import { createReadStream, existsSync } from 'fs'
|
|
9
|
-
import { open } from 'fs/promises'
|
|
10
|
-
import { join } from 'path'
|
|
11
|
-
import { createGunzip } from 'zlib'
|
|
12
|
-
import { validateRestoreCompatibility } from './version-validator'
|
|
13
|
-
import { getEngineDefaults } from '../../config/defaults'
|
|
14
|
-
import { logDebug, SpinDBError, ErrorCodes } from '../../core/error-handler'
|
|
15
|
-
import { platformService } from '../../core/platform-service'
|
|
16
|
-
import { Platform, type BackupFormat, type RestoreResult } from '../../types'
|
|
17
|
-
|
|
18
|
-
const engineDef = getEngineDefaults('mariadb')
|
|
19
|
-
|
|
20
|
-
// =============================================================================
|
|
21
|
-
// Backup Format Detection
|
|
22
|
-
// =============================================================================
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Detect the format of a MariaDB backup file
|
|
26
|
-
*
|
|
27
|
-
* We detect:
|
|
28
|
-
* - MariaDB SQL dump
|
|
29
|
-
* - MySQL SQL dump (compatible with MariaDB)
|
|
30
|
-
* - PostgreSQL dumps (to provide helpful error)
|
|
31
|
-
* - Generic SQL files
|
|
32
|
-
* - Compressed files (gzip)
|
|
33
|
-
*/
|
|
34
|
-
export async function detectBackupFormat(
|
|
35
|
-
filePath: string,
|
|
36
|
-
): Promise<BackupFormat> {
|
|
37
|
-
const buffer = Buffer.alloc(128)
|
|
38
|
-
const file = await open(filePath, 'r')
|
|
39
|
-
await file.read(buffer, 0, 128, 0)
|
|
40
|
-
await file.close()
|
|
41
|
-
|
|
42
|
-
const header = buffer.toString('utf8')
|
|
43
|
-
|
|
44
|
-
// Check for PostgreSQL custom format (PGDMP magic bytes)
|
|
45
|
-
if (buffer.toString('ascii', 0, 5) === 'PGDMP') {
|
|
46
|
-
return {
|
|
47
|
-
format: 'postgresql_custom',
|
|
48
|
-
description: 'PostgreSQL custom format dump (incompatible with MariaDB)',
|
|
49
|
-
restoreCommand: 'pg_restore',
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Check for PostgreSQL SQL dump markers
|
|
54
|
-
if (
|
|
55
|
-
header.includes('-- PostgreSQL database dump') ||
|
|
56
|
-
header.includes('pg_dump') ||
|
|
57
|
-
header.includes('Dumped from database version')
|
|
58
|
-
) {
|
|
59
|
-
return {
|
|
60
|
-
format: 'postgresql_sql',
|
|
61
|
-
description: 'PostgreSQL SQL dump (incompatible with MariaDB)',
|
|
62
|
-
restoreCommand: 'psql',
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Check for gzip compression
|
|
67
|
-
if (buffer[0] === 0x1f && buffer[1] === 0x8b) {
|
|
68
|
-
return {
|
|
69
|
-
format: 'compressed',
|
|
70
|
-
description: 'Gzip compressed SQL dump',
|
|
71
|
-
restoreCommand: 'mariadb',
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Check for MariaDB dump markers
|
|
76
|
-
if (header.includes('-- MariaDB dump')) {
|
|
77
|
-
return {
|
|
78
|
-
format: 'sql',
|
|
79
|
-
description: 'MariaDB SQL dump (mariadb-dump)',
|
|
80
|
-
restoreCommand: 'mariadb',
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Check for MySQL dump markers (compatible with MariaDB)
|
|
85
|
-
if (header.includes('-- MySQL dump')) {
|
|
86
|
-
return {
|
|
87
|
-
format: 'sql',
|
|
88
|
-
description: 'MySQL SQL dump (compatible with MariaDB)',
|
|
89
|
-
restoreCommand: 'mariadb',
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Check if it looks like SQL (starts with common SQL statements)
|
|
94
|
-
const textStart = header.toLowerCase()
|
|
95
|
-
if (
|
|
96
|
-
textStart.startsWith('--') ||
|
|
97
|
-
textStart.startsWith('/*') ||
|
|
98
|
-
textStart.startsWith('set ') ||
|
|
99
|
-
textStart.startsWith('create') ||
|
|
100
|
-
textStart.startsWith('drop') ||
|
|
101
|
-
textStart.startsWith('begin') ||
|
|
102
|
-
textStart.startsWith('use ')
|
|
103
|
-
) {
|
|
104
|
-
return {
|
|
105
|
-
format: 'sql',
|
|
106
|
-
description: 'SQL file',
|
|
107
|
-
restoreCommand: 'mariadb',
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Default to SQL format
|
|
112
|
-
return {
|
|
113
|
-
format: 'unknown',
|
|
114
|
-
description: 'Unknown format - will attempt as SQL',
|
|
115
|
-
restoreCommand: 'mariadb',
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Check if the backup file is from the wrong engine and throw helpful error
|
|
120
|
-
export function assertCompatibleFormat(format: BackupFormat): void {
|
|
121
|
-
if (
|
|
122
|
-
format.format === 'postgresql_custom' ||
|
|
123
|
-
format.format === 'postgresql_sql'
|
|
124
|
-
) {
|
|
125
|
-
throw new SpinDBError(
|
|
126
|
-
ErrorCodes.WRONG_ENGINE_DUMP,
|
|
127
|
-
`This appears to be a PostgreSQL dump file, but you're trying to restore it to MariaDB.`,
|
|
128
|
-
'fatal',
|
|
129
|
-
`Create a PostgreSQL container instead:\n spindb create mydb --engine postgresql --from <dump-file>`,
|
|
130
|
-
{
|
|
131
|
-
detectedFormat: format.format,
|
|
132
|
-
expectedEngine: 'mariadb',
|
|
133
|
-
detectedEngine: 'postgresql',
|
|
134
|
-
},
|
|
135
|
-
)
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// =============================================================================
|
|
140
|
-
// Restore Options
|
|
141
|
-
// =============================================================================
|
|
142
|
-
|
|
143
|
-
export type RestoreOptions = {
|
|
144
|
-
port: number
|
|
145
|
-
database: string
|
|
146
|
-
user?: string
|
|
147
|
-
createDatabase?: boolean
|
|
148
|
-
validateVersion?: boolean
|
|
149
|
-
binPath: string
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// Get the path to mariadb or mysql client from the binary path
|
|
153
|
-
function getMysqlClientPath(binPath: string): string {
|
|
154
|
-
const { platform } = platformService.getPlatformInfo()
|
|
155
|
-
const ext = platform === Platform.Win32 ? '.exe' : ''
|
|
156
|
-
|
|
157
|
-
// Try mariadb first, then mysql
|
|
158
|
-
const mariadb = join(binPath, 'bin', `mariadb${ext}`)
|
|
159
|
-
if (existsSync(mariadb)) {
|
|
160
|
-
return mariadb
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const mysql = join(binPath, 'bin', `mysql${ext}`)
|
|
164
|
-
if (existsSync(mysql)) {
|
|
165
|
-
return mysql
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
throw new Error(
|
|
169
|
-
'mariadb or mysql client not found in MariaDB binary directory.\n' +
|
|
170
|
-
'Re-download the MariaDB binaries: spindb engines download mariadb',
|
|
171
|
-
)
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// =============================================================================
|
|
175
|
-
// Restore Functions
|
|
176
|
-
// =============================================================================
|
|
177
|
-
|
|
178
|
-
// Compatibility SQL to handle large row sizes and other edge cases
|
|
179
|
-
// - innodb_default_row_format=DYNAMIC: Store long columns off-page to avoid row size limits
|
|
180
|
-
// - innodb_strict_mode=OFF: Allow tables that might exceed row size limits in strict mode
|
|
181
|
-
// - foreign_key_checks=0: Defer FK checks until after all tables are created
|
|
182
|
-
// - unique_checks=0: Speed up bulk inserts
|
|
183
|
-
const COMPAT_INIT_SQL = [
|
|
184
|
-
"SET GLOBAL innodb_default_row_format='dynamic';",
|
|
185
|
-
'SET SESSION innodb_strict_mode=OFF;',
|
|
186
|
-
"SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION';",
|
|
187
|
-
'SET SESSION foreign_key_checks=0;',
|
|
188
|
-
'SET SESSION unique_checks=0;',
|
|
189
|
-
'',
|
|
190
|
-
].join('\n')
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Internal restore function with optional compatibility mode
|
|
194
|
-
*/
|
|
195
|
-
function doRestore(
|
|
196
|
-
backupPath: string,
|
|
197
|
-
mysql: string,
|
|
198
|
-
port: number,
|
|
199
|
-
database: string,
|
|
200
|
-
user: string,
|
|
201
|
-
format: BackupFormat,
|
|
202
|
-
withCompatSettings: boolean,
|
|
203
|
-
): Promise<RestoreResult & { rawStderr?: string }> {
|
|
204
|
-
const spawnOptions: SpawnOptions = {
|
|
205
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return new Promise((resolve, reject) => {
|
|
209
|
-
const args = ['-h', '127.0.0.1', '-P', String(port), '-u', user, database]
|
|
210
|
-
|
|
211
|
-
logDebug('Restoring backup with mariadb client', {
|
|
212
|
-
mysql,
|
|
213
|
-
args,
|
|
214
|
-
withCompatSettings,
|
|
215
|
-
})
|
|
216
|
-
|
|
217
|
-
const proc = spawn(mysql, args, spawnOptions)
|
|
218
|
-
|
|
219
|
-
// Track whether we've already settled the promise to avoid duplicate rejections
|
|
220
|
-
let settled = false
|
|
221
|
-
const fileStream = createReadStream(backupPath)
|
|
222
|
-
|
|
223
|
-
const rejectOnce = (err: Error) => {
|
|
224
|
-
if (settled) return
|
|
225
|
-
settled = true
|
|
226
|
-
fileStream.destroy()
|
|
227
|
-
proc.stdin?.end()
|
|
228
|
-
reject(err)
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// Handle file read errors
|
|
232
|
-
fileStream.on('error', (err) => {
|
|
233
|
-
rejectOnce(new Error(`Failed to read backup file: ${err.message}`))
|
|
234
|
-
})
|
|
235
|
-
|
|
236
|
-
if (!proc.stdin) {
|
|
237
|
-
rejectOnce(
|
|
238
|
-
new Error(
|
|
239
|
-
'MariaDB process stdin is not available, cannot restore backup',
|
|
240
|
-
),
|
|
241
|
-
)
|
|
242
|
-
return
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// Handle EPIPE errors on stdin - this happens when mariadb exits due to SQL errors
|
|
246
|
-
// while we're still piping data. The actual error will be in stderr.
|
|
247
|
-
proc.stdin.on('error', (err) => {
|
|
248
|
-
// EPIPE is expected when the process exits early - don't reject here,
|
|
249
|
-
// let the 'close' event handle it with the actual error from stderr
|
|
250
|
-
if ((err as NodeJS.ErrnoException).code !== 'EPIPE') {
|
|
251
|
-
rejectOnce(
|
|
252
|
-
new Error(`Failed to write to MariaDB process: ${err.message}`),
|
|
253
|
-
)
|
|
254
|
-
}
|
|
255
|
-
})
|
|
256
|
-
|
|
257
|
-
// Prepend compatibility settings if requested
|
|
258
|
-
if (withCompatSettings) {
|
|
259
|
-
proc.stdin.write(COMPAT_INIT_SQL)
|
|
260
|
-
logDebug('Prepended compatibility settings to restore')
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
if (format.format === 'compressed') {
|
|
264
|
-
// Decompress gzipped file before piping to mariadb
|
|
265
|
-
const gunzip = createGunzip()
|
|
266
|
-
fileStream.pipe(gunzip).pipe(proc.stdin)
|
|
267
|
-
|
|
268
|
-
// Handle gunzip errors
|
|
269
|
-
gunzip.on('error', (err) => {
|
|
270
|
-
fileStream.unpipe(gunzip)
|
|
271
|
-
gunzip.unpipe(proc.stdin!)
|
|
272
|
-
rejectOnce(
|
|
273
|
-
new Error(`Failed to decompress backup file: ${err.message}`),
|
|
274
|
-
)
|
|
275
|
-
})
|
|
276
|
-
} else {
|
|
277
|
-
fileStream.pipe(proc.stdin)
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
let stdout = ''
|
|
281
|
-
let stderr = ''
|
|
282
|
-
|
|
283
|
-
proc.stdout?.on('data', (data: Buffer) => {
|
|
284
|
-
stdout += data.toString()
|
|
285
|
-
})
|
|
286
|
-
proc.stderr?.on('data', (data: Buffer) => {
|
|
287
|
-
stderr += data.toString()
|
|
288
|
-
})
|
|
289
|
-
|
|
290
|
-
proc.on('close', (code) => {
|
|
291
|
-
if (settled) return
|
|
292
|
-
settled = true
|
|
293
|
-
|
|
294
|
-
resolve({
|
|
295
|
-
format: format.format,
|
|
296
|
-
stdout,
|
|
297
|
-
stderr,
|
|
298
|
-
rawStderr: stderr,
|
|
299
|
-
code: code ?? undefined,
|
|
300
|
-
})
|
|
301
|
-
})
|
|
302
|
-
|
|
303
|
-
proc.on('error', (err) => {
|
|
304
|
-
rejectOnce(err)
|
|
305
|
-
})
|
|
306
|
-
})
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Restore a MariaDB backup to a database
|
|
311
|
-
*
|
|
312
|
-
* CLI equivalent: mariadb -h 127.0.0.1 -P {port} -u root {db} < {file}
|
|
313
|
-
*
|
|
314
|
-
* Uses retry logic: if restore fails with ERROR 1118 (row size too large),
|
|
315
|
-
* automatically retries with compatibility settings that enable DYNAMIC row format.
|
|
316
|
-
*/
|
|
317
|
-
export async function restoreBackup(
|
|
318
|
-
backupPath: string,
|
|
319
|
-
options: RestoreOptions,
|
|
320
|
-
): Promise<RestoreResult> {
|
|
321
|
-
const {
|
|
322
|
-
port,
|
|
323
|
-
database,
|
|
324
|
-
user = engineDef.superuser,
|
|
325
|
-
validateVersion = true,
|
|
326
|
-
binPath,
|
|
327
|
-
} = options
|
|
328
|
-
|
|
329
|
-
// Validate version compatibility if requested
|
|
330
|
-
if (validateVersion) {
|
|
331
|
-
try {
|
|
332
|
-
await validateRestoreCompatibility({ dumpPath: backupPath })
|
|
333
|
-
} catch (error) {
|
|
334
|
-
// Re-throw SpinDBError, log and continue for other errors
|
|
335
|
-
if (error instanceof Error && error.name === 'SpinDBError') {
|
|
336
|
-
throw error
|
|
337
|
-
}
|
|
338
|
-
logDebug('Version validation failed, proceeding anyway', {
|
|
339
|
-
error: error instanceof Error ? error.message : String(error),
|
|
340
|
-
})
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
const mysql = getMysqlClientPath(binPath)
|
|
345
|
-
|
|
346
|
-
// Detect format and check for wrong engine
|
|
347
|
-
const format = await detectBackupFormat(backupPath)
|
|
348
|
-
logDebug('Detected backup format', { format: format.format })
|
|
349
|
-
assertCompatibleFormat(format)
|
|
350
|
-
|
|
351
|
-
// First attempt: try without compatibility settings
|
|
352
|
-
const result = await doRestore(
|
|
353
|
-
backupPath,
|
|
354
|
-
mysql,
|
|
355
|
-
port,
|
|
356
|
-
database,
|
|
357
|
-
user,
|
|
358
|
-
format,
|
|
359
|
-
false,
|
|
360
|
-
)
|
|
361
|
-
|
|
362
|
-
// Check if restore succeeded
|
|
363
|
-
if (result.code === 0) {
|
|
364
|
-
return result
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
// Check if it failed with row size error (ERROR 1118)
|
|
368
|
-
// This happens when tables have too many VARCHAR columns for the default row format
|
|
369
|
-
const isRowSizeError =
|
|
370
|
-
result.rawStderr?.includes('ERROR 1118') ||
|
|
371
|
-
result.rawStderr?.includes('Row size too large')
|
|
372
|
-
|
|
373
|
-
if (isRowSizeError) {
|
|
374
|
-
logDebug('Detected row size error, retrying with compatibility settings')
|
|
375
|
-
|
|
376
|
-
// Retry with compatibility settings
|
|
377
|
-
const retryResult = await doRestore(
|
|
378
|
-
backupPath,
|
|
379
|
-
mysql,
|
|
380
|
-
port,
|
|
381
|
-
database,
|
|
382
|
-
user,
|
|
383
|
-
format,
|
|
384
|
-
true,
|
|
385
|
-
)
|
|
386
|
-
|
|
387
|
-
if (retryResult.code === 0) {
|
|
388
|
-
return {
|
|
389
|
-
...retryResult,
|
|
390
|
-
stdout:
|
|
391
|
-
retryResult.stdout ||
|
|
392
|
-
'Restore succeeded with compatibility mode (DYNAMIC row format)',
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
// Still failed - report the retry error
|
|
397
|
-
const errorMatch = retryResult.rawStderr?.match(/^ERROR\s+\d+.*$/m)
|
|
398
|
-
const errorMessage = errorMatch
|
|
399
|
-
? errorMatch[0]
|
|
400
|
-
: retryResult.rawStderr?.trim() || 'Unknown error'
|
|
401
|
-
throw new Error(`MariaDB restore failed: ${errorMessage}`)
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
// Failed with a different error - report it
|
|
405
|
-
const errorMatch = result.rawStderr?.match(/^ERROR\s+\d+.*$/m)
|
|
406
|
-
const errorMessage = errorMatch
|
|
407
|
-
? errorMatch[0]
|
|
408
|
-
: result.rawStderr?.trim() || 'Unknown error'
|
|
409
|
-
throw new Error(`MariaDB restore failed: ${errorMessage}`)
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* Parse a MariaDB/MySQL connection string
|
|
414
|
-
*
|
|
415
|
-
* Format: mysql://user:pass@host:port/database
|
|
416
|
-
* mariadb://user:pass@host:port/database
|
|
417
|
-
*/
|
|
418
|
-
export function parseConnectionString(connectionString: string): {
|
|
419
|
-
host: string
|
|
420
|
-
port: string
|
|
421
|
-
user: string
|
|
422
|
-
password: string
|
|
423
|
-
database: string
|
|
424
|
-
} {
|
|
425
|
-
let url: URL
|
|
426
|
-
try {
|
|
427
|
-
url = new URL(connectionString)
|
|
428
|
-
} catch (err) {
|
|
429
|
-
const message = err instanceof Error ? err.message : String(err)
|
|
430
|
-
throw new Error(`Invalid MariaDB connection string: ${message}`)
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
const database = url.pathname.slice(1) // Remove leading /
|
|
434
|
-
if (!database) {
|
|
435
|
-
throw new Error(
|
|
436
|
-
'Invalid MariaDB connection string: database name is required (e.g., mysql://user:pass@host:port/database)',
|
|
437
|
-
)
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
return {
|
|
441
|
-
host: url.hostname,
|
|
442
|
-
port: url.port || '3306',
|
|
443
|
-
user: url.username || 'root',
|
|
444
|
-
password: url.password || '',
|
|
445
|
-
database,
|
|
446
|
-
}
|
|
447
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MariaDB Version Maps
|
|
3
|
-
*
|
|
4
|
-
* TEMPORARY: This version map will be replaced by the hostdb npm package once published.
|
|
5
|
-
* Until then, manually keep this in sync with robertjbass/hostdb releases.json:
|
|
6
|
-
* https://github.com/robertjbass/hostdb/blob/main/releases.json
|
|
7
|
-
*
|
|
8
|
-
* When updating versions:
|
|
9
|
-
* 1. Check hostdb releases.json for available versions
|
|
10
|
-
* 2. Update MARIADB_VERSION_MAP to match
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { logDebug } from '../../core/error-handler'
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Map of major MariaDB versions to their latest stable patch versions.
|
|
17
|
-
* Must match versions available in hostdb releases.json.
|
|
18
|
-
*/
|
|
19
|
-
export const MARIADB_VERSION_MAP: Record<string, string> = {
|
|
20
|
-
// 1-part: major version → LTS
|
|
21
|
-
'10': '10.11.15',
|
|
22
|
-
'11': '11.8.5',
|
|
23
|
-
// 2-part: major.minor → latest patch
|
|
24
|
-
'10.11': '10.11.15',
|
|
25
|
-
'11.4': '11.4.5',
|
|
26
|
-
'11.8': '11.8.5',
|
|
27
|
-
// 3-part: exact version (identity mapping)
|
|
28
|
-
'10.11.15': '10.11.15',
|
|
29
|
-
'11.4.5': '11.4.5',
|
|
30
|
-
'11.8.5': '11.8.5',
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Supported major MariaDB versions (2-part format).
|
|
35
|
-
* Derived from MARIADB_VERSION_MAP keys to avoid duplication.
|
|
36
|
-
* Used for grouping and display purposes.
|
|
37
|
-
*/
|
|
38
|
-
export const SUPPORTED_MAJOR_VERSIONS = Object.keys(MARIADB_VERSION_MAP).filter(
|
|
39
|
-
(key) => key.split('.').length === 2,
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Get the full version string for a major version.
|
|
44
|
-
*
|
|
45
|
-
* @param majorVersion - Major version (e.g., '11.8')
|
|
46
|
-
* @returns Full version string (e.g., '11.8.5') or null if not supported
|
|
47
|
-
*/
|
|
48
|
-
export function getFullVersion(majorVersion: string): string | null {
|
|
49
|
-
return MARIADB_VERSION_MAP[majorVersion] || null
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Normalize a version string to X.Y.Z format.
|
|
54
|
-
*
|
|
55
|
-
* @param version - Version string (e.g., '11.8', '11.8.5')
|
|
56
|
-
* @returns Normalized version (e.g., '11.8.5')
|
|
57
|
-
*/
|
|
58
|
-
export function normalizeVersion(version: string): string {
|
|
59
|
-
// If it's a version key in the map (major, major.minor, or full), return the mapped version
|
|
60
|
-
// Identity mappings for 3-part versions (e.g., '11.8.5' -> '11.8.5') are already in the map
|
|
61
|
-
const fullVersion = MARIADB_VERSION_MAP[version]
|
|
62
|
-
if (fullVersion) {
|
|
63
|
-
return fullVersion
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Unknown version - log debug and return as-is
|
|
67
|
-
// This may cause download failures if the version doesn't exist in hostdb
|
|
68
|
-
logDebug(
|
|
69
|
-
`MariaDB version '${version}' not in version map, may not be available in hostdb`,
|
|
70
|
-
)
|
|
71
|
-
return version
|
|
72
|
-
}
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MariaDB Version Validator
|
|
3
|
-
*
|
|
4
|
-
* Validates version compatibility for MariaDB dump files and databases.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { exec } from 'child_process'
|
|
8
|
-
import { promisify } from 'util'
|
|
9
|
-
import { open } from 'fs/promises'
|
|
10
|
-
import { logDebug } from '../../core/error-handler'
|
|
11
|
-
|
|
12
|
-
const execAsync = promisify(exec)
|
|
13
|
-
|
|
14
|
-
// Parse version string into components
|
|
15
|
-
export function parseVersion(version: string): {
|
|
16
|
-
major: number
|
|
17
|
-
minor: number
|
|
18
|
-
patch: number
|
|
19
|
-
full: string
|
|
20
|
-
} {
|
|
21
|
-
const parts = version.split('.').map(Number)
|
|
22
|
-
return {
|
|
23
|
-
major: parts[0] || 0,
|
|
24
|
-
minor: parts[1] || 0,
|
|
25
|
-
patch: parts[2] || 0,
|
|
26
|
-
full: version,
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Extract MariaDB version from dump file header
|
|
31
|
-
export async function extractDumpVersion(
|
|
32
|
-
dumpPath: string,
|
|
33
|
-
): Promise<{ version: string; isMariaDB: boolean } | null> {
|
|
34
|
-
try {
|
|
35
|
-
const file = await open(dumpPath, 'r')
|
|
36
|
-
const buffer = Buffer.alloc(2048)
|
|
37
|
-
await file.read(buffer, 0, 2048, 0)
|
|
38
|
-
await file.close()
|
|
39
|
-
|
|
40
|
-
const header = buffer.toString('utf8')
|
|
41
|
-
|
|
42
|
-
// Look for MariaDB dump header
|
|
43
|
-
// Example: "-- MariaDB dump 10.19 Distrib 11.8.5-MariaDB"
|
|
44
|
-
const mariadbMatch = header.match(
|
|
45
|
-
/MariaDB dump \S+\s+Distrib (\d+\.\d+\.\d+)/,
|
|
46
|
-
)
|
|
47
|
-
if (mariadbMatch) {
|
|
48
|
-
return { version: mariadbMatch[1], isMariaDB: true }
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Look for MySQL dump header (MariaDB dumps sometimes say MySQL)
|
|
52
|
-
// Example: "-- MySQL dump 10.19 Distrib 11.8.5-MariaDB"
|
|
53
|
-
const mysqlMatch = header.match(/MySQL dump \S+\s+Distrib (\d+\.\d+\.\d+)/)
|
|
54
|
-
if (mysqlMatch) {
|
|
55
|
-
// Check if it's actually MariaDB
|
|
56
|
-
const isMariaDB = header.includes('MariaDB')
|
|
57
|
-
return { version: mysqlMatch[1], isMariaDB }
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Try server version comment
|
|
61
|
-
// Example: "-- Server version: 11.8.5-MariaDB"
|
|
62
|
-
const serverMatch = header.match(/Server version:\s+(\d+\.\d+\.\d+)/)
|
|
63
|
-
if (serverMatch) {
|
|
64
|
-
const isMariaDB = header.includes('MariaDB')
|
|
65
|
-
return { version: serverMatch[1], isMariaDB }
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return null
|
|
69
|
-
} catch (error) {
|
|
70
|
-
logDebug('Failed to extract dump version', {
|
|
71
|
-
error: error instanceof Error ? error.message : String(error),
|
|
72
|
-
})
|
|
73
|
-
return null
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Get the installed MariaDB server version
|
|
78
|
-
export async function getInstalledVersion(
|
|
79
|
-
binaryPath: string,
|
|
80
|
-
): Promise<string | null> {
|
|
81
|
-
try {
|
|
82
|
-
const { stdout } = await execAsync(`"${binaryPath}" --version`)
|
|
83
|
-
// Parse output like "mariadbd Ver 11.8.5-MariaDB"
|
|
84
|
-
const match = stdout.match(/Ver\s+(\d+\.\d+\.\d+)/)
|
|
85
|
-
if (match) {
|
|
86
|
-
return match[1]
|
|
87
|
-
}
|
|
88
|
-
return null
|
|
89
|
-
} catch {
|
|
90
|
-
return null
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Get the installed mysql client version
|
|
95
|
-
export async function getMysqlClientVersion(
|
|
96
|
-
binaryPath: string,
|
|
97
|
-
): Promise<string | null> {
|
|
98
|
-
try {
|
|
99
|
-
const { stdout } = await execAsync(`"${binaryPath}" --version`)
|
|
100
|
-
// Parse output like "mysql Ver 15.1 Distrib 11.8.5-MariaDB"
|
|
101
|
-
const match = stdout.match(/Distrib (\d+\.\d+\.\d+)/)
|
|
102
|
-
if (match) {
|
|
103
|
-
return match[1]
|
|
104
|
-
}
|
|
105
|
-
return null
|
|
106
|
-
} catch {
|
|
107
|
-
return null
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Validate dump compatibility options
|
|
112
|
-
export type ValidateOptions = {
|
|
113
|
-
dumpPath: string
|
|
114
|
-
targetVersion?: string
|
|
115
|
-
strict?: boolean
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Validate that a dump file is compatible with a target MariaDB version
|
|
120
|
-
*
|
|
121
|
-
* MariaDB is generally backward compatible within major versions.
|
|
122
|
-
*/
|
|
123
|
-
export async function validateRestoreCompatibility(
|
|
124
|
-
options: ValidateOptions,
|
|
125
|
-
): Promise<{ compatible: boolean; warning?: string }> {
|
|
126
|
-
const { dumpPath, targetVersion, strict = false } = options
|
|
127
|
-
|
|
128
|
-
const dumpInfo = await extractDumpVersion(dumpPath)
|
|
129
|
-
|
|
130
|
-
if (!dumpInfo) {
|
|
131
|
-
// Can't determine version - allow restore with warning
|
|
132
|
-
return {
|
|
133
|
-
compatible: true,
|
|
134
|
-
warning: 'Could not determine dump version. Proceeding anyway.',
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// If no target version specified, just validate the dump is readable
|
|
139
|
-
if (!targetVersion) {
|
|
140
|
-
return { compatible: true }
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const dumpVer = parseVersion(dumpInfo.version)
|
|
144
|
-
const targetVer = parseVersion(targetVersion)
|
|
145
|
-
|
|
146
|
-
// MariaDB is backward compatible - newer versions can restore older dumps
|
|
147
|
-
if (targetVer.major > dumpVer.major) {
|
|
148
|
-
return { compatible: true }
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Same major version - should be compatible
|
|
152
|
-
if (targetVer.major === dumpVer.major) {
|
|
153
|
-
if (targetVer.minor >= dumpVer.minor) {
|
|
154
|
-
return { compatible: true }
|
|
155
|
-
}
|
|
156
|
-
// Restoring newer minor to older minor
|
|
157
|
-
if (strict) {
|
|
158
|
-
return {
|
|
159
|
-
compatible: false,
|
|
160
|
-
warning: `Dump is from MariaDB ${dumpInfo.version} but target is ${targetVersion}. Newer dumps may use features not available in older versions.`,
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return {
|
|
164
|
-
compatible: true,
|
|
165
|
-
warning: `Dump is from MariaDB ${dumpInfo.version} but target is ${targetVersion}. This may work but some features might not be supported.`,
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// Restoring dump from newer major version to older major version
|
|
170
|
-
if (strict) {
|
|
171
|
-
return {
|
|
172
|
-
compatible: false,
|
|
173
|
-
warning: `Dump is from MariaDB ${dumpInfo.version} but target is ${targetVersion}. Cross-major-version restore may fail.`,
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
return {
|
|
178
|
-
compatible: true,
|
|
179
|
-
warning: `Dump is from MariaDB ${dumpInfo.version} but target is ${targetVersion}. Cross-major-version restore may have compatibility issues.`,
|
|
180
|
-
}
|
|
181
|
-
}
|