@vibesdotdev/localdb 0.0.2 → 1.0.0-rc.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/LICENSE +18 -0
- package/README.md +123 -2
- package/dist/cli/commands/_shared.consumer.d.ts +1 -3
- package/dist/cli/commands/_shared.consumer.d.ts.map +1 -1
- package/dist/cli/commands/_shared.consumer.js +1 -11
- package/dist/cli/commands/_shared.consumer.js.map +1 -1
- package/dist/cli/commands/migrate/dev.localdb.migrate.cli-command.descriptor.js +1 -1
- package/dist/cli/commands/migrate/dev.localdb.migrate.cli-command.descriptor.js.map +1 -1
- package/dist/cli/commands/migrate/dev.localdb.migrate.cli-command.impl.consumer.d.ts +9 -3
- package/dist/cli/commands/migrate/dev.localdb.migrate.cli-command.impl.consumer.d.ts.map +1 -1
- package/dist/cli/commands/migrate/dev.localdb.migrate.cli-command.impl.consumer.js +59 -45
- package/dist/cli/commands/migrate/dev.localdb.migrate.cli-command.impl.consumer.js.map +1 -1
- package/dist/cli/commands/namespaces/dev.localdb.namespaces.cli-command.descriptor.js +1 -1
- package/dist/cli/commands/namespaces/dev.localdb.namespaces.cli-command.descriptor.js.map +1 -1
- package/dist/cli/commands/namespaces/dev.localdb.namespaces.cli-command.impl.d.ts +8 -3
- package/dist/cli/commands/namespaces/dev.localdb.namespaces.cli-command.impl.d.ts.map +1 -1
- package/dist/cli/commands/namespaces/dev.localdb.namespaces.cli-command.impl.js +12 -10
- package/dist/cli/commands/namespaces/dev.localdb.namespaces.cli-command.impl.js.map +1 -1
- package/dist/cli/commands/pools/dev.localdb.pools.cli-command.descriptor.js +1 -1
- package/dist/cli/commands/pools/dev.localdb.pools.cli-command.descriptor.js.map +1 -1
- package/dist/cli/commands/pools/dev.localdb.pools.cli-command.impl.d.ts +6 -3
- package/dist/cli/commands/pools/dev.localdb.pools.cli-command.impl.d.ts.map +1 -1
- package/dist/cli/commands/pools/dev.localdb.pools.cli-command.impl.js +8 -7
- package/dist/cli/commands/pools/dev.localdb.pools.cli-command.impl.js.map +1 -1
- package/dist/cli/commands/query/dev.localdb.query.cli-command.descriptor.js +1 -1
- package/dist/cli/commands/query/dev.localdb.query.cli-command.descriptor.js.map +1 -1
- package/dist/cli/commands/query/dev.localdb.query.cli-command.impl.consumer.d.ts +13 -3
- package/dist/cli/commands/query/dev.localdb.query.cli-command.impl.consumer.d.ts.map +1 -1
- package/dist/cli/commands/query/dev.localdb.query.cli-command.impl.consumer.js +66 -51
- package/dist/cli/commands/query/dev.localdb.query.cli-command.impl.consumer.js.map +1 -1
- package/dist/cli/commands/status/dev.localdb.status.cli-command.descriptor.js +1 -1
- package/dist/cli/commands/status/dev.localdb.status.cli-command.descriptor.js.map +1 -1
- package/dist/cli/commands/status/dev.localdb.status.cli-command.impl.consumer.d.ts +9 -3
- package/dist/cli/commands/status/dev.localdb.status.cli-command.impl.consumer.d.ts.map +1 -1
- package/dist/cli/commands/status/dev.localdb.status.cli-command.impl.consumer.js +41 -29
- package/dist/cli/commands/status/dev.localdb.status.cli-command.impl.consumer.js.map +1 -1
- package/dist/cli/inputs.d.ts +25 -0
- package/dist/cli/inputs.d.ts.map +1 -0
- package/dist/cli/inputs.js +81 -0
- package/dist/cli/inputs.js.map +1 -0
- package/dist/cli/types.d.ts +45 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +14 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/core/connection-pool.d.ts +204 -46
- package/dist/core/connection-pool.d.ts.map +1 -1
- package/dist/core/connection-pool.js +610 -101
- package/dist/core/connection-pool.js.map +1 -1
- package/dist/core/database.d.ts +243 -63
- package/dist/core/database.d.ts.map +1 -1
- package/dist/core/database.js +937 -203
- package/dist/core/database.js.map +1 -1
- package/dist/core/holders.d.ts +15 -0
- package/dist/core/holders.d.ts.map +1 -0
- package/dist/core/holders.js +4 -0
- package/dist/core/holders.js.map +1 -0
- package/dist/core/host-kinds.d.ts +22 -0
- package/dist/core/host-kinds.d.ts.map +1 -0
- package/dist/core/host-kinds.js +52 -0
- package/dist/core/host-kinds.js.map +1 -0
- package/dist/core/live-runtime.d.ts +17 -0
- package/dist/core/live-runtime.d.ts.map +1 -0
- package/dist/core/live-runtime.js +28 -0
- package/dist/core/live-runtime.js.map +1 -0
- package/dist/core/migration-registry.d.ts +115 -80
- package/dist/core/migration-registry.d.ts.map +1 -1
- package/dist/core/migration-registry.js +340 -199
- package/dist/core/migration-registry.js.map +1 -1
- package/dist/core/open-connection.d.ts +11 -0
- package/dist/core/open-connection.d.ts.map +1 -0
- package/dist/core/open-connection.js +70 -0
- package/dist/core/open-connection.js.map +1 -0
- package/dist/core/outcome.d.ts +21 -0
- package/dist/core/outcome.d.ts.map +1 -0
- package/dist/core/outcome.js +22 -0
- package/dist/core/outcome.js.map +1 -0
- package/dist/core/pool-api.d.ts +19 -0
- package/dist/core/pool-api.d.ts.map +1 -0
- package/dist/core/pool-api.js +59 -0
- package/dist/core/pool-api.js.map +1 -0
- package/dist/core/slow-statement.d.ts +81 -0
- package/dist/core/slow-statement.d.ts.map +1 -0
- package/dist/core/slow-statement.js +149 -0
- package/dist/core/slow-statement.js.map +1 -0
- package/dist/core/wal-policy.d.ts +86 -0
- package/dist/core/wal-policy.d.ts.map +1 -0
- package/dist/core/wal-policy.js +115 -0
- package/dist/core/wal-policy.js.map +1 -0
- package/dist/dev.localdb.cli-group.descriptor.d.ts +1 -1
- package/dist/dev.localdb.cli-group.descriptor.d.ts.map +1 -1
- package/dist/dev.localdb.context.descriptor.d.ts +15 -1
- package/dist/dev.localdb.context.descriptor.d.ts.map +1 -1
- package/dist/dev.localdb.context.descriptor.js +1 -1
- package/dist/dev.localdb.context.descriptor.js.map +1 -1
- package/dist/dev.localdb.context.impl.consumer.d.ts +12 -5
- package/dist/dev.localdb.context.impl.consumer.d.ts.map +1 -1
- package/dist/dev.localdb.context.impl.consumer.js +14 -5
- package/dist/dev.localdb.context.impl.consumer.js.map +1 -1
- package/dist/driver/sqlite-driver.base.d.ts +107 -0
- package/dist/driver/sqlite-driver.base.d.ts.map +1 -0
- package/dist/driver/sqlite-driver.base.js +426 -0
- package/dist/driver/sqlite-driver.base.js.map +1 -0
- package/dist/driver/sqlite-driver.d.ts +154 -0
- package/dist/driver/sqlite-driver.d.ts.map +1 -0
- package/dist/driver/sqlite-driver.js +103 -0
- package/dist/driver/sqlite-driver.js.map +1 -0
- package/dist/index.d.ts +11 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/localdb.client.descriptor.d.ts +10 -0
- package/dist/localdb.client.descriptor.d.ts.map +1 -0
- package/dist/localdb.client.descriptor.js +13 -0
- package/dist/localdb.client.descriptor.js.map +1 -0
- package/dist/localdb.client.impl.consumer.d.ts +11 -0
- package/dist/localdb.client.impl.consumer.d.ts.map +1 -0
- package/dist/localdb.client.impl.consumer.js +11 -0
- package/dist/localdb.client.impl.consumer.js.map +1 -0
- package/dist/localdb.plugin.d.ts +2 -2
- package/dist/localdb.plugin.d.ts.map +1 -1
- package/dist/localdb.plugin.js +58 -10
- package/dist/localdb.plugin.js.map +1 -1
- package/dist/location.d.ts +6 -0
- package/dist/location.d.ts.map +1 -0
- package/dist/location.js +6 -0
- package/dist/location.js.map +1 -0
- package/dist/migrations/load-sql.d.ts +25 -21
- package/dist/migrations/load-sql.d.ts.map +1 -1
- package/dist/migrations/load-sql.js +91 -76
- package/dist/migrations/load-sql.js.map +1 -1
- package/dist/pool.d.ts +3 -0
- package/dist/pool.d.ts.map +1 -0
- package/dist/pool.js +3 -0
- package/dist/pool.js.map +1 -0
- package/dist/schemas/api.d.ts +133 -59
- package/dist/schemas/api.d.ts.map +1 -1
- package/dist/schemas/api.js +1 -1
- package/dist/schemas/api.js.map +1 -1
- package/dist/schemas/migrations.d.ts +123 -0
- package/dist/schemas/migrations.d.ts.map +1 -0
- package/dist/schemas/migrations.js +55 -0
- package/dist/schemas/migrations.js.map +1 -0
- package/dist/schemas/pool.d.ts +27 -0
- package/dist/schemas/pool.d.ts.map +1 -0
- package/dist/schemas/pool.js +7 -0
- package/dist/schemas/pool.js.map +1 -0
- package/dist/schemas/sqlite-driver-base.d.ts +50 -0
- package/dist/schemas/sqlite-driver-base.d.ts.map +1 -0
- package/dist/schemas/sqlite-driver-base.js +2 -0
- package/dist/schemas/sqlite-driver-base.js.map +1 -0
- package/dist/testing/sqlite-driver-conformance.d.ts +42 -0
- package/dist/testing/sqlite-driver-conformance.d.ts.map +1 -0
- package/dist/testing/sqlite-driver-conformance.js +471 -0
- package/dist/testing/sqlite-driver-conformance.js.map +1 -0
- package/package.json +78 -104
- package/dist/core/error-context.d.ts +0 -2
- package/dist/core/error-context.d.ts.map +0 -1
- package/dist/core/error-context.js +0 -17
- package/dist/core/error-context.js.map +0 -1
- package/dist/core/runtime.d.ts +0 -3
- package/dist/core/runtime.d.ts.map +0 -1
- package/dist/core/runtime.js +0 -17
- package/dist/core/runtime.js.map +0 -1
- package/dist/localdb.cloud.plugin.d.ts +0 -17
- package/dist/localdb.cloud.plugin.d.ts.map +0 -1
- package/dist/localdb.cloud.plugin.js +0 -23
- package/dist/localdb.cloud.plugin.js.map +0 -1
- package/src/cli/commands/_shared.consumer.ts +0 -20
- package/src/cli/commands/migrate/dev.localdb.migrate.cli-command.descriptor.ts +0 -20
- package/src/cli/commands/migrate/dev.localdb.migrate.cli-command.impl.consumer.ts +0 -97
- package/src/cli/commands/namespaces/dev.localdb.namespaces.cli-command.descriptor.ts +0 -17
- package/src/cli/commands/namespaces/dev.localdb.namespaces.cli-command.impl.ts +0 -46
- package/src/cli/commands/pools/dev.localdb.pools.cli-command.descriptor.ts +0 -16
- package/src/cli/commands/pools/dev.localdb.pools.cli-command.impl.ts +0 -37
- package/src/cli/commands/query/dev.localdb.query.cli-command.descriptor.ts +0 -21
- package/src/cli/commands/query/dev.localdb.query.cli-command.impl.consumer.ts +0 -69
- package/src/cli/commands/status/dev.localdb.status.cli-command.descriptor.ts +0 -20
- package/src/cli/commands/status/dev.localdb.status.cli-command.impl.consumer.ts +0 -93
- package/src/core/connection-pool.ts +0 -240
- package/src/core/database.ts +0 -419
- package/src/core/error-context.ts +0 -19
- package/src/core/migration-registry.ts +0 -321
- package/src/core/runtime.ts +0 -17
- package/src/dev.localdb.cli-group.descriptor.ts +0 -20
- package/src/dev.localdb.context.descriptor.ts +0 -13
- package/src/dev.localdb.context.impl.consumer.ts +0 -12
- package/src/index.ts +0 -28
- package/src/localdb.cloud.plugin.ts +0 -24
- package/src/localdb.plugin.ts +0 -43
- package/src/migrations/atlas/001-initial-schema.sql +0 -173
- package/src/migrations/atlas/002-lang-server-fields.sql +0 -12
- package/src/migrations/atlas/003-config-id-dedup.sql +0 -31
- package/src/migrations/atlas/004-fix-on-conflict-constraints.sql +0 -25
- package/src/migrations/atlas/005-diagnostics.sql +0 -66
- package/src/migrations/atlas/006-diagnostic-summaries.sql +0 -65
- package/src/migrations/atlas/007-diagnostic-slice.sql +0 -83
- package/src/migrations/load-sql.ts +0 -133
- package/src/schemas/api.ts +0 -92
package/package.json
CHANGED
|
@@ -1,145 +1,119 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibesdotdev/localdb",
|
|
3
|
-
"version": "0.0.2",
|
|
4
|
-
"
|
|
3
|
+
"version": "1.0.0-rc.2",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@vibesdotdev/filesystem": "^1.0.0-rc.2",
|
|
6
|
+
"zod": "^4.6.7"
|
|
7
|
+
},
|
|
8
|
+
"peerDependencies": {
|
|
9
|
+
"@vibesdotdev/logging": "^1.0.0-rc.3",
|
|
10
|
+
"@vibesdotdev/kernel": "^1.0.0-rc.5"
|
|
11
|
+
},
|
|
5
12
|
"main": "./dist/index.js",
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
13
|
"exports": {
|
|
8
14
|
".": {
|
|
15
|
+
"bun": "./dist/index.js",
|
|
9
16
|
"types": "./dist/index.d.ts",
|
|
10
|
-
"bun": "./src/index.ts",
|
|
11
17
|
"import": "./dist/index.js",
|
|
12
18
|
"default": "./dist/index.js"
|
|
13
19
|
},
|
|
14
20
|
"./plugin": {
|
|
21
|
+
"bun": "./dist/localdb.plugin.js",
|
|
15
22
|
"types": "./dist/localdb.plugin.d.ts",
|
|
16
|
-
"bun": "./src/localdb.plugin.ts",
|
|
17
23
|
"import": "./dist/localdb.plugin.js",
|
|
18
24
|
"default": "./dist/localdb.plugin.js"
|
|
19
25
|
},
|
|
20
|
-
"./cloud.plugin": {
|
|
21
|
-
"types": "./dist/localdb.cloud.plugin.d.ts",
|
|
22
|
-
"bun": "./src/localdb.cloud.plugin.ts",
|
|
23
|
-
"import": "./dist/localdb.cloud.plugin.js",
|
|
24
|
-
"default": "./dist/localdb.cloud.plugin.js"
|
|
25
|
-
},
|
|
26
26
|
"./schemas": {
|
|
27
|
+
"bun": "./dist/schemas/api.js",
|
|
27
28
|
"types": "./dist/schemas/api.d.ts",
|
|
28
|
-
"bun": "./src/schemas/api.ts",
|
|
29
29
|
"import": "./dist/schemas/api.js",
|
|
30
30
|
"default": "./dist/schemas/api.js"
|
|
31
31
|
},
|
|
32
32
|
"./migrations/load-sql": {
|
|
33
|
+
"bun": "./dist/migrations/load-sql.js",
|
|
33
34
|
"types": "./dist/migrations/load-sql.d.ts",
|
|
34
|
-
"bun": "./src/migrations/load-sql.ts",
|
|
35
35
|
"import": "./dist/migrations/load-sql.js",
|
|
36
36
|
"default": "./dist/migrations/load-sql.js"
|
|
37
37
|
},
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"import": "./dist
|
|
42
|
-
"default": "./dist
|
|
43
|
-
},
|
|
44
|
-
"./*.js": {
|
|
45
|
-
"types": "./dist/*.d.ts",
|
|
46
|
-
"bun": "./src/*.ts",
|
|
47
|
-
"import": "./dist/*.js",
|
|
48
|
-
"default": "./dist/*.js"
|
|
49
|
-
},
|
|
50
|
-
"./*/*": {
|
|
51
|
-
"types": "./dist/*/*.d.ts",
|
|
52
|
-
"bun": "./src/*/*.ts",
|
|
53
|
-
"import": "./dist/*/*.js",
|
|
54
|
-
"default": "./dist/*/*.js"
|
|
38
|
+
"./wal-policy": {
|
|
39
|
+
"bun": "./dist/core/wal-policy.js",
|
|
40
|
+
"types": "./dist/core/wal-policy.d.ts",
|
|
41
|
+
"import": "./dist/core/wal-policy.js",
|
|
42
|
+
"default": "./dist/core/wal-policy.js"
|
|
55
43
|
},
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"import": "./dist
|
|
60
|
-
"default": "./dist
|
|
44
|
+
"./location": {
|
|
45
|
+
"bun": "./dist/location.js",
|
|
46
|
+
"types": "./dist/location.d.ts",
|
|
47
|
+
"import": "./dist/location.js",
|
|
48
|
+
"default": "./dist/location.js"
|
|
61
49
|
},
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"import": "./dist
|
|
66
|
-
"default": "./dist
|
|
50
|
+
"./sqlite-driver": {
|
|
51
|
+
"bun": "./dist/driver/sqlite-driver.js",
|
|
52
|
+
"types": "./dist/driver/sqlite-driver.d.ts",
|
|
53
|
+
"import": "./dist/driver/sqlite-driver.js",
|
|
54
|
+
"default": "./dist/driver/sqlite-driver.js"
|
|
67
55
|
},
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"import": "./dist
|
|
72
|
-
"default": "./dist
|
|
56
|
+
"./sqlite-driver/base": {
|
|
57
|
+
"bun": "./dist/driver/sqlite-driver.base.js",
|
|
58
|
+
"types": "./dist/driver/sqlite-driver.base.d.ts",
|
|
59
|
+
"import": "./dist/driver/sqlite-driver.base.js",
|
|
60
|
+
"default": "./dist/driver/sqlite-driver.base.js"
|
|
73
61
|
},
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"import": "./dist
|
|
78
|
-
"default": "./dist
|
|
62
|
+
"./test-tooling/sqlite-driver-conformance": {
|
|
63
|
+
"bun": "./dist/testing/sqlite-driver-conformance.js",
|
|
64
|
+
"types": "./dist/testing/sqlite-driver-conformance.d.ts",
|
|
65
|
+
"import": "./dist/testing/sqlite-driver-conformance.js",
|
|
66
|
+
"default": "./dist/testing/sqlite-driver-conformance.js"
|
|
79
67
|
},
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"import": "./dist
|
|
84
|
-
"default": "./dist
|
|
85
|
-
},
|
|
86
|
-
"./*/*/*/*/*": {
|
|
87
|
-
"types": "./dist/*/*/*/*/*.d.ts",
|
|
88
|
-
"bun": "./src/*/*/*/*/*.ts",
|
|
89
|
-
"import": "./dist/*/*/*/*/*.js",
|
|
90
|
-
"default": "./dist/*/*/*/*/*.js"
|
|
91
|
-
},
|
|
92
|
-
"./*/*/*/*/*.js": {
|
|
93
|
-
"types": "./dist/*/*/*/*/*.d.ts",
|
|
94
|
-
"bun": "./src/*/*/*/*/*.ts",
|
|
95
|
-
"import": "./dist/*/*/*/*/*.js",
|
|
96
|
-
"default": "./dist/*/*/*/*/*.js"
|
|
68
|
+
"./pool": {
|
|
69
|
+
"bun": "./dist/pool.js",
|
|
70
|
+
"types": "./dist/pool.d.ts",
|
|
71
|
+
"import": "./dist/pool.js",
|
|
72
|
+
"default": "./dist/pool.js"
|
|
97
73
|
}
|
|
98
74
|
},
|
|
99
|
-
"publishConfig": {
|
|
100
|
-
"registry": "https://registry.npmjs.org",
|
|
101
|
-
"access": "public"
|
|
102
|
-
},
|
|
103
|
-
"peerDependencies": {
|
|
104
|
-
"@vibesdotdev/runtime": "0.0.2",
|
|
105
|
-
"@vibesdotdev/logging": "0.0.2",
|
|
106
|
-
"@vibesdotdev/cli": "0.0.2"
|
|
107
|
-
},
|
|
108
|
-
"scripts": {
|
|
109
|
-
"test": "bun test",
|
|
110
|
-
"check": "bun --bun tsc -p tsconfig.json --noEmit",
|
|
111
|
-
"build": "tsc -p tsconfig.json"
|
|
112
|
-
},
|
|
113
|
-
"license": "MIT",
|
|
114
75
|
"files": [
|
|
115
76
|
"dist",
|
|
116
|
-
"src",
|
|
117
|
-
"bin",
|
|
118
77
|
"README.md",
|
|
119
|
-
"LICENSE"
|
|
120
|
-
"!src/**/__tests__/**",
|
|
121
|
-
"!src/**/__stubs__/**",
|
|
122
|
-
"!src/**/*.test.ts",
|
|
123
|
-
"!src/**/*.test.tsx",
|
|
124
|
-
"!src/**/*.spec.ts",
|
|
125
|
-
"!src/**/*.spec.tsx",
|
|
126
|
-
"!dist/**/__tests__/**",
|
|
127
|
-
"!dist/**/__stubs__/**",
|
|
128
|
-
"!dist/**/*.test.js",
|
|
129
|
-
"!dist/**/*.test.js.map",
|
|
130
|
-
"!dist/**/*.test.d.ts",
|
|
131
|
-
"!dist/**/*.test.d.ts.map",
|
|
132
|
-
"!dist/**/*.spec.js",
|
|
133
|
-
"!dist/**/*.spec.js.map",
|
|
134
|
-
"!dist/**/*.spec.d.ts",
|
|
135
|
-
"!dist/**/*.spec.d.ts.map"
|
|
78
|
+
"LICENSE"
|
|
136
79
|
],
|
|
80
|
+
"scripts": {
|
|
81
|
+
"lint": "node ../node_modules/@vibesdotdev/internal-oxlint-toolchain/ratchet.mjs .",
|
|
82
|
+
"test": "bun test && bun run test:contention && bun run test:node",
|
|
83
|
+
"test:node": "rm -rf .cache/node-run && bun build --target=node --conditions=bun --splitting --format=esm --outdir .cache/node-run/bundle src/__tests__/node-run/localdb.node-run.ts && node --test .cache/node-run/bundle/localdb.node-run.js",
|
|
84
|
+
"check": "bun --bun tsc -p tsconfig.json",
|
|
85
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
86
|
+
"test:contention": "bun test ./src/__tests__/startup-contention.integration.ts"
|
|
87
|
+
},
|
|
88
|
+
"repository": {
|
|
89
|
+
"type": "git",
|
|
90
|
+
"url": "ssh://git@git.vibes.dev/vibesdotdev/framework.git",
|
|
91
|
+
"directory": "localdb"
|
|
92
|
+
},
|
|
93
|
+
"publishConfig": {
|
|
94
|
+
"registry": "https://packages.vibes.dev",
|
|
95
|
+
"access": "public"
|
|
96
|
+
},
|
|
137
97
|
"vibes": {
|
|
138
|
-
"visibility": "public
|
|
98
|
+
"visibility": "public",
|
|
99
|
+
"registry": {
|
|
100
|
+
"repositoryId": "4b1374d4-6830-4bfd-98e3-de66416368a8",
|
|
101
|
+
"directory": "localdb"
|
|
102
|
+
},
|
|
103
|
+
"handedRuntimeLogging": true
|
|
139
104
|
},
|
|
105
|
+
"type": "module",
|
|
106
|
+
"types": "./dist/index.d.ts",
|
|
107
|
+
"license": "MIT",
|
|
140
108
|
"description": "Local SQLite storage helpers and migration utilities for Vibes development surfaces.",
|
|
141
|
-
"homepage": "https://docs.vibes.dev/
|
|
109
|
+
"homepage": "https://docs.vibes.dev/localdb",
|
|
142
110
|
"bugs": {
|
|
143
|
-
"url": "https://docs.vibes.dev/
|
|
111
|
+
"url": "https://docs.vibes.dev/localdb#support"
|
|
112
|
+
},
|
|
113
|
+
"gitHead": "51230ebdad54bc405014633f435b499fa2a06b89",
|
|
114
|
+
"_vibes_source": {
|
|
115
|
+
"repo": "ssh://git@git.vibes.dev/vibesdotdev/framework.git",
|
|
116
|
+
"sha": "51230ebdad54bc405014633f435b499fa2a06b89",
|
|
117
|
+
"workspaceDigest": "sha256:a238deb4a7000e7e51353eaa5b0088fd048ca160459aef60ae36f2d2f3b4c1d6"
|
|
144
118
|
}
|
|
145
119
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-context.d.ts","sourceRoot":"","sources":["../../src/core/error-context.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAkBlF"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export function toErrorContext(error) {
|
|
2
|
-
if (error instanceof Error) {
|
|
3
|
-
return {
|
|
4
|
-
error: error.message,
|
|
5
|
-
name: error.name,
|
|
6
|
-
stack: error.stack
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
if (typeof error === 'object' && error !== null && !Array.isArray(error)) {
|
|
10
|
-
return error;
|
|
11
|
-
}
|
|
12
|
-
if (error === undefined) {
|
|
13
|
-
return undefined;
|
|
14
|
-
}
|
|
15
|
-
return { error: String(error) };
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=error-context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-context.js","sourceRoot":"","sources":["../../src/core/error-context.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc,CAAC,KAAc;IAC5C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC5B,OAAO;YACN,KAAK,EAAE,KAAK,CAAC,OAAO;YACpB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,KAAK,EAAE,KAAK,CAAC,KAAK;SAClB,CAAC;IACH,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1E,OAAO,KAAgC,CAAC;IACzC,CAAC;IAED,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AACjC,CAAC"}
|
package/dist/core/runtime.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/core/runtime.ts"],"names":[],"mappings":"AAMA,wBAAgB,uBAAuB,CAAC,KAAK,GAAE,OAAO,UAAuB,GAAG,OAAO,CAMtF;AAED,wBAAgB,sBAAsB,CAAC,KAAK,GAAE,OAAO,UAAuB,GAAG,OAAO,CAErF"}
|
package/dist/core/runtime.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
function hasRuntimeProcessVersion(name) {
|
|
2
|
-
if (typeof process === 'undefined')
|
|
3
|
-
return false;
|
|
4
|
-
const value = process.versions?.[name];
|
|
5
|
-
return typeof value === 'string' && value.length > 0;
|
|
6
|
-
}
|
|
7
|
-
export function isLocaldbBrowserRuntime(scope = globalThis) {
|
|
8
|
-
const globals = scope;
|
|
9
|
-
const hasWindow = typeof globals.window !== 'undefined' && globals.window !== null;
|
|
10
|
-
const hasDocument = typeof globals.document !== 'undefined' && globals.document !== null;
|
|
11
|
-
const hasServerRuntime = hasRuntimeProcessVersion('bun') || hasRuntimeProcessVersion('node');
|
|
12
|
-
return hasDocument || (hasWindow && !hasServerRuntime);
|
|
13
|
-
}
|
|
14
|
-
export function isLocaldbServerRuntime(scope = globalThis) {
|
|
15
|
-
return !isLocaldbBrowserRuntime(scope);
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=runtime.js.map
|
package/dist/core/runtime.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/core/runtime.ts"],"names":[],"mappings":"AAAA,SAAS,wBAAwB,CAAC,IAAoB;IACrD,IAAI,OAAO,OAAO,KAAK,WAAW;QAAE,OAAO,KAAK,CAAC;IACjD,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,QAA2B,UAAU;IAC5E,MAAM,OAAO,GAAG,KAAoD,CAAC;IACrE,MAAM,SAAS,GAAG,OAAO,OAAO,CAAC,MAAM,KAAK,WAAW,IAAI,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC;IACnF,MAAM,WAAW,GAAG,OAAO,OAAO,CAAC,QAAQ,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC;IACzF,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,KAAK,CAAC,IAAI,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAC7F,OAAO,WAAW,IAAI,CAAC,SAAS,IAAI,CAAC,gBAAgB,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,QAA2B,UAAU;IAC3E,OAAO,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LocalDB Cloud Plugin
|
|
3
|
-
*
|
|
4
|
-
* Cloud-bundle-safe variant of `localdb.plugin.ts`.
|
|
5
|
-
*
|
|
6
|
-
* LocalDB manages on-disk SQLite (libsql / better-sqlite3) for consumer
|
|
7
|
-
* environments. Every loader in `localdb.plugin.ts` is `.impl.consumer.ts`
|
|
8
|
-
* and reaches `bun:sqlite` / `node:fs`. None of it is reachable from a
|
|
9
|
-
* cloudflare-workers bundle.
|
|
10
|
-
*
|
|
11
|
-
* ai-web's plugin chain still loads localdb for shape uniformity per
|
|
12
|
-
* `apps/ai-web (consolidated)/SPEC.md` line 14. This empty cloud variant satisfies
|
|
13
|
-
* the chain without pulling consumer-only code into the cloud bundle.
|
|
14
|
-
*/
|
|
15
|
-
declare const _default: import("@vibesdotdev/runtime").RuntimePlugin;
|
|
16
|
-
export default _default;
|
|
17
|
-
//# sourceMappingURL=localdb.cloud.plugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"localdb.cloud.plugin.d.ts","sourceRoot":"","sources":["../src/localdb.cloud.plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;;AAIH,wBAMG"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LocalDB Cloud Plugin
|
|
3
|
-
*
|
|
4
|
-
* Cloud-bundle-safe variant of `localdb.plugin.ts`.
|
|
5
|
-
*
|
|
6
|
-
* LocalDB manages on-disk SQLite (libsql / better-sqlite3) for consumer
|
|
7
|
-
* environments. Every loader in `localdb.plugin.ts` is `.impl.consumer.ts`
|
|
8
|
-
* and reaches `bun:sqlite` / `node:fs`. None of it is reachable from a
|
|
9
|
-
* cloudflare-workers bundle.
|
|
10
|
-
*
|
|
11
|
-
* ai-web's plugin chain still loads localdb for shape uniformity per
|
|
12
|
-
* `apps/ai-web (consolidated)/SPEC.md` line 14. This empty cloud variant satisfies
|
|
13
|
-
* the chain without pulling consumer-only code into the cloud bundle.
|
|
14
|
-
*/
|
|
15
|
-
import { createRuntimePlugin } from '@vibesdotdev/runtime';
|
|
16
|
-
export default createRuntimePlugin({
|
|
17
|
-
// Same id as the consumer `localdb` plugin per AGENT-CONSTITUTION
|
|
18
|
-
// §PLUGIN ID PARITY: the bare id is the public capability.
|
|
19
|
-
id: 'localdb',
|
|
20
|
-
name: 'LocalDB (Cloud)',
|
|
21
|
-
description: 'Cloud-safe localdb registration — empty (localdb is consumer-only)'
|
|
22
|
-
});
|
|
23
|
-
//# sourceMappingURL=localdb.cloud.plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"localdb.cloud.plugin.js","sourceRoot":"","sources":["../src/localdb.cloud.plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,eAAe,mBAAmB,CAAC;IAClC,kEAAkE;IAClE,2DAA2D;IAC3D,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,oEAAoE;CACjF,CAAC,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'node:path';
|
|
2
|
-
|
|
3
|
-
export const databasePathsByNamespace: Record<string, string> = {
|
|
4
|
-
atlas: '.vibes/atlas/vibes.db',
|
|
5
|
-
session: '.vibes/session/sessions.db'
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export function resolveDatabasePathForNamespace(namespace: string): string | undefined {
|
|
9
|
-
return databasePathsByNamespace[namespace];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function resolveFromCwd(p: string): string {
|
|
13
|
-
return resolve(process.cwd(), p);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function formatAgeMs(ageMs: number): string {
|
|
17
|
-
const ageMin = Math.floor(ageMs / 60000);
|
|
18
|
-
const ageSec = Math.floor((ageMs % 60000) / 1000);
|
|
19
|
-
return ageMin > 0 ? `${ageMin}m ${ageSec}s` : `${ageSec}s`;
|
|
20
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dev LocalDB Migrate CLI Command Descriptor
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { createRuntimeAsset } from '@vibesdotdev/runtime';
|
|
6
|
-
|
|
7
|
-
export default createRuntimeAsset({
|
|
8
|
-
id: 'dev.localdb.migrate',
|
|
9
|
-
kind: 'cli/command',
|
|
10
|
-
name: 'migrate',
|
|
11
|
-
description: 'Run pending migrations',
|
|
12
|
-
group: 'dev.localdb',
|
|
13
|
-
surfaces: ['cli'],
|
|
14
|
-
hardware: ['consumer'],
|
|
15
|
-
enabled: true,
|
|
16
|
-
options: [
|
|
17
|
-
{ flags: '--namespace <name>', description: 'Run migrations for a specific namespace' },
|
|
18
|
-
{ flags: '--dry-run', description: 'Show pending migrations without applying them' }
|
|
19
|
-
]
|
|
20
|
-
});
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { getVibesRuntime } from '@vibesdotdev/runtime';
|
|
3
|
-
import { requestCLIExit, type UIContext } from '@vibesdotdev/cli/providers';
|
|
4
|
-
import type { LocaldbApi, MigrationRegistryApi } from '../../..';
|
|
5
|
-
import { resolveDatabasePathForNamespace, resolveFromCwd } from '../_shared.consumer';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
async execute(_args: Record<string, unknown>, opts: Record<string, unknown>): Promise<void> {
|
|
9
|
-
const runtime = getVibesRuntime();
|
|
10
|
-
const ui = (await runtime.context('cli/ui')) as UIContext;
|
|
11
|
-
const localdb = (await runtime.context('dev/localdb')) as LocaldbApi;
|
|
12
|
-
|
|
13
|
-
const namespaceOpt = typeof opts.namespace === 'string' ? opts.namespace : undefined;
|
|
14
|
-
const dryRun = Boolean(opts.dryRun);
|
|
15
|
-
|
|
16
|
-
ui.log(`\n=== LocalDB Migrate${dryRun ? ' (Dry Run)' : ''} ===\n`);
|
|
17
|
-
|
|
18
|
-
const namespaces = localdb.listNamespaces();
|
|
19
|
-
if (namespaces.length === 0) {
|
|
20
|
-
ui.info('No migration namespaces registered.');
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const namespacesToMigrate = namespaceOpt
|
|
25
|
-
? namespaces.filter((ns) => ns === namespaceOpt)
|
|
26
|
-
: namespaces;
|
|
27
|
-
|
|
28
|
-
if (namespacesToMigrate.length === 0) {
|
|
29
|
-
ui.error(`Namespace '${namespaceOpt}' not found.`);
|
|
30
|
-
ui.info(`Available namespaces: ${namespaces.join(', ')}`);
|
|
31
|
-
requestCLIExit(1);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const { migrationRegistry } =
|
|
35
|
-
(await import('../../../core/migration-registry')) as {
|
|
36
|
-
migrationRegistry: MigrationRegistryApi;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
let migratedCount = 0;
|
|
40
|
-
let errorCount = 0;
|
|
41
|
-
|
|
42
|
-
for (const ns of namespacesToMigrate) {
|
|
43
|
-
const dbPath = resolveDatabasePathForNamespace(ns);
|
|
44
|
-
if (!dbPath) {
|
|
45
|
-
ui.warn(`Skipping '${ns}': no known database path`);
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const fullPath = resolveFromCwd(dbPath);
|
|
50
|
-
if (!existsSync(fullPath)) {
|
|
51
|
-
ui.warn(`Skipping '${ns}': database not found (${dbPath})`);
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
ui.log(`\nNamespace: ${ns}`);
|
|
56
|
-
ui.log(`Database: ${dbPath}`);
|
|
57
|
-
|
|
58
|
-
try {
|
|
59
|
-
const db = localdb.getRawDatabase(fullPath, 'localdb-migrate');
|
|
60
|
-
const needsMigration = migrationRegistry.needsMigration(db, ns);
|
|
61
|
-
|
|
62
|
-
if (!needsMigration) {
|
|
63
|
-
ui.success('Already up to date');
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const status = migrationRegistry.getDatabaseStatus(db, ns);
|
|
68
|
-
ui.log(
|
|
69
|
-
`Pending: ${status.pendingMigrations} migration(s) (v${status.currentVersion} → v${status.targetVersion})`
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
if (dryRun) {
|
|
73
|
-
ui.log('Would apply:');
|
|
74
|
-
for (const m of status.migrations) {
|
|
75
|
-
if (!m.applied) ui.log(` • v${m.version}: ${m.name}`);
|
|
76
|
-
}
|
|
77
|
-
} else {
|
|
78
|
-
await migrationRegistry.runMigrations(db, ns);
|
|
79
|
-
ui.success('Migrations completed');
|
|
80
|
-
migratedCount++;
|
|
81
|
-
}
|
|
82
|
-
} catch (error) {
|
|
83
|
-
ui.error(`Error: ${String(error)}`);
|
|
84
|
-
errorCount++;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
ui.log('\n' + '─'.repeat(50));
|
|
89
|
-
if (dryRun) {
|
|
90
|
-
ui.info(`Dry run complete. Checked ${namespacesToMigrate.length} namespace(s).`);
|
|
91
|
-
} else {
|
|
92
|
-
ui.info(`Migration complete: ${migratedCount} migrated, ${errorCount} errors`);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (errorCount > 0) requestCLIExit(1);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dev LocalDB Namespaces CLI Command Descriptor
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { createRuntimeAsset } from '@vibesdotdev/runtime';
|
|
6
|
-
|
|
7
|
-
export default createRuntimeAsset({
|
|
8
|
-
id: 'dev.localdb.namespaces',
|
|
9
|
-
kind: 'cli/command',
|
|
10
|
-
name: 'namespaces',
|
|
11
|
-
description: 'List registered migration namespaces',
|
|
12
|
-
group: 'dev.localdb',
|
|
13
|
-
surfaces: ['cli'],
|
|
14
|
-
hardware: ['consumer'],
|
|
15
|
-
enabled: true,
|
|
16
|
-
options: [{ flags: '--verbose', description: 'Show migration details for each namespace' }]
|
|
17
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { getVibesRuntime } from '@vibesdotdev/runtime';
|
|
2
|
-
import type { UIContext } from '@vibesdotdev/cli/providers';
|
|
3
|
-
import type { LocaldbApi, MigrationRegistryApi } from '../../..';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
async execute(_args: Record<string, unknown>, opts: Record<string, unknown>): Promise<void> {
|
|
7
|
-
const runtime = getVibesRuntime();
|
|
8
|
-
const ui = (await runtime.context('cli/ui')) as UIContext;
|
|
9
|
-
const localdb = (await runtime.context('dev/localdb')) as LocaldbApi;
|
|
10
|
-
|
|
11
|
-
const verbose = Boolean(opts.verbose);
|
|
12
|
-
|
|
13
|
-
ui.log('\n=== Registered Migration Namespaces ===\n');
|
|
14
|
-
|
|
15
|
-
const namespaces = localdb.listNamespaces();
|
|
16
|
-
if (namespaces.length === 0) {
|
|
17
|
-
ui.info('No migration namespaces registered.');
|
|
18
|
-
ui.info('Namespaces are registered when their modules are loaded.');
|
|
19
|
-
ui.info('Try running a command that uses the database first.');
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (!verbose) {
|
|
24
|
-
ui.table(namespaces.map((ns) => ({ namespace: ns })));
|
|
25
|
-
ui.info('\nUse --verbose to see migration details\n');
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const { migrationRegistry } =
|
|
30
|
-
(await import('../../../core/migration-registry')) as {
|
|
31
|
-
migrationRegistry: MigrationRegistryApi;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
for (const ns of namespaces) {
|
|
35
|
-
ui.log(`\nNamespace: ${ns}`);
|
|
36
|
-
const migrations = migrationRegistry.getMigrations(ns);
|
|
37
|
-
ui.log(`Migrations: ${migrations.length}`);
|
|
38
|
-
|
|
39
|
-
for (const m of migrations) {
|
|
40
|
-
ui.log(` • v${m.version}: ${m.name}${m.down ? ' (reversible)' : ''}`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
ui.log('\n');
|
|
45
|
-
}
|
|
46
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dev LocalDB Pools CLI Command Descriptor
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { createRuntimeAsset } from '@vibesdotdev/runtime';
|
|
6
|
-
|
|
7
|
-
export default createRuntimeAsset({
|
|
8
|
-
id: 'dev.localdb.pools',
|
|
9
|
-
kind: 'cli/command',
|
|
10
|
-
name: 'pools',
|
|
11
|
-
description: 'Show connection pool statistics',
|
|
12
|
-
group: 'dev.localdb',
|
|
13
|
-
surfaces: ['cli'],
|
|
14
|
-
hardware: ['consumer'],
|
|
15
|
-
enabled: true
|
|
16
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { getVibesRuntime } from '@vibesdotdev/runtime';
|
|
2
|
-
import type { UIContext } from '@vibesdotdev/cli/providers';
|
|
3
|
-
import type { LocaldbApi } from '../../..';
|
|
4
|
-
import { formatAgeMs } from '../_shared.consumer';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
async execute(_args: Record<string, unknown>, _opts: Record<string, unknown>): Promise<void> {
|
|
8
|
-
const runtime = getVibesRuntime();
|
|
9
|
-
const ui = (await runtime.context('cli/ui')) as UIContext;
|
|
10
|
-
const localdb = (await runtime.context('dev/localdb')) as LocaldbApi;
|
|
11
|
-
|
|
12
|
-
ui.log('\n=== Connection Pool Statistics ===\n');
|
|
13
|
-
|
|
14
|
-
const stats = localdb.getPoolStats();
|
|
15
|
-
|
|
16
|
-
ui.log(`Total Connections: ${stats.total}`);
|
|
17
|
-
ui.log(`Active (in use): ${stats.active}`);
|
|
18
|
-
ui.log(`Idle (pooled): ${stats.idle}`);
|
|
19
|
-
|
|
20
|
-
if (stats.connections.length === 0) {
|
|
21
|
-
ui.info('\nNo active connections.\n');
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
ui.log('\nConnections:\n' + '─'.repeat(80));
|
|
26
|
-
ui.table(
|
|
27
|
-
stats.connections.map((c) => ({
|
|
28
|
-
path: c.path,
|
|
29
|
-
status: c.refCount > 0 ? 'ACTIVE' : 'IDLE',
|
|
30
|
-
refs: c.refCount,
|
|
31
|
-
age: formatAgeMs(c.ageMs),
|
|
32
|
-
consumer: c.consumer
|
|
33
|
-
}))
|
|
34
|
-
);
|
|
35
|
-
ui.log('');
|
|
36
|
-
}
|
|
37
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dev LocalDB Query CLI Command Descriptor
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { createRuntimeAsset } from '@vibesdotdev/runtime';
|
|
6
|
-
|
|
7
|
-
export default createRuntimeAsset({
|
|
8
|
-
id: 'dev.localdb.query',
|
|
9
|
-
kind: 'cli/command',
|
|
10
|
-
name: 'query',
|
|
11
|
-
description: 'Execute an SQL query on a database',
|
|
12
|
-
group: 'dev.localdb',
|
|
13
|
-
surfaces: ['cli'],
|
|
14
|
-
hardware: ['consumer'],
|
|
15
|
-
enabled: true,
|
|
16
|
-
arguments: [{ name: 'sql', description: 'SQL statement to execute', required: true }],
|
|
17
|
-
options: [
|
|
18
|
-
{ flags: '--db <path>', description: 'Database file path (required)' },
|
|
19
|
-
{ flags: '--json', description: 'Output results as JSON' }
|
|
20
|
-
]
|
|
21
|
-
});
|