spindb 0.9.0 → 0.9.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 +7 -0
- package/cli/commands/backup.ts +13 -11
- package/cli/commands/clone.ts +18 -8
- package/cli/commands/config.ts +29 -29
- package/cli/commands/connect.ts +51 -39
- package/cli/commands/create.ts +120 -43
- package/cli/commands/delete.ts +8 -8
- package/cli/commands/deps.ts +17 -15
- package/cli/commands/doctor.ts +16 -15
- package/cli/commands/edit.ts +115 -60
- package/cli/commands/engines.ts +50 -17
- package/cli/commands/info.ts +12 -8
- package/cli/commands/list.ts +34 -19
- package/cli/commands/logs.ts +24 -14
- package/cli/commands/menu/backup-handlers.ts +72 -49
- package/cli/commands/menu/container-handlers.ts +140 -80
- package/cli/commands/menu/engine-handlers.ts +145 -11
- package/cli/commands/menu/index.ts +4 -4
- package/cli/commands/menu/shell-handlers.ts +34 -31
- package/cli/commands/menu/sql-handlers.ts +22 -16
- package/cli/commands/menu/update-handlers.ts +19 -17
- package/cli/commands/restore.ts +105 -43
- package/cli/commands/run.ts +20 -18
- package/cli/commands/self-update.ts +5 -5
- package/cli/commands/start.ts +11 -9
- package/cli/commands/stop.ts +9 -9
- package/cli/commands/url.ts +12 -9
- package/cli/helpers.ts +49 -4
- package/cli/ui/prompts.ts +21 -8
- package/cli/ui/spinner.ts +4 -4
- package/cli/ui/theme.ts +4 -4
- package/core/binary-manager.ts +5 -1
- package/core/container-manager.ts +81 -30
- package/core/error-handler.ts +31 -0
- package/core/platform-service.ts +3 -3
- package/core/port-manager.ts +2 -0
- package/core/process-manager.ts +25 -3
- package/core/start-with-retry.ts +6 -6
- package/core/transaction-manager.ts +6 -6
- package/engines/mysql/backup.ts +53 -36
- package/engines/mysql/index.ts +59 -16
- package/engines/mysql/restore.ts +4 -4
- package/engines/mysql/version-validator.ts +2 -2
- package/engines/postgresql/binary-manager.ts +17 -17
- package/engines/postgresql/index.ts +13 -2
- package/engines/postgresql/restore.ts +2 -2
- package/engines/postgresql/version-validator.ts +2 -2
- package/engines/sqlite/index.ts +31 -9
- package/package.json +1 -1
package/engines/sqlite/index.ts
CHANGED
|
@@ -98,6 +98,7 @@ export class SQLiteEngine extends BaseEngine {
|
|
|
98
98
|
|
|
99
99
|
// Check system PATH
|
|
100
100
|
try {
|
|
101
|
+
// TODO - update when windows support is added
|
|
101
102
|
const { stdout } = await execFileAsync('which', ['sqlite3'])
|
|
102
103
|
const path = stdout.trim()
|
|
103
104
|
return path || null
|
|
@@ -184,7 +185,9 @@ export class SQLiteEngine extends BaseEngine {
|
|
|
184
185
|
): Promise<{ port: number; connectionString: string }> {
|
|
185
186
|
const entry = await sqliteRegistry.get(container.name)
|
|
186
187
|
if (!entry) {
|
|
187
|
-
throw new Error(
|
|
188
|
+
throw new Error(
|
|
189
|
+
`SQLite container "${container.name}" not found in registry`,
|
|
190
|
+
)
|
|
188
191
|
}
|
|
189
192
|
if (!existsSync(entry.filePath)) {
|
|
190
193
|
throw new Error(`SQLite database file not found: ${entry.filePath}`)
|
|
@@ -243,7 +246,9 @@ export class SQLiteEngine extends BaseEngine {
|
|
|
243
246
|
async connect(container: ContainerConfig, _database?: string): Promise<void> {
|
|
244
247
|
const entry = await sqliteRegistry.get(container.name)
|
|
245
248
|
if (!entry) {
|
|
246
|
-
throw new Error(
|
|
249
|
+
throw new Error(
|
|
250
|
+
`SQLite container "${container.name}" not found in registry`,
|
|
251
|
+
)
|
|
247
252
|
}
|
|
248
253
|
if (!existsSync(entry.filePath)) {
|
|
249
254
|
throw new Error(`SQLite database file not found: ${entry.filePath}`)
|
|
@@ -521,7 +526,9 @@ export class SQLiteEngine extends BaseEngine {
|
|
|
521
526
|
if (code === 0) {
|
|
522
527
|
resolve()
|
|
523
528
|
} else {
|
|
524
|
-
reject(
|
|
529
|
+
reject(
|
|
530
|
+
new Error(`sqlite3 script execution failed with exit code ${code}`),
|
|
531
|
+
)
|
|
525
532
|
}
|
|
526
533
|
})
|
|
527
534
|
})
|
|
@@ -531,13 +538,28 @@ export class SQLiteEngine extends BaseEngine {
|
|
|
531
538
|
* Download a file from HTTP/HTTPS URL
|
|
532
539
|
*/
|
|
533
540
|
private async downloadFile(url: string, destPath: string): Promise<void> {
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
}
|
|
541
|
+
const controller = new AbortController()
|
|
542
|
+
const timeoutMs = 5 * 60 * 1000 // 5 minutes
|
|
543
|
+
const timeout = setTimeout(() => controller.abort(), timeoutMs)
|
|
538
544
|
|
|
539
|
-
|
|
540
|
-
|
|
545
|
+
try {
|
|
546
|
+
const response = await fetch(url, { signal: controller.signal })
|
|
547
|
+
if (!response.ok) {
|
|
548
|
+
throw new Error(
|
|
549
|
+
`Failed to download: ${response.status} ${response.statusText}`,
|
|
550
|
+
)
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
const buffer = await response.arrayBuffer()
|
|
554
|
+
await writeFile(destPath, Buffer.from(buffer))
|
|
555
|
+
} catch (error) {
|
|
556
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
557
|
+
throw new Error('Download timed out after 5 minutes')
|
|
558
|
+
}
|
|
559
|
+
throw error
|
|
560
|
+
} finally {
|
|
561
|
+
clearTimeout(timeout)
|
|
562
|
+
}
|
|
541
563
|
}
|
|
542
564
|
|
|
543
565
|
/**
|