spindb 0.34.5 → 0.35.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 +4 -4
- package/cli/commands/create.ts +22 -1
- package/cli/commands/engines.ts +51 -21
- package/cli/commands/menu/container-handlers.ts +17 -1
- package/cli/commands/menu/engine-handlers.ts +48 -29
- package/cli/ui/theme.ts +5 -2
- package/config/engines.json +2 -2
- package/core/base-binary-manager.ts +6 -2
- package/core/base-document-binary-manager.ts +5 -2
- package/core/base-embedded-binary-manager.ts +5 -2
- package/core/base-server-binary-manager.ts +5 -2
- package/core/hostdb-client.ts +157 -22
- package/core/hostdb-metadata.ts +67 -43
- package/engines/clickhouse/binary-urls.ts +1 -1
- package/engines/cockroachdb/binary-urls.ts +9 -7
- package/engines/cockroachdb/hostdb-releases.ts +18 -106
- package/engines/cockroachdb/version-maps.ts +1 -1
- package/engines/couchdb/binary-urls.ts +1 -1
- package/engines/duckdb/binary-urls.ts +1 -1
- package/engines/duckdb/index.ts +4 -74
- package/engines/ferretdb/README.md +76 -38
- package/engines/ferretdb/backup.ts +18 -10
- package/engines/ferretdb/binary-manager.ts +233 -35
- package/engines/ferretdb/binary-urls.ts +69 -24
- package/engines/ferretdb/index.ts +424 -213
- package/engines/ferretdb/restore.ts +23 -16
- package/engines/ferretdb/version-maps.ts +36 -8
- package/engines/index.ts +3 -4
- package/engines/influxdb/binary-urls.ts +1 -1
- package/engines/mariadb/binary-urls.ts +2 -2
- package/engines/meilisearch/binary-urls.ts +1 -1
- package/engines/mysql/binary-urls.ts +2 -2
- package/engines/postgresql/binary-urls.ts +1 -1
- package/engines/qdrant/binary-urls.ts +1 -1
- package/engines/questdb/binary-manager.ts +16 -9
- package/engines/questdb/binary-urls.ts +9 -10
- package/engines/questdb/hostdb-releases.ts +19 -97
- package/engines/questdb/version-maps.ts +2 -2
- package/engines/redis/binary-urls.ts +1 -8
- package/engines/sqlite/binary-urls.ts +1 -1
- package/engines/sqlite/index.ts +4 -74
- package/engines/surrealdb/binary-urls.ts +9 -7
- package/engines/surrealdb/hostdb-releases.ts +18 -106
- package/engines/surrealdb/version-maps.ts +1 -1
- package/engines/typedb/binary-urls.ts +10 -8
- package/engines/typedb/hostdb-releases.ts +18 -113
- package/engines/typedb/version-maps.ts +1 -1
- package/engines/valkey/binary-urls.ts +1 -1
- package/package.json +4 -1
|
@@ -1,111 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* hostdb Releases Module for SurrealDB
|
|
3
3
|
*
|
|
4
|
-
* Fetches
|
|
5
|
-
*
|
|
4
|
+
* Fetches SurrealDB binary information from the hostdb repository at
|
|
5
|
+
* https://github.com/robertjbass/hostdb
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { createHostdbReleases } from '../../core/hostdb-releases-factory'
|
|
9
9
|
import { SURREALDB_VERSION_MAP, SUPPORTED_MAJOR_VERSIONS } from './version-maps'
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}[]
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Fetch available SurrealDB versions from hostdb
|
|
30
|
-
* Returns a map of major version to available patch versions
|
|
31
|
-
*
|
|
32
|
-
* Falls back to local version maps if fetch fails
|
|
33
|
-
*/
|
|
34
|
-
export async function fetchAvailableVersions(): Promise<
|
|
35
|
-
Record<string, string[]>
|
|
36
|
-
> {
|
|
37
|
-
// Return cached versions if still valid
|
|
38
|
-
if (cachedVersions && Date.now() < cacheExpiry) {
|
|
39
|
-
return cachedVersions
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
try {
|
|
43
|
-
const response = await fetch(HOSTDB_RELEASES_URL)
|
|
44
|
-
if (!response.ok) {
|
|
45
|
-
throw new Error(`HTTP ${response.status}`)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const releases = (await response.json()) as HostdbReleases
|
|
49
|
-
const surrealdbReleases = releases.surrealdb
|
|
50
|
-
|
|
51
|
-
if (!surrealdbReleases?.versions) {
|
|
52
|
-
throw new Error('No SurrealDB versions found in releases.json')
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Group versions by major version
|
|
56
|
-
const versionMap: Record<string, string[]> = {}
|
|
57
|
-
|
|
58
|
-
for (const { version } of surrealdbReleases.versions) {
|
|
59
|
-
// Extract major version (e.g., "2" from "2.3.2")
|
|
60
|
-
const majorMatch = version.match(/^(\d+)/)
|
|
61
|
-
if (!majorMatch) continue
|
|
62
|
-
|
|
63
|
-
const majorVersion = majorMatch[1]
|
|
64
|
-
if (!versionMap[majorVersion]) {
|
|
65
|
-
versionMap[majorVersion] = []
|
|
66
|
-
}
|
|
67
|
-
versionMap[majorVersion].push(version)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Sort versions within each major version (newest first)
|
|
71
|
-
for (const major of Object.keys(versionMap)) {
|
|
72
|
-
versionMap[major].sort((a, b) => {
|
|
73
|
-
const partsA = a.split('.').map(Number)
|
|
74
|
-
const partsB = b.split('.').map(Number)
|
|
75
|
-
for (let i = 0; i < Math.max(partsA.length, partsB.length); i++) {
|
|
76
|
-
const diff = (partsB[i] || 0) - (partsA[i] || 0)
|
|
77
|
-
if (diff !== 0) return diff
|
|
78
|
-
}
|
|
79
|
-
return 0
|
|
80
|
-
})
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Cache the results
|
|
84
|
-
cachedVersions = versionMap
|
|
85
|
-
cacheExpiry = Date.now() + CACHE_TTL_MS
|
|
86
|
-
|
|
87
|
-
logDebug('Fetched SurrealDB versions from hostdb', { versionMap })
|
|
88
|
-
return versionMap
|
|
89
|
-
} catch (error) {
|
|
90
|
-
logDebug(`Failed to fetch hostdb releases: ${error}`)
|
|
91
|
-
|
|
92
|
-
// Fall back to local version maps
|
|
93
|
-
const fallbackMap: Record<string, string[]> = {}
|
|
94
|
-
for (const major of SUPPORTED_MAJOR_VERSIONS) {
|
|
95
|
-
const fullVersion = SURREALDB_VERSION_MAP[major]
|
|
96
|
-
if (fullVersion) {
|
|
97
|
-
fallbackMap[major] = [fullVersion]
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return fallbackMap
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Clear the version cache (useful for testing)
|
|
107
|
-
*/
|
|
108
|
-
export function clearVersionCache(): void {
|
|
109
|
-
cachedVersions = null
|
|
110
|
-
cacheExpiry = 0
|
|
111
|
-
}
|
|
10
|
+
import { surrealdbBinaryManager } from './binary-manager'
|
|
11
|
+
import { Engine } from '../../types'
|
|
12
|
+
|
|
13
|
+
const hostdbReleases = createHostdbReleases({
|
|
14
|
+
engine: Engine.SurrealDB,
|
|
15
|
+
displayName: 'SurrealDB',
|
|
16
|
+
versionMap: SURREALDB_VERSION_MAP,
|
|
17
|
+
supportedMajorVersions: SUPPORTED_MAJOR_VERSIONS,
|
|
18
|
+
groupingStrategy: 'single-digit',
|
|
19
|
+
listInstalled: () => surrealdbBinaryManager.listInstalled(),
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export const fetchAvailableVersions = hostdbReleases.fetchAvailableVersions
|
|
23
|
+
export const getLatestVersion = hostdbReleases.getLatestVersion
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TypeDB binary URL generation
|
|
3
3
|
*
|
|
4
|
-
* Generates download URLs for TypeDB binaries from
|
|
4
|
+
* Generates download URLs for TypeDB binaries from the layerbase registry.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type
|
|
7
|
+
import { type Platform, type Arch, Engine } from '../../types'
|
|
8
8
|
import { normalizeVersion } from './version-maps'
|
|
9
|
-
|
|
10
|
-
const HOSTDB_BASE_URL =
|
|
11
|
-
'https://github.com/robertjbass/hostdb/releases/download'
|
|
9
|
+
import { buildHostdbUrl } from '../../core/hostdb-client'
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
12
|
* Get the binary download URL for a specific version and platform
|
|
15
13
|
*
|
|
16
|
-
* URL format: https://
|
|
14
|
+
* URL format: https://registry.layerbase.host/typedb-{version}/typedb-{version}-{platform}-{arch}.{ext}
|
|
17
15
|
*
|
|
18
16
|
* @param version - TypeDB version (e.g., '3.8.0' or '3')
|
|
19
17
|
* @param platform - Target platform (darwin, linux, win32)
|
|
@@ -27,12 +25,16 @@ export function getBinaryUrl(
|
|
|
27
25
|
const fullVersion = normalizeVersion(version)
|
|
28
26
|
const ext = getArchiveExtension(platform)
|
|
29
27
|
|
|
30
|
-
return
|
|
28
|
+
return buildHostdbUrl(Engine.TypeDB, {
|
|
29
|
+
version: fullVersion,
|
|
30
|
+
hostdbPlatform: `${platform}-${arch}`,
|
|
31
|
+
extension: ext,
|
|
32
|
+
})
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
36
|
* Get the archive extension for a platform
|
|
35
37
|
*/
|
|
36
|
-
export function getArchiveExtension(platform: Platform):
|
|
38
|
+
export function getArchiveExtension(platform: Platform): 'tar.gz' | 'zip' {
|
|
37
39
|
return platform === 'win32' ? 'zip' : 'tar.gz'
|
|
38
40
|
}
|
|
@@ -1,118 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* hostdb Releases Module for TypeDB
|
|
3
3
|
*
|
|
4
|
-
* Fetches
|
|
5
|
-
*
|
|
4
|
+
* Fetches TypeDB binary information from the hostdb repository at
|
|
5
|
+
* https://github.com/robertjbass/hostdb
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { createHostdbReleases } from '../../core/hostdb-releases-factory'
|
|
9
9
|
import { TYPEDB_VERSION_MAP, SUPPORTED_MAJOR_VERSIONS } from './version-maps'
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}[]
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Fetch available TypeDB versions from hostdb
|
|
30
|
-
* Returns a map of major version to available patch versions
|
|
31
|
-
*
|
|
32
|
-
* Falls back to local version maps if fetch fails
|
|
33
|
-
*/
|
|
34
|
-
export async function fetchAvailableVersions(): Promise<
|
|
35
|
-
Record<string, string[]>
|
|
36
|
-
> {
|
|
37
|
-
// Return cached versions if still valid
|
|
38
|
-
if (cachedVersions && Date.now() < cacheExpiry) {
|
|
39
|
-
return cachedVersions
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
try {
|
|
43
|
-
const controller = new AbortController()
|
|
44
|
-
const timeoutId = setTimeout(() => controller.abort(), 10000)
|
|
45
|
-
let response: Response
|
|
46
|
-
try {
|
|
47
|
-
response = await fetch(HOSTDB_RELEASES_URL, { signal: controller.signal })
|
|
48
|
-
} finally {
|
|
49
|
-
clearTimeout(timeoutId)
|
|
50
|
-
}
|
|
51
|
-
if (!response.ok) {
|
|
52
|
-
throw new Error(`HTTP ${response.status}`)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const releases = (await response.json()) as HostdbReleases
|
|
56
|
-
const typedbReleases = releases.typedb
|
|
57
|
-
|
|
58
|
-
if (!typedbReleases?.versions) {
|
|
59
|
-
throw new Error('No TypeDB versions found in releases.json')
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Group versions by major version
|
|
63
|
-
const versionMap: Record<string, string[]> = {}
|
|
64
|
-
|
|
65
|
-
for (const { version } of typedbReleases.versions) {
|
|
66
|
-
// Extract major version (e.g., "3" from "3.8.0")
|
|
67
|
-
const majorMatch = version.match(/^(\d+)/)
|
|
68
|
-
if (!majorMatch) continue
|
|
69
|
-
|
|
70
|
-
const majorVersion = majorMatch[1]
|
|
71
|
-
if (!versionMap[majorVersion]) {
|
|
72
|
-
versionMap[majorVersion] = []
|
|
73
|
-
}
|
|
74
|
-
versionMap[majorVersion].push(version)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Sort versions within each major version (newest first)
|
|
78
|
-
for (const major of Object.keys(versionMap)) {
|
|
79
|
-
versionMap[major].sort((a, b) => {
|
|
80
|
-
const partsA = a.split('.').map(Number)
|
|
81
|
-
const partsB = b.split('.').map(Number)
|
|
82
|
-
for (let i = 0; i < Math.max(partsA.length, partsB.length); i++) {
|
|
83
|
-
const diff = (partsB[i] || 0) - (partsA[i] || 0)
|
|
84
|
-
if (diff !== 0) return diff
|
|
85
|
-
}
|
|
86
|
-
return 0
|
|
87
|
-
})
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Cache the results
|
|
91
|
-
cachedVersions = versionMap
|
|
92
|
-
cacheExpiry = Date.now() + CACHE_TTL_MS
|
|
93
|
-
|
|
94
|
-
logDebug('Fetched TypeDB versions from hostdb', { versionMap })
|
|
95
|
-
return versionMap
|
|
96
|
-
} catch (error) {
|
|
97
|
-
logDebug(`Failed to fetch hostdb releases: ${error}`)
|
|
98
|
-
|
|
99
|
-
// Fall back to local version maps
|
|
100
|
-
const fallbackMap: Record<string, string[]> = {}
|
|
101
|
-
for (const major of SUPPORTED_MAJOR_VERSIONS) {
|
|
102
|
-
const fullVersion = TYPEDB_VERSION_MAP[major]
|
|
103
|
-
if (fullVersion) {
|
|
104
|
-
fallbackMap[major] = [fullVersion]
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return fallbackMap
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Clear the version cache (useful for testing)
|
|
114
|
-
*/
|
|
115
|
-
export function clearVersionCache(): void {
|
|
116
|
-
cachedVersions = null
|
|
117
|
-
cacheExpiry = 0
|
|
118
|
-
}
|
|
10
|
+
import { typedbBinaryManager } from './binary-manager'
|
|
11
|
+
import { Engine } from '../../types'
|
|
12
|
+
|
|
13
|
+
const hostdbReleases = createHostdbReleases({
|
|
14
|
+
engine: Engine.TypeDB,
|
|
15
|
+
displayName: 'TypeDB',
|
|
16
|
+
versionMap: TYPEDB_VERSION_MAP,
|
|
17
|
+
supportedMajorVersions: SUPPORTED_MAJOR_VERSIONS,
|
|
18
|
+
groupingStrategy: 'single-digit',
|
|
19
|
+
listInstalled: () => typedbBinaryManager.listInstalled(),
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export const fetchAvailableVersions = hostdbReleases.fetchAvailableVersions
|
|
23
|
+
export const getLatestVersion = hostdbReleases.getLatestVersion
|
|
@@ -37,7 +37,7 @@ export function getHostdbPlatform(
|
|
|
37
37
|
/**
|
|
38
38
|
* Build the download URL for Valkey binaries from hostdb
|
|
39
39
|
*
|
|
40
|
-
* Format: https://
|
|
40
|
+
* Format: https://registry.layerbase.host/valkey-{version}/valkey-{version}-{platform}-{arch}.{ext}
|
|
41
41
|
*
|
|
42
42
|
* @param version - Valkey version (e.g., '8', '8.0.6')
|
|
43
43
|
* @param platform - Platform identifier (e.g., 'darwin', 'linux', 'win32')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spindb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.2",
|
|
4
4
|
"author": "Bob Bass <bob@bbass.co>",
|
|
5
5
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
6
6
|
"description": "Zero-config Docker-free local database containers. Create, backup, and clone a variety of popular databases.",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"spindb",
|
|
36
36
|
"postgres",
|
|
37
37
|
"postgresql",
|
|
38
|
+
"postgresql-documentdb",
|
|
38
39
|
"mysql",
|
|
39
40
|
"mariadb",
|
|
40
41
|
"database",
|
|
@@ -55,6 +56,8 @@
|
|
|
55
56
|
"questdb",
|
|
56
57
|
"typedb",
|
|
57
58
|
"influxdb",
|
|
59
|
+
"layerbase",
|
|
60
|
+
"docker-free",
|
|
58
61
|
"tui",
|
|
59
62
|
"cli",
|
|
60
63
|
"package manager"
|