spindb 0.1.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/.claude/settings.local.json +20 -0
- package/.env.example +1 -0
- package/.prettierignore +4 -0
- package/.prettierrc +6 -0
- package/CLAUDE.md +162 -0
- package/README.md +204 -0
- package/TODO.md +66 -0
- package/bin/cli.js +7 -0
- package/eslint.config.js +18 -0
- package/package.json +52 -0
- package/seeds/mysql/sample-db.sql +22 -0
- package/seeds/postgres/sample-db.sql +27 -0
- package/src/bin/cli.ts +8 -0
- package/src/cli/commands/clone.ts +101 -0
- package/src/cli/commands/config.ts +215 -0
- package/src/cli/commands/connect.ts +106 -0
- package/src/cli/commands/create.ts +148 -0
- package/src/cli/commands/delete.ts +94 -0
- package/src/cli/commands/list.ts +69 -0
- package/src/cli/commands/menu.ts +675 -0
- package/src/cli/commands/restore.ts +161 -0
- package/src/cli/commands/start.ts +95 -0
- package/src/cli/commands/stop.ts +91 -0
- package/src/cli/index.ts +38 -0
- package/src/cli/ui/prompts.ts +197 -0
- package/src/cli/ui/spinner.ts +94 -0
- package/src/cli/ui/theme.ts +113 -0
- package/src/config/defaults.ts +49 -0
- package/src/config/paths.ts +53 -0
- package/src/core/binary-manager.ts +239 -0
- package/src/core/config-manager.ts +259 -0
- package/src/core/container-manager.ts +234 -0
- package/src/core/port-manager.ts +84 -0
- package/src/core/process-manager.ts +353 -0
- package/src/engines/base-engine.ts +103 -0
- package/src/engines/index.ts +46 -0
- package/src/engines/postgresql/binary-urls.ts +52 -0
- package/src/engines/postgresql/index.ts +298 -0
- package/src/engines/postgresql/restore.ts +173 -0
- package/src/types/index.ts +97 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export interface ContainerConfig {
|
|
2
|
+
name: string
|
|
3
|
+
engine: string
|
|
4
|
+
version: string
|
|
5
|
+
port: number
|
|
6
|
+
created: string
|
|
7
|
+
status: 'created' | 'running' | 'stopped'
|
|
8
|
+
clonedFrom?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ProgressCallback {
|
|
12
|
+
(progress: { stage: string; message: string }): void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface InstalledBinary {
|
|
16
|
+
engine: string
|
|
17
|
+
version: string
|
|
18
|
+
platform: string
|
|
19
|
+
arch: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface PortResult {
|
|
23
|
+
port: number
|
|
24
|
+
isDefault: boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ProcessResult {
|
|
28
|
+
stdout: string
|
|
29
|
+
stderr: string
|
|
30
|
+
code?: number
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface StatusResult {
|
|
34
|
+
running: boolean
|
|
35
|
+
message: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface BackupFormat {
|
|
39
|
+
format: string
|
|
40
|
+
description: string
|
|
41
|
+
restoreCommand: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface RestoreResult {
|
|
45
|
+
format: string
|
|
46
|
+
stdout?: string
|
|
47
|
+
stderr?: string
|
|
48
|
+
code?: number
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface EngineInfo {
|
|
52
|
+
name: string
|
|
53
|
+
displayName: string
|
|
54
|
+
defaultPort: number
|
|
55
|
+
supportedVersions: string[]
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Binary tool types
|
|
60
|
+
*/
|
|
61
|
+
export type BinaryTool = 'psql' | 'pg_dump' | 'pg_restore' | 'pg_basebackup'
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Source of a binary - bundled (downloaded by spindb) or system (found on PATH)
|
|
65
|
+
*/
|
|
66
|
+
export type BinarySource = 'bundled' | 'system' | 'custom'
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Configuration for a single binary tool
|
|
70
|
+
*/
|
|
71
|
+
export interface BinaryConfig {
|
|
72
|
+
tool: BinaryTool
|
|
73
|
+
path: string
|
|
74
|
+
source: BinarySource
|
|
75
|
+
version?: string
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Global spindb configuration stored in ~/.spindb/config.json
|
|
80
|
+
*/
|
|
81
|
+
export interface SpinDBConfig {
|
|
82
|
+
// Binary paths for client tools
|
|
83
|
+
binaries: {
|
|
84
|
+
psql?: BinaryConfig
|
|
85
|
+
pg_dump?: BinaryConfig
|
|
86
|
+
pg_restore?: BinaryConfig
|
|
87
|
+
pg_basebackup?: BinaryConfig
|
|
88
|
+
}
|
|
89
|
+
// Default settings
|
|
90
|
+
defaults?: {
|
|
91
|
+
engine?: string
|
|
92
|
+
version?: string
|
|
93
|
+
port?: number
|
|
94
|
+
}
|
|
95
|
+
// Last updated timestamp
|
|
96
|
+
updatedAt?: string
|
|
97
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"rootDir": "./src",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"declarationMap": true,
|
|
16
|
+
"sourceMap": true,
|
|
17
|
+
"baseUrl": ".",
|
|
18
|
+
"paths": {
|
|
19
|
+
"@/*": ["./src/*"]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"include": ["src/**/*"],
|
|
23
|
+
"exclude": ["node_modules", "dist"]
|
|
24
|
+
}
|