spindb 0.31.3 → 0.32.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/README.md +43 -10
- package/cli/commands/engines.ts +179 -1
- package/cli/commands/menu/backup-handlers.ts +7 -0
- package/cli/commands/menu/container-handlers.ts +179 -32
- package/cli/commands/menu/engine-handlers.ts +2 -0
- package/cli/commands/menu/settings-handlers.ts +3 -0
- package/cli/commands/menu/shell-handlers.ts +31 -13
- package/cli/commands/menu/sql-handlers.ts +8 -50
- package/cli/commands/menu/validators.ts +8 -0
- package/cli/commands/users.ts +264 -0
- package/cli/constants.ts +4 -0
- package/cli/helpers.ts +67 -0
- package/cli/index.ts +2 -0
- package/cli/ui/prompts.ts +95 -119
- package/config/backup-formats.ts +14 -0
- package/config/engine-defaults.ts +13 -0
- package/config/engines-registry.ts +1 -0
- package/config/engines.json +33 -0
- package/config/engines.schema.json +6 -1
- package/core/base-binary-manager.ts +6 -1
- package/core/config-manager.ts +10 -0
- package/core/credential-manager.ts +257 -0
- package/core/dependency-manager.ts +3 -0
- package/core/docker-exporter.ts +17 -0
- package/core/error-handler.ts +19 -0
- package/engines/base-engine.ts +32 -1
- package/engines/clickhouse/index.ts +99 -3
- package/engines/cockroachdb/index.ts +69 -2
- package/engines/couchdb/index.ts +149 -1
- package/engines/ferretdb/README.md +4 -0
- package/engines/ferretdb/index.ts +345 -13
- package/engines/index.ts +4 -0
- package/engines/mariadb/index.ts +96 -1
- package/engines/meilisearch/index.ts +97 -1
- package/engines/mongodb/index.ts +82 -0
- package/engines/mysql/index.ts +105 -1
- package/engines/postgresql/index.ts +92 -0
- package/engines/qdrant/index.ts +107 -2
- package/engines/redis/index.ts +106 -12
- package/engines/surrealdb/index.ts +102 -2
- package/engines/typedb/backup.ts +167 -0
- package/engines/typedb/binary-manager.ts +200 -0
- package/engines/typedb/binary-urls.ts +38 -0
- package/engines/typedb/cli-utils.ts +210 -0
- package/engines/typedb/hostdb-releases.ts +118 -0
- package/engines/typedb/index.ts +1275 -0
- package/engines/typedb/restore.ts +377 -0
- package/engines/typedb/version-maps.ts +48 -0
- package/engines/typedb/version-validator.ts +127 -0
- package/engines/valkey/index.ts +70 -2
- package/package.json +7 -2
- package/types/index.ts +28 -0
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
**One CLI for all your local databases.**
|
|
9
9
|
|
|
10
|
-
SpinDB is a universal database management tool that combines a package manager, a unified API, and native client tooling for
|
|
10
|
+
SpinDB is a universal database management tool that combines a package manager, a unified API, and native client tooling for 17 different database engines—all from a single command-line interface. No Docker, no VMs, no platform-specific installers. Just databases, running natively on your machine.
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
13
|
npm install -g spindb
|
|
@@ -28,7 +28,7 @@ spindb create cache --engine redis
|
|
|
28
28
|
|
|
29
29
|
## Supported Engines & Platforms
|
|
30
30
|
|
|
31
|
-
SpinDB supports **
|
|
31
|
+
SpinDB supports **17 database engines** across **5 platform architectures**—all with a consistent API.
|
|
32
32
|
|
|
33
33
|
| Engine | Type | macOS ARM | macOS Intel | Linux x64 | Linux ARM | Windows |
|
|
34
34
|
|--------|------|:---------:|:-----------:|:---------:|:---------:|:-------:|
|
|
@@ -48,8 +48,9 @@ SpinDB supports **16 database engines** across **5 platform architectures**—al
|
|
|
48
48
|
| 🪳 **CockroachDB** | Distributed SQL | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
49
49
|
| 🌀 **SurrealDB** | Multi-Model | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
50
50
|
| ⏱️ **QuestDB** | Time-Series | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
51
|
+
| 🤖 **TypeDB** | Knowledge Graph | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
51
52
|
|
|
52
|
-
**
|
|
53
|
+
**83 combinations. One CLI. Zero configuration.**
|
|
53
54
|
|
|
54
55
|
> ClickHouse and FerretDB are available on Windows via WSL.
|
|
55
56
|
|
|
@@ -77,7 +78,7 @@ One consistent interface across SQL databases, document stores, key-value stores
|
|
|
77
78
|
|
|
78
79
|
```bash
|
|
79
80
|
# Same commands work for ANY database
|
|
80
|
-
spindb create mydb --engine [postgresql|mysql|mariadb|mongodb|ferretdb|redis|valkey|clickhouse|sqlite|duckdb|qdrant|meilisearch|couchdb|cockroachdb|surrealdb|questdb]
|
|
81
|
+
spindb create mydb --engine [postgresql|mysql|mariadb|mongodb|ferretdb|redis|valkey|clickhouse|sqlite|duckdb|qdrant|meilisearch|couchdb|cockroachdb|surrealdb|questdb|typedb]
|
|
81
82
|
spindb start mydb
|
|
82
83
|
spindb connect mydb
|
|
83
84
|
spindb backup mydb
|
|
@@ -173,7 +174,7 @@ SpinDB runs databases as **native processes** with **isolated data directories**
|
|
|
173
174
|
|
|
174
175
|
| Feature | SpinDB | DBngin | Postgres.app | Laragon |
|
|
175
176
|
|---------|--------|--------|--------------|---------|
|
|
176
|
-
| **Engines supported** |
|
|
177
|
+
| **Engines supported** | 17 | 3 (PG/MySQL/Redis) | 1 (PostgreSQL) | 4 (PG/MySQL/MariaDB/MongoDB) |
|
|
177
178
|
| CLI-first | ✅ | ❌ GUI-only | ❌ GUI-only | ⚠️ Limited CLI |
|
|
178
179
|
| Multi-version support | ✅ | ✅ | ✅ | ✅ |
|
|
179
180
|
| Built-in backup/restore | ✅ | ✅ | ❌ | ⚠️ Manual |
|
|
@@ -189,7 +190,7 @@ SpinDB runs databases as **native processes** with **isolated data directories**
|
|
|
189
190
|
|
|
190
191
|
| Feature | SpinDB | Docker Desktop | Podman | OrbStack |
|
|
191
192
|
|---------|--------|----------------|--------|----------|
|
|
192
|
-
| **Engines supported** |
|
|
193
|
+
| **Engines supported** | 17 unified | Any (manual setup) | Any (manual setup) | Any (manual setup) |
|
|
193
194
|
| Daemon required | ❌ | ✅ | ❌ (rootless) | ✅ |
|
|
194
195
|
| Resource overhead | Native | VM + containers | VM + containers | VM + containers |
|
|
195
196
|
| Built-in backup/restore | ✅ | ❌ Manual | ❌ Manual | ❌ Manual |
|
|
@@ -205,7 +206,7 @@ SpinDB runs databases as **native processes** with **isolated data directories**
|
|
|
205
206
|
|
|
206
207
|
| Feature | SpinDB | Homebrew | apt/winget | asdf-vm |
|
|
207
208
|
|---------|--------|----------|------------|---------|
|
|
208
|
-
| **Engines supported** |
|
|
209
|
+
| **Engines supported** | 17 unified | Many (separate formulas) | Many (separate packages) | Many (plugins) |
|
|
209
210
|
| Multi-version side-by-side | ✅ | ⚠️ Complex | ❌ | ✅ |
|
|
210
211
|
| Isolated data directories | ✅ | ❌ System-wide | ❌ System-wide | ❌ |
|
|
211
212
|
| Built-in backup/restore | ✅ | ❌ | ❌ | ❌ |
|
|
@@ -222,7 +223,7 @@ SpinDB runs databases as **native processes** with **isolated data directories**
|
|
|
222
223
|
|
|
223
224
|
## Supported Databases
|
|
224
225
|
|
|
225
|
-
SpinDB supports **
|
|
226
|
+
SpinDB supports **17 database engines** with **multiple versions** for each:
|
|
226
227
|
|
|
227
228
|
| Engine | Type | Versions | Default Port | Query Language |
|
|
228
229
|
|--------|------|----------|--------------|----------------|
|
|
@@ -242,10 +243,11 @@ SpinDB supports **16 database engines** with **multiple versions** for each:
|
|
|
242
243
|
| 🪳 **CockroachDB** | Distributed SQL | 25 | 26257 | SQL (PostgreSQL-compatible) |
|
|
243
244
|
| 🌀 **SurrealDB** | Multi-Model | 2 | 8000 | SurrealQL |
|
|
244
245
|
| ⏱️ **QuestDB** | Time-Series SQL | 9 | 8812 (PG), 9000 (HTTP) | SQL |
|
|
246
|
+
| 🤖 **TypeDB** | Knowledge Graph | 3 | 1729, 8000 (HTTP) | TypeQL |
|
|
245
247
|
|
|
246
248
|
### Engine Categories
|
|
247
249
|
|
|
248
|
-
**Server-Based Databases** (PostgreSQL, MySQL, MariaDB, MongoDB, FerretDB, Redis, Valkey, ClickHouse, Qdrant, Meilisearch, CouchDB, CockroachDB, SurrealDB, QuestDB):
|
|
250
|
+
**Server-Based Databases** (PostgreSQL, MySQL, MariaDB, MongoDB, FerretDB, Redis, Valkey, ClickHouse, Qdrant, Meilisearch, CouchDB, CockroachDB, SurrealDB, QuestDB, TypeDB):
|
|
249
251
|
- Start/stop server processes
|
|
250
252
|
- Bind to localhost ports
|
|
251
253
|
- Data stored in `~/.spindb/containers/{engine}/{name}/`
|
|
@@ -322,6 +324,23 @@ export DATABASE_URL=$(spindb url mydb)
|
|
|
322
324
|
psql $(spindb url mydb)
|
|
323
325
|
```
|
|
324
326
|
|
|
327
|
+
### User Management
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
# Create database users and API keys
|
|
331
|
+
spindb users create mydb # Auto-generate password
|
|
332
|
+
spindb users create mydb --password p # Use specific password
|
|
333
|
+
spindb users create mydb --copy # Copy connection string to clipboard
|
|
334
|
+
spindb users create mydb --json # JSON output for scripting
|
|
335
|
+
spindb users create mydb --no-save # Don't save credential file
|
|
336
|
+
|
|
337
|
+
# List saved credentials
|
|
338
|
+
spindb users list mydb # List usernames
|
|
339
|
+
spindb users list mydb --json # JSON output
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
Supports PostgreSQL, MySQL, MariaDB, CockroachDB, ClickHouse, MongoDB, FerretDB, Redis, Valkey, SurrealDB, CouchDB, Meilisearch, and Qdrant. Not supported: SQLite, DuckDB, QuestDB, TypeDB. Credentials are saved as `.env.<username>` files in `~/.spindb/containers/{engine}/{name}/credentials/`.
|
|
343
|
+
|
|
325
344
|
### Backup & Restore
|
|
326
345
|
|
|
327
346
|
```bash
|
|
@@ -525,6 +544,7 @@ Each container contains:
|
|
|
525
544
|
│ │ └── myapp/
|
|
526
545
|
│ │ ├── container.json
|
|
527
546
|
│ │ ├── data/
|
|
547
|
+
│ │ ├── credentials/ # User credential .env.<username> files
|
|
528
548
|
│ │ └── postgres.log
|
|
529
549
|
│ ├── mysql/
|
|
530
550
|
│ └── mongodb/
|
|
@@ -561,6 +581,7 @@ Databases run as **native processes**, and **data persists across restarts**. Wh
|
|
|
561
581
|
| ClickHouse | MergeTree storage | Committed transactions survive crashes |
|
|
562
582
|
| CockroachDB | Raft consensus | Strongly consistent, distributed replication |
|
|
563
583
|
| QuestDB | Write-ahead logging | Committed transactions survive crashes |
|
|
584
|
+
| TypeDB | Write-ahead logging | Committed transactions survive crashes |
|
|
564
585
|
|
|
565
586
|
---
|
|
566
587
|
|
|
@@ -763,6 +784,7 @@ SpinDB supports enhanced database shells with auto-completion, syntax highlighti
|
|
|
763
784
|
| CouchDB | REST API | - | - |
|
|
764
785
|
| CockroachDB | `cockroach sql` | - | - |
|
|
765
786
|
| QuestDB | `psql` | `pgcli` | `usql` |
|
|
787
|
+
| TypeDB | `typedb console` | - | - |
|
|
766
788
|
|
|
767
789
|
Install and use in one command:
|
|
768
790
|
|
|
@@ -894,6 +916,16 @@ spindb backup mydb --format sql # SQL dump (only format)
|
|
|
894
916
|
|
|
895
917
|
> **Note:** QuestDB backup/restore requires the PostgreSQL engine to be installed (for `psql`).
|
|
896
918
|
|
|
919
|
+
### TypeDB
|
|
920
|
+
|
|
921
|
+
| Format | Extension | Tool | Use Case |
|
|
922
|
+
|--------|-----------|------|----------|
|
|
923
|
+
| typeql | `.typeql` | typedb console | TypeQL schema + data export |
|
|
924
|
+
|
|
925
|
+
```bash
|
|
926
|
+
spindb backup mydb --format typeql # TypeQL export (only format)
|
|
927
|
+
```
|
|
928
|
+
|
|
897
929
|
---
|
|
898
930
|
|
|
899
931
|
## Advanced Features
|
|
@@ -938,6 +970,7 @@ spindb restore mydb --from-url "postgresql://user:pass@prod-host:5432/production
|
|
|
938
970
|
| CouchDB | `couchdb://` or `http://` | `http://user:pass@host:5984/db` |
|
|
939
971
|
| CockroachDB | `postgresql://` or `postgres://` | `postgresql://root@host:26257/db?sslmode=disable` |
|
|
940
972
|
| QuestDB | `postgresql://` or `postgres://` | `postgresql://admin:quest@host:8812/qdb` |
|
|
973
|
+
| TypeDB | `typedb://` | `typedb://host:1729` |
|
|
941
974
|
|
|
942
975
|
### Multi-Version Support
|
|
943
976
|
|
|
@@ -1092,7 +1125,7 @@ See [USE_CASES.md](USE_CASES.md) for detailed use cases and infrastructure oppor
|
|
|
1092
1125
|
|
|
1093
1126
|
SpinDB is powered by:
|
|
1094
1127
|
|
|
1095
|
-
- **[hostdb](https://github.com/robertjbass/hostdb)** - Pre-compiled database binaries for
|
|
1128
|
+
- **[hostdb](https://github.com/robertjbass/hostdb)** - Pre-compiled database binaries for 17 engines across all major platforms. Makes Docker-free multi-version database support possible.
|
|
1096
1129
|
|
|
1097
1130
|
---
|
|
1098
1131
|
|
package/cli/commands/engines.ts
CHANGED
|
@@ -44,6 +44,10 @@ import {
|
|
|
44
44
|
type InstalledQdrantEngine,
|
|
45
45
|
type InstalledMeilisearchEngine,
|
|
46
46
|
type InstalledCouchDBEngine,
|
|
47
|
+
type InstalledCockroachDBEngine,
|
|
48
|
+
type InstalledSurrealDBEngine,
|
|
49
|
+
type InstalledQuestDBEngine,
|
|
50
|
+
type InstalledTypeDBEngine,
|
|
47
51
|
} from '../helpers'
|
|
48
52
|
import { Engine, Platform } from '../../types'
|
|
49
53
|
import {
|
|
@@ -65,6 +69,7 @@ import { couchdbBinaryManager } from '../../engines/couchdb/binary-manager'
|
|
|
65
69
|
import { cockroachdbBinaryManager } from '../../engines/cockroachdb/binary-manager'
|
|
66
70
|
import { surrealdbBinaryManager } from '../../engines/surrealdb/binary-manager'
|
|
67
71
|
import { questdbBinaryManager } from '../../engines/questdb/binary-manager'
|
|
72
|
+
import { typedbBinaryManager } from '../../engines/typedb/binary-manager'
|
|
68
73
|
import {
|
|
69
74
|
DEFAULT_DOCUMENTDB_VERSION,
|
|
70
75
|
normalizeDocumentDBVersion,
|
|
@@ -458,6 +463,18 @@ async function listEngines(options: { json?: boolean }): Promise<void> {
|
|
|
458
463
|
const couchdbEngines = engines.filter(
|
|
459
464
|
(e): e is InstalledCouchDBEngine => e.engine === 'couchdb',
|
|
460
465
|
)
|
|
466
|
+
const cockroachdbEngines = engines.filter(
|
|
467
|
+
(e): e is InstalledCockroachDBEngine => e.engine === 'cockroachdb',
|
|
468
|
+
)
|
|
469
|
+
const surrealdbEngines = engines.filter(
|
|
470
|
+
(e): e is InstalledSurrealDBEngine => e.engine === 'surrealdb',
|
|
471
|
+
)
|
|
472
|
+
const questdbEngines = engines.filter(
|
|
473
|
+
(e): e is InstalledQuestDBEngine => e.engine === 'questdb',
|
|
474
|
+
)
|
|
475
|
+
const typedbEngines = engines.filter(
|
|
476
|
+
(e): e is InstalledTypeDBEngine => e.engine === 'typedb',
|
|
477
|
+
)
|
|
461
478
|
|
|
462
479
|
// Calculate total size for PostgreSQL
|
|
463
480
|
const totalPgSize = pgEngines.reduce((acc, e) => acc + e.sizeBytes, 0)
|
|
@@ -626,6 +643,62 @@ async function listEngines(options: { json?: boolean }): Promise<void> {
|
|
|
626
643
|
)
|
|
627
644
|
}
|
|
628
645
|
|
|
646
|
+
// CockroachDB rows
|
|
647
|
+
for (const engine of cockroachdbEngines) {
|
|
648
|
+
const platformInfo = `${engine.platform}-${engine.arch}`
|
|
649
|
+
|
|
650
|
+
console.log(
|
|
651
|
+
chalk.gray(' ') +
|
|
652
|
+
getEngineIcon('cockroachdb') +
|
|
653
|
+
chalk.cyan('cockroachdb'.padEnd(13)) +
|
|
654
|
+
chalk.yellow(engine.version.padEnd(12)) +
|
|
655
|
+
chalk.gray(platformInfo.padEnd(18)) +
|
|
656
|
+
chalk.white(formatBytes(engine.sizeBytes)),
|
|
657
|
+
)
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
// SurrealDB rows
|
|
661
|
+
for (const engine of surrealdbEngines) {
|
|
662
|
+
const platformInfo = `${engine.platform}-${engine.arch}`
|
|
663
|
+
|
|
664
|
+
console.log(
|
|
665
|
+
chalk.gray(' ') +
|
|
666
|
+
getEngineIcon('surrealdb') +
|
|
667
|
+
chalk.cyan('surrealdb'.padEnd(13)) +
|
|
668
|
+
chalk.yellow(engine.version.padEnd(12)) +
|
|
669
|
+
chalk.gray(platformInfo.padEnd(18)) +
|
|
670
|
+
chalk.white(formatBytes(engine.sizeBytes)),
|
|
671
|
+
)
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
// QuestDB rows
|
|
675
|
+
for (const engine of questdbEngines) {
|
|
676
|
+
const platformInfo = `${engine.platform}-${engine.arch}`
|
|
677
|
+
|
|
678
|
+
console.log(
|
|
679
|
+
chalk.gray(' ') +
|
|
680
|
+
getEngineIcon('questdb') +
|
|
681
|
+
chalk.cyan('questdb'.padEnd(13)) +
|
|
682
|
+
chalk.yellow(engine.version.padEnd(12)) +
|
|
683
|
+
chalk.gray(platformInfo.padEnd(18)) +
|
|
684
|
+
chalk.white(formatBytes(engine.sizeBytes)),
|
|
685
|
+
)
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
// TypeDB rows
|
|
689
|
+
for (const engine of typedbEngines) {
|
|
690
|
+
const platformInfo = `${engine.platform}-${engine.arch}`
|
|
691
|
+
|
|
692
|
+
console.log(
|
|
693
|
+
chalk.gray(' ') +
|
|
694
|
+
getEngineIcon('typedb') +
|
|
695
|
+
chalk.cyan('typedb'.padEnd(13)) +
|
|
696
|
+
chalk.yellow(engine.version.padEnd(12)) +
|
|
697
|
+
chalk.gray(platformInfo.padEnd(18)) +
|
|
698
|
+
chalk.white(formatBytes(engine.sizeBytes)),
|
|
699
|
+
)
|
|
700
|
+
}
|
|
701
|
+
|
|
629
702
|
console.log(chalk.gray(' ' + '─'.repeat(59)))
|
|
630
703
|
|
|
631
704
|
// Summary
|
|
@@ -735,6 +808,50 @@ async function listEngines(options: { json?: boolean }): Promise<void> {
|
|
|
735
808
|
),
|
|
736
809
|
)
|
|
737
810
|
}
|
|
811
|
+
if (cockroachdbEngines.length > 0) {
|
|
812
|
+
const totalCockroachDBSize = cockroachdbEngines.reduce(
|
|
813
|
+
(acc, e) => acc + e.sizeBytes,
|
|
814
|
+
0,
|
|
815
|
+
)
|
|
816
|
+
console.log(
|
|
817
|
+
chalk.gray(
|
|
818
|
+
` CockroachDB: ${cockroachdbEngines.length} version(s), ${formatBytes(totalCockroachDBSize)}`,
|
|
819
|
+
),
|
|
820
|
+
)
|
|
821
|
+
}
|
|
822
|
+
if (surrealdbEngines.length > 0) {
|
|
823
|
+
const totalSurrealDBSize = surrealdbEngines.reduce(
|
|
824
|
+
(acc, e) => acc + e.sizeBytes,
|
|
825
|
+
0,
|
|
826
|
+
)
|
|
827
|
+
console.log(
|
|
828
|
+
chalk.gray(
|
|
829
|
+
` SurrealDB: ${surrealdbEngines.length} version(s), ${formatBytes(totalSurrealDBSize)}`,
|
|
830
|
+
),
|
|
831
|
+
)
|
|
832
|
+
}
|
|
833
|
+
if (questdbEngines.length > 0) {
|
|
834
|
+
const totalQuestDBSize = questdbEngines.reduce(
|
|
835
|
+
(acc, e) => acc + e.sizeBytes,
|
|
836
|
+
0,
|
|
837
|
+
)
|
|
838
|
+
console.log(
|
|
839
|
+
chalk.gray(
|
|
840
|
+
` QuestDB: ${questdbEngines.length} version(s), ${formatBytes(totalQuestDBSize)}`,
|
|
841
|
+
),
|
|
842
|
+
)
|
|
843
|
+
}
|
|
844
|
+
if (typedbEngines.length > 0) {
|
|
845
|
+
const totalTypeDBSize = typedbEngines.reduce(
|
|
846
|
+
(acc, e) => acc + e.sizeBytes,
|
|
847
|
+
0,
|
|
848
|
+
)
|
|
849
|
+
console.log(
|
|
850
|
+
chalk.gray(
|
|
851
|
+
` TypeDB: ${typedbEngines.length} version(s), ${formatBytes(totalTypeDBSize)}`,
|
|
852
|
+
),
|
|
853
|
+
)
|
|
854
|
+
}
|
|
738
855
|
console.log()
|
|
739
856
|
}
|
|
740
857
|
|
|
@@ -1835,9 +1952,70 @@ enginesCommand
|
|
|
1835
1952
|
return
|
|
1836
1953
|
}
|
|
1837
1954
|
|
|
1955
|
+
if (['typedb', 'tdb'].includes(normalizedEngine)) {
|
|
1956
|
+
if (!version) {
|
|
1957
|
+
console.error(uiError('TypeDB requires a version (e.g., 3)'))
|
|
1958
|
+
process.exit(1)
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
const { platform, arch } = platformService.getPlatformInfo()
|
|
1962
|
+
const platformKey = `${platform}-${arch}`
|
|
1963
|
+
const supportedPlatforms = new Set([
|
|
1964
|
+
'darwin-x64',
|
|
1965
|
+
'darwin-arm64',
|
|
1966
|
+
'linux-x64',
|
|
1967
|
+
'linux-arm64',
|
|
1968
|
+
'win32-x64',
|
|
1969
|
+
])
|
|
1970
|
+
if (!supportedPlatforms.has(platformKey)) {
|
|
1971
|
+
console.error(
|
|
1972
|
+
uiError(
|
|
1973
|
+
`TypeDB binaries are not available for ${platformKey}. Supported: darwin-x64, darwin-arm64, linux-x64, linux-arm64, win32-x64.`,
|
|
1974
|
+
),
|
|
1975
|
+
)
|
|
1976
|
+
process.exit(1)
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
const engine = getEngine(Engine.TypeDB)
|
|
1980
|
+
|
|
1981
|
+
const spinner = createSpinner(`Checking TypeDB ${version} binaries...`)
|
|
1982
|
+
spinner.start()
|
|
1983
|
+
|
|
1984
|
+
let wasCached = false
|
|
1985
|
+
await engine.ensureBinaries(version, ({ stage, message }) => {
|
|
1986
|
+
if (stage === 'cached') {
|
|
1987
|
+
wasCached = true
|
|
1988
|
+
spinner.text = `TypeDB ${version} binaries ready (cached)`
|
|
1989
|
+
} else {
|
|
1990
|
+
spinner.text = message
|
|
1991
|
+
}
|
|
1992
|
+
})
|
|
1993
|
+
|
|
1994
|
+
if (wasCached) {
|
|
1995
|
+
spinner.succeed(`TypeDB ${version} binaries already installed`)
|
|
1996
|
+
} else {
|
|
1997
|
+
spinner.succeed(`TypeDB ${version} binaries downloaded`)
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
// Show the path for reference
|
|
2001
|
+
const { platform: typedbPlatform, arch: typedbArch } =
|
|
2002
|
+
platformService.getPlatformInfo()
|
|
2003
|
+
const typedbFullVersion = typedbBinaryManager.getFullVersion(version)
|
|
2004
|
+
const binPath = paths.getBinaryPath({
|
|
2005
|
+
engine: 'typedb',
|
|
2006
|
+
version: typedbFullVersion,
|
|
2007
|
+
platform: typedbPlatform,
|
|
2008
|
+
arch: typedbArch,
|
|
2009
|
+
})
|
|
2010
|
+
console.log(chalk.gray(` Location: ${binPath}`))
|
|
2011
|
+
|
|
2012
|
+
// Skip client tools check - TypeDB console is bundled
|
|
2013
|
+
return
|
|
2014
|
+
}
|
|
2015
|
+
|
|
1838
2016
|
console.error(
|
|
1839
2017
|
uiError(
|
|
1840
|
-
`Unknown engine "${engineName}". Supported: postgresql, mysql, mariadb, sqlite, duckdb, mongodb, ferretdb, redis, valkey, clickhouse, qdrant, meilisearch, couchdb, cockroachdb, surrealdb, questdb`,
|
|
2018
|
+
`Unknown engine "${engineName}". Supported: postgresql, mysql, mariadb, sqlite, duckdb, mongodb, ferretdb, redis, valkey, clickhouse, qdrant, meilisearch, couchdb, cockroachdb, surrealdb, questdb, typedb`,
|
|
1841
2019
|
),
|
|
1842
2020
|
)
|
|
1843
2021
|
process.exit(1)
|
|
@@ -51,6 +51,7 @@ import { getEngineIcon, getPageSize } from '../../constants'
|
|
|
51
51
|
import { Engine, assertExhaustive } from '../../../types'
|
|
52
52
|
import { pressEnterToContinue } from './shared'
|
|
53
53
|
import { SpinDBError, ErrorCodes } from '../../../core/error-handler'
|
|
54
|
+
import { validateTypedbConnectionString } from './validators'
|
|
54
55
|
|
|
55
56
|
// Strip surrounding quotes from paths (handles drag-and-drop paths)
|
|
56
57
|
function stripQuotes(path: string): string {
|
|
@@ -207,6 +208,12 @@ function validateConnectionString(
|
|
|
207
208
|
return 'Connection string must start with postgresql:// or postgres://'
|
|
208
209
|
}
|
|
209
210
|
break
|
|
211
|
+
case Engine.TypeDB:
|
|
212
|
+
{
|
|
213
|
+
const typedbError = validateTypedbConnectionString(input)
|
|
214
|
+
if (typedbError) return typedbError
|
|
215
|
+
}
|
|
216
|
+
break
|
|
210
217
|
case Engine.SQLite:
|
|
211
218
|
case Engine.DuckDB:
|
|
212
219
|
return 'File-based engines do not support remote connection strings'
|