@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/LICENSE
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 VIBES DEV LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
6
|
+
associated documentation files (the "Software"), to deal in the Software without restriction, including
|
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
|
|
9
|
+
following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
12
|
+
portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
|
15
|
+
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
|
|
16
|
+
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
18
|
+
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -14,9 +14,130 @@ npm install @vibesdotdev/localdb
|
|
|
14
14
|
|
|
15
15
|
## Documentation
|
|
16
16
|
|
|
17
|
-
- Package guide: https://docs.vibes.dev/
|
|
17
|
+
- Package guide: https://docs.vibes.dev/localdb
|
|
18
18
|
- Vibes docs: https://docs.vibes.dev
|
|
19
19
|
|
|
20
20
|
## License
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
MIT. See [LICENSE](LICENSE).
|
|
24
|
+
|
|
25
|
+
## Migrations
|
|
26
|
+
|
|
27
|
+
Register with `localdb.registerMigrations(runtime, namespace, migrations, options?)`.
|
|
28
|
+
Declarations belong to that runtime's `localdb/migrations` kernel kind.
|
|
29
|
+
Versions must form `1..N`; input order is sorted. Each migration has a positive
|
|
30
|
+
integer `version`, a nonblank `name`, and an `up(db)` callback (optional `down`).
|
|
31
|
+
Recovery remains fail-closed unless the owner explicitly declares
|
|
32
|
+
`autoReset: true` for rebuildable data.
|
|
33
|
+
|
|
34
|
+
Registry reads now take the runtime first:
|
|
35
|
+
`migrationRegistry.getMigrations(runtime, namespace)`,
|
|
36
|
+
`getDatabaseStatus(runtime, db, namespace)`, and `listNamespaces(runtime)`.
|
|
37
|
+
The deprecated `getMigrations(namespace)` signature refuses
|
|
38
|
+
`INVALID_INPUT localdb-runtime-required`; callers must supply their runtime.
|
|
39
|
+
The runtime context's manager also supports its bound runtime for reads.
|
|
40
|
+
Unbound manager enumeration requires `localdb.listNamespaces(runtime)`.
|
|
41
|
+
Locations resolve through `resolveDatabaseLocationForNamespace(runtime, namespace)`.
|
|
42
|
+
|
|
43
|
+
Registration, guarded replacement, recovery options, and location types come
|
|
44
|
+
from the owning Zod schemas exported by `./schemas`. Malformed registration
|
|
45
|
+
refuses `INVALID_INPUT localdb-migration-registration-invalid`; malformed
|
|
46
|
+
replacement refuses `localdb-migration-replacement-invalid`, before mutation.
|
|
47
|
+
Replacement compares the exact observed version/name IDs and returns `false`
|
|
48
|
+
on a stale expectation. Location callbacks run only when queried; invalid
|
|
49
|
+
results refuse `localdb-migration-location-invalid`. They must return absolute
|
|
50
|
+
expected paths. Callback failures propagate to the caller.
|
|
51
|
+
|
|
52
|
+
Version tracking, legacy `user_version` bootstrap, and the migration execution
|
|
53
|
+
engine retain their behavior. Earlier successful migrations remain recorded
|
|
54
|
+
if a later migration fails; each migration must make its own changes atomic
|
|
55
|
+
or idempotent.
|
|
56
|
+
|
|
57
|
+
## Runtime ownership and cleanup
|
|
58
|
+
|
|
59
|
+
Compose `@vibesdotdev/localdb/plugin` on a consumer host. After activation,
|
|
60
|
+
`getVibesClient('localdb', runtime)`, `tryGetVibesClient('localdb', runtime)`
|
|
61
|
+
and the `dev/localdb` context identify the same runtime-owned client.
|
|
62
|
+
The root `localdb` helper remains compatible and takes the handed runtime;
|
|
63
|
+
synchronous migration helpers query its kernel declarations directly. Calling a
|
|
64
|
+
bound client with another runtime lifecycle refuses
|
|
65
|
+
`CONFLICT localdb-runtime-mismatch`, including migration status, namespace
|
|
66
|
+
listing, and location reads. Omitted runtimes on these reads use the bound owner;
|
|
67
|
+
same-lifecycle views are accepted.
|
|
68
|
+
|
|
69
|
+
Each runtime has its own logical database handles and a kernel-owned default
|
|
70
|
+
physical pool. Reload generations inherit their root's pool. Composition roots
|
|
71
|
+
opening the same files across runtimes create one pool with
|
|
72
|
+
`createConnectionPool()` from `@vibesdotdev/localdb/pool` and pass it to each root with
|
|
73
|
+
`shareConnectionPool(runtime, pool)`. Register it during composition, before activation or first pool resolution.
|
|
74
|
+
The shared loader has higher kernel priority than the default and shares one SQLite connection and one path lock per file.
|
|
75
|
+
There is no ambient pool.
|
|
76
|
+
Disposing one runtime closes its logical handles while other holders keep working. A fork has its own
|
|
77
|
+
lifecycle; a view of the same lifecycle releases the same holdings.
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
The root `connectionPool` is a stateless compatibility facade. Its runtime-first
|
|
81
|
+
operations (`getConnection`, `retain`, `releaseConnection`, `closeConnection`,
|
|
82
|
+
`maintain`, `assertCanReplaceDatabase`, `closeAll`) route through the handed
|
|
83
|
+
runtime. `await connectionPool.forRuntime(runtime)` exposes the full
|
|
84
|
+
`ConnectionPoolApi` after kernel resolution. Synchronous facade calls require
|
|
85
|
+
an already resolved owner; otherwise they refuse
|
|
86
|
+
`UNAVAILABLE localdb-pool-unavailable`. Async resolution uses that refusal
|
|
87
|
+
only for absent pool registration; loader and implementation validation failures
|
|
88
|
+
propagate. The legacy `getStats()`, `withDatabasePathLock(path, task)`,
|
|
89
|
+
`releaseOrphanedConnection(path)`, and `ownsConnection(path, db)` signatures
|
|
90
|
+
remain callable and refuse `INVALID_INPUT localdb-runtime-required` when
|
|
91
|
+
ownership cannot be identified. Supply the runtime as the last argument or use
|
|
92
|
+
`forRuntime(runtime)`.
|
|
93
|
+
|
|
94
|
+
Physical implementations and composition helpers (`SQLiteConnectionPool`,
|
|
95
|
+
`createConnectionPool`, `shareConnectionPool`) live on `./pool`, outside
|
|
96
|
+
the root barrel. Re-registering the resolved shared owner is idempotent;
|
|
97
|
+
a different owner, a duplicate pending registration, or sharing after the default
|
|
98
|
+
was resolved refuses `CONFLICT localdb-pool-owner-selected`. Clients retain
|
|
99
|
+
their captured owner through release, reset, disposal and cleanup retries.
|
|
100
|
+
The public pool facade uses that same semantic client's captured owner, including
|
|
101
|
+
`forRuntime(runtime)`. Replacing a kernel pool loader or registering a higher
|
|
102
|
+
priority pool affects future clients; it never redirects an existing client's
|
|
103
|
+
acquisitions, statistics, locks or cleanup to a competing pool.
|
|
104
|
+
Independent roots have independent defaults. Automatic process-wide sharing
|
|
105
|
+
still requires the external host composition root to create one pool and register
|
|
106
|
+
it on every root before activation; this package does not provide that host wiring.
|
|
107
|
+
|
|
108
|
+
Concurrent `closeAll(runtime)` calls share cleanup. Every close is attempted;
|
|
109
|
+
failures propagate together as `AggregateError` and failed resources remain
|
|
110
|
+
available for retry. Direct `close(runtime)` propagates the driver's
|
|
111
|
+
`INTERNAL sqlite-close-failed` and keeps the same connection for another close
|
|
112
|
+
attempt. Pooled handles release their reference once; a refused physical close
|
|
113
|
+
stays owned by the pool, so retrying cleanup preserves other live borrowers.
|
|
114
|
+
A handle that acquired a connection but never finished initializing keeps that
|
|
115
|
+
connection reachable through `close(runtime)`. While the logical handle still
|
|
116
|
+
owns the connection — a direct handle whose close the driver refused — retrying
|
|
117
|
+
`initialize()` refuses `CONFLICT localdb-database-open` instead of abandoning
|
|
118
|
+
it; a pooled handle's logical release succeeds even when the pool's physical
|
|
119
|
+
close is refused, so the connection stays with the pool at zero references and
|
|
120
|
+
the handle owes no second release. Completed closes are idempotent. Ended-runtime releases sweep orphaned physical holdings
|
|
121
|
+
without suppressing cleanup failures. After full runtime disposal, new facade
|
|
122
|
+
lookups propagate the kernel's `INTERNAL runtime-unbootstrapped` refusal;
|
|
123
|
+
cleanup must run during finalization while its captured owner is accessible. New opens on an ending runtime refuse
|
|
124
|
+
`CANCELLED runtime-disposed`; closed handles refuse
|
|
125
|
+
`UNAVAILABLE localdb-database-closed`. Reset and automatic recovery refuse
|
|
126
|
+
`CONFLICT localdb-database-in-use` before touching another borrower's data.
|
|
127
|
+
|
|
128
|
+
Pooled and direct startup share one five-second contention budget measured by
|
|
129
|
+
the calling lifecycle clock. Only typed `sqlite-busy` setup failures retry.
|
|
130
|
+
The captured lifecycle owns the delay: disposal refuses `CANCELLED wait-aborted`
|
|
131
|
+
while waiting, or `CANCELLED runtime-disposed` during setup or before publication.
|
|
132
|
+
The budget spans all attempts and delays; each setup statement receives only its
|
|
133
|
+
remaining time. Failed handles close immediately; a failed close propagates both failures in an
|
|
134
|
+
`AggregateError` and prevents retry. Migrations and application statements are
|
|
135
|
+
never retried by this startup policy.
|
|
136
|
+
|
|
137
|
+
The root is isomorphic; `./plugin` is consumer-only and includes CLI loaders.
|
|
138
|
+
Driver bases and conformance helpers use the explicit `./sqlite-driver/base`
|
|
139
|
+
and `./test-tooling/sqlite-driver-conformance` subpaths.
|
|
140
|
+
|
|
141
|
+
Run `bun run check`, `bun run test` and `bun run build` for typechecking,
|
|
142
|
+
in-process unit proof and production emission. Cross-process startup is the
|
|
143
|
+
separate `bun run test:contention` integration entrypoint.
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare function resolveDatabasePathForNamespace(namespace: string): string | undefined;
|
|
3
|
-
export declare function resolveFromCwd(p: string): string;
|
|
1
|
+
export { resolveDatabaseLocationForNamespace, type NamespaceDatabaseLocation } from '../../location.ts';
|
|
4
2
|
export declare function formatAgeMs(ageMs: number): string;
|
|
5
3
|
//# sourceMappingURL=_shared.consumer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_shared.consumer.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/_shared.consumer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_shared.consumer.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/_shared.consumer.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,mCAAmC,EACnC,KAAK,yBAAyB,EAC9B,MAAM,mBAAmB,CAAC;AAE3B,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIjD"}
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export const databasePathsByNamespace = {
|
|
3
|
-
atlas: '.vibes/atlas/vibes.db',
|
|
4
|
-
session: '.vibes/session/sessions.db'
|
|
5
|
-
};
|
|
6
|
-
export function resolveDatabasePathForNamespace(namespace) {
|
|
7
|
-
return databasePathsByNamespace[namespace];
|
|
8
|
-
}
|
|
9
|
-
export function resolveFromCwd(p) {
|
|
10
|
-
return resolve(process.cwd(), p);
|
|
11
|
-
}
|
|
1
|
+
export { resolveDatabaseLocationForNamespace } from "../../location.js";
|
|
12
2
|
export function formatAgeMs(ageMs) {
|
|
13
3
|
const ageMin = Math.floor(ageMs / 60000);
|
|
14
4
|
const ageSec = Math.floor((ageMs % 60000) / 1000);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_shared.consumer.js","sourceRoot":"","sources":["../../../src/cli/commands/_shared.consumer.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"_shared.consumer.js","sourceRoot":"","sources":["../../../src/cli/commands/_shared.consumer.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,mCAAmC,EAEnC,MAAM,mBAAmB,CAAC;AAE3B,MAAM,UAAU,WAAW,CAAC,KAAa;IACxC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;IACzC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;IAClD,OAAO,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,CAAC;AAC5D,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Dev LocalDB Migrate CLI Command Descriptor
|
|
3
3
|
*/
|
|
4
|
-
import { createRuntimeAsset } from '@vibesdotdev/
|
|
4
|
+
import { createRuntimeAsset } from '@vibesdotdev/kernel';
|
|
5
5
|
export default createRuntimeAsset({
|
|
6
6
|
id: 'dev.localdb.migrate',
|
|
7
7
|
kind: 'cli/command',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.localdb.migrate.cli-command.descriptor.js","sourceRoot":"","sources":["../../../../src/cli/commands/migrate/dev.localdb.migrate.cli-command.descriptor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"dev.localdb.migrate.cli-command.descriptor.js","sourceRoot":"","sources":["../../../../src/cli/commands/migrate/dev.localdb.migrate.cli-command.descriptor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,eAAe,kBAAkB,CAAC;IACjC,EAAE,EAAE,qBAAqB;IACzB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,wBAAwB;IACrC,KAAK,EAAE,aAAa;IACpB,QAAQ,EAAE,CAAC,KAAK,CAAC;IACjB,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,OAAO,EAAE,IAAI;IACb,OAAO,EAAE;QACR,EAAE,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,yCAAyC,EAAE;QACvF,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,+CAA+C,EAAE;KACpF;CACD,CAAC,CAAC"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { LocalDbCliCommandContext, LocalDbCliNoArguments } from '../../types.ts';
|
|
2
|
+
/** The options the CLI parses from this command's descriptor. */
|
|
3
|
+
interface MigrateOptions {
|
|
4
|
+
namespace?: string;
|
|
5
|
+
dryRun?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const defaultExport: {
|
|
8
|
+
execute(_args: LocalDbCliNoArguments, opts: MigrateOptions, context: LocalDbCliCommandContext): Promise<void>;
|
|
3
9
|
};
|
|
4
|
-
export default
|
|
10
|
+
export default defaultExport;
|
|
5
11
|
//# sourceMappingURL=dev.localdb.migrate.cli-command.impl.consumer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.localdb.migrate.cli-command.impl.consumer.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/migrate/dev.localdb.migrate.cli-command.impl.consumer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.localdb.migrate.cli-command.impl.consumer.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/migrate/dev.localdb.migrate.cli-command.impl.consumer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEX,wBAAwB,EACxB,qBAAqB,EAErB,MAAM,gBAAgB,CAAC;AAOxB,iEAAiE;AACjE,UAAU,cAAc;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAiCD,QAAA,MAAM,aAAa;mBACG,qBAAqB,QAAQ,cAAc,WAAW,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;CAyEnH,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,16 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { migrationRegistry } from "../../../core/migration-registry.js";
|
|
2
|
+
import { attempt, settle } from "../../../core/outcome.js";
|
|
3
|
+
import { resolveDatabaseLocationForNamespace } from "../_shared.consumer.js";
|
|
4
|
+
import { existingFiles, readCliFlag, readCliText } from "../../inputs.js";
|
|
5
|
+
/** Migrate one database file, or list what would run; reports through `ui`, and logs on the command's runtime. */
|
|
6
|
+
async function migrateDatabase(runtime, localdb, ui, namespace, fullPath, dryRun) {
|
|
7
|
+
const db = await localdb.getRawDatabase(runtime, fullPath, 'localdb-migrate');
|
|
8
|
+
if (!migrationRegistry.needsMigration(runtime, db, namespace)) {
|
|
9
|
+
ui.success('Already up to date');
|
|
10
|
+
return 'current';
|
|
11
|
+
}
|
|
12
|
+
const status = migrationRegistry.getDatabaseStatus(runtime, db, namespace);
|
|
13
|
+
ui.log(`Pending: ${status.pendingMigrations} migration(s) (v${status.currentVersion} → v${status.targetVersion})`);
|
|
14
|
+
if (dryRun) {
|
|
15
|
+
ui.log('Would apply:');
|
|
16
|
+
for (const m of status.migrations) {
|
|
17
|
+
if (!m.applied)
|
|
18
|
+
ui.log(` • v${m.version}: ${m.name}`);
|
|
19
|
+
}
|
|
20
|
+
return 'listed';
|
|
21
|
+
}
|
|
22
|
+
await migrationRegistry.runMigrations(runtime, db, namespace);
|
|
23
|
+
ui.success('Migrations completed');
|
|
24
|
+
return 'migrated';
|
|
25
|
+
}
|
|
26
|
+
// Hoisted const: tsc rewriteRelativeImportExtensions does not rewrite `.ts` specifiers inside `export default <expr>` (TS 6.0.3).
|
|
27
|
+
const defaultExport = {
|
|
28
|
+
async execute(_args, opts, context) {
|
|
29
|
+
const runtime = context.runtime;
|
|
30
|
+
const ui = await runtime.context('cli/ui');
|
|
31
|
+
const app = await runtime.context('cli/app');
|
|
32
|
+
const localdb = await runtime.context('dev/localdb');
|
|
33
|
+
const namespaceOpt = readCliText(opts, 'namespace');
|
|
34
|
+
const dryRun = readCliFlag(opts, 'dryRun');
|
|
12
35
|
ui.log(`\n=== LocalDB Migrate${dryRun ? ' (Dry Run)' : ''} ===\n`);
|
|
13
|
-
const namespaces = localdb.listNamespaces();
|
|
36
|
+
const namespaces = localdb.listNamespaces(runtime);
|
|
14
37
|
if (namespaces.length === 0) {
|
|
15
38
|
ui.info('No migration namespaces registered.');
|
|
16
39
|
return;
|
|
@@ -21,50 +44,40 @@ export default {
|
|
|
21
44
|
if (namespacesToMigrate.length === 0) {
|
|
22
45
|
ui.error(`Namespace '${namespaceOpt}' not found.`);
|
|
23
46
|
ui.info(`Available namespaces: ${namespaces.join(', ')}`);
|
|
24
|
-
|
|
47
|
+
app.exit(1);
|
|
48
|
+
return;
|
|
25
49
|
}
|
|
26
|
-
const { migrationRegistry } = (await import('../../../core/migration-registry'));
|
|
27
50
|
let migratedCount = 0;
|
|
28
51
|
let errorCount = 0;
|
|
29
52
|
for (const ns of namespacesToMigrate) {
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
ui.
|
|
53
|
+
const located = attempt(() => resolveDatabaseLocationForNamespace(runtime, ns));
|
|
54
|
+
if (located.failed) {
|
|
55
|
+
ui.error(`Skipping '${ns}': database location unresolvable (${String(located.cause)})`);
|
|
56
|
+
errorCount++;
|
|
33
57
|
continue;
|
|
34
58
|
}
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
37
|
-
ui.warn(`Skipping '${ns}':
|
|
59
|
+
const location = located.value;
|
|
60
|
+
if (!location) {
|
|
61
|
+
ui.warn(`Skipping '${ns}': no declared database location`);
|
|
38
62
|
continue;
|
|
39
63
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
ui.log('Would apply:');
|
|
53
|
-
for (const m of status.migrations) {
|
|
54
|
-
if (!m.applied)
|
|
55
|
-
ui.log(` • v${m.version}: ${m.name}`);
|
|
56
|
-
}
|
|
64
|
+
const existingPaths = await existingFiles(runtime, location.expectedPaths);
|
|
65
|
+
if (existingPaths.length === 0) {
|
|
66
|
+
ui.warn(`Skipping '${ns}': no database found (${location.description})`);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
for (const fullPath of existingPaths) {
|
|
70
|
+
ui.log(`\nNamespace: ${ns}`);
|
|
71
|
+
ui.log(`Database: ${fullPath}`);
|
|
72
|
+
const migrated = await settle(migrateDatabase(runtime, localdb, ui, ns, fullPath, dryRun));
|
|
73
|
+
if (migrated.failed) {
|
|
74
|
+
ui.error(`Error: ${String(migrated.cause)}`);
|
|
75
|
+
errorCount++;
|
|
57
76
|
}
|
|
58
|
-
else {
|
|
59
|
-
await migrationRegistry.runMigrations(db, ns);
|
|
60
|
-
ui.success('Migrations completed');
|
|
77
|
+
else if (migrated.value === 'migrated') {
|
|
61
78
|
migratedCount++;
|
|
62
79
|
}
|
|
63
80
|
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
ui.error(`Error: ${String(error)}`);
|
|
66
|
-
errorCount++;
|
|
67
|
-
}
|
|
68
81
|
}
|
|
69
82
|
ui.log('\n' + '─'.repeat(50));
|
|
70
83
|
if (dryRun) {
|
|
@@ -74,7 +87,8 @@ export default {
|
|
|
74
87
|
ui.info(`Migration complete: ${migratedCount} migrated, ${errorCount} errors`);
|
|
75
88
|
}
|
|
76
89
|
if (errorCount > 0)
|
|
77
|
-
|
|
90
|
+
app.exit(1);
|
|
78
91
|
}
|
|
79
92
|
};
|
|
93
|
+
export default defaultExport;
|
|
80
94
|
//# sourceMappingURL=dev.localdb.migrate.cli-command.impl.consumer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.localdb.migrate.cli-command.impl.consumer.js","sourceRoot":"","sources":["../../../../src/cli/commands/migrate/dev.localdb.migrate.cli-command.impl.consumer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.localdb.migrate.cli-command.impl.consumer.js","sourceRoot":"","sources":["../../../../src/cli/commands/migrate/dev.localdb.migrate.cli-command.impl.consumer.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,mCAAmC,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAQ1E,kHAAkH;AAClH,KAAK,UAAU,eAAe,CAC7B,OAAmB,EACnB,OAAmB,EACnB,EAAuB,EACvB,SAAiB,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AC;gBACjB,CAAC;YACF,CAAC;QACF,CAAC;QAED,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9B,IAAI,MAAM,EAAE,CAAC;YACZ,EAAE,CAAC,IAAI,CAAC,6BAA6B,mBAAmB,CAAC,MAAM,gBAAgB,CAAC,CAAC;QAClF,CAAC;aAAM,CAAC;YACP,EAAE,CAAC,IAAI,CAAC,uBAAuB,aAAa,cAAc,UAAU,SAAS,CAAC,CAAC;QAChF,CAAC;QAED,IAAI,UAAU,GAAG,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;CACD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Dev LocalDB Namespaces CLI Command Descriptor
|
|
3
3
|
*/
|
|
4
|
-
import { createRuntimeAsset } from '@vibesdotdev/
|
|
4
|
+
import { createRuntimeAsset } from '@vibesdotdev/kernel';
|
|
5
5
|
export default createRuntimeAsset({
|
|
6
6
|
id: 'dev.localdb.namespaces',
|
|
7
7
|
kind: 'cli/command',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.localdb.namespaces.cli-command.descriptor.js","sourceRoot":"","sources":["../../../../src/cli/commands/namespaces/dev.localdb.namespaces.cli-command.descriptor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"dev.localdb.namespaces.cli-command.descriptor.js","sourceRoot":"","sources":["../../../../src/cli/commands/namespaces/dev.localdb.namespaces.cli-command.descriptor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,eAAe,kBAAkB,CAAC;IACjC,EAAE,EAAE,wBAAwB;IAC5B,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,sCAAsC;IACnD,KAAK,EAAE,aAAa;IACpB,QAAQ,EAAE,CAAC,KAAK,CAAC;IACjB,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,2CAA2C,EAAE,CAAC;CAC3F,CAAC,CAAC"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { LocalDbCliCommandContext, LocalDbCliNoArguments } from '../../types.ts';
|
|
2
|
+
/** The options the CLI parses from this command's descriptor. */
|
|
3
|
+
interface NamespacesOptions {
|
|
4
|
+
verbose?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const defaultExport: {
|
|
7
|
+
execute(_args: LocalDbCliNoArguments, opts: NamespacesOptions, context: LocalDbCliCommandContext): Promise<void>;
|
|
3
8
|
};
|
|
4
|
-
export default
|
|
9
|
+
export default defaultExport;
|
|
5
10
|
//# sourceMappingURL=dev.localdb.namespaces.cli-command.impl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.localdb.namespaces.cli-command.impl.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/namespaces/dev.localdb.namespaces.cli-command.impl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.localdb.namespaces.cli-command.impl.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/namespaces/dev.localdb.namespaces.cli-command.impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,qBAAqB,EAAuB,MAAM,gBAAgB,CAAC;AAK3G,iEAAiE;AACjE,UAAU,iBAAiB;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAGD,QAAA,MAAM,aAAa;mBACG,qBAAqB,QAAQ,iBAAiB,WAAW,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;CAmCtH,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
1
|
+
import { migrationRegistry } from "../../../core/migration-registry.js";
|
|
2
|
+
import { readCliFlag } from "../../inputs.js";
|
|
3
|
+
// Hoisted const: tsc rewriteRelativeImportExtensions does not rewrite `.ts` specifiers inside `export default <expr>` (TS 6.0.3).
|
|
4
|
+
const defaultExport = {
|
|
5
|
+
async execute(_args, opts, context) {
|
|
6
|
+
const runtime = context.runtime;
|
|
7
|
+
const ui = await runtime.context('cli/ui');
|
|
8
|
+
const localdb = await runtime.context('dev/localdb');
|
|
9
|
+
const verbose = readCliFlag(opts, 'verbose');
|
|
8
10
|
ui.log('\n=== Registered Migration Namespaces ===\n');
|
|
9
|
-
const namespaces = localdb.listNamespaces();
|
|
11
|
+
const namespaces = localdb.listNamespaces(runtime);
|
|
10
12
|
if (namespaces.length === 0) {
|
|
11
13
|
ui.info('No migration namespaces registered.');
|
|
12
14
|
ui.info('Namespaces are registered when their modules are loaded.');
|
|
@@ -18,10 +20,9 @@ export default {
|
|
|
18
20
|
ui.info('\nUse --verbose to see migration details\n');
|
|
19
21
|
return;
|
|
20
22
|
}
|
|
21
|
-
const { migrationRegistry } = (await import('../../../core/migration-registry.js'));
|
|
22
23
|
for (const ns of namespaces) {
|
|
23
24
|
ui.log(`\nNamespace: ${ns}`);
|
|
24
|
-
const migrations = migrationRegistry.getMigrations(ns);
|
|
25
|
+
const migrations = migrationRegistry.getMigrations(runtime, ns);
|
|
25
26
|
ui.log(`Migrations: ${migrations.length}`);
|
|
26
27
|
for (const m of migrations) {
|
|
27
28
|
ui.log(` • v${m.version}: ${m.name}${m.down ? ' (reversible)' : ''}`);
|
|
@@ -30,4 +31,5 @@ export default {
|
|
|
30
31
|
ui.log('\n');
|
|
31
32
|
}
|
|
32
33
|
};
|
|
34
|
+
export default defaultExport;
|
|
33
35
|
//# sourceMappingURL=dev.localdb.namespaces.cli-command.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.localdb.namespaces.cli-command.impl.js","sourceRoot":"","sources":["../../../../src/cli/commands/namespaces/dev.localdb.namespaces.cli-command.impl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.localdb.namespaces.cli-command.impl.js","sourceRoot":"","sources":["../../../../src/cli/commands/namespaces/dev.localdb.namespaces.cli-command.impl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO9C,kIAAkI;AAClI,MAAM,aAAa,GAAG;IACrB,KAAK,CAAC,OAAO,CAAC,KAA4B,EAAE,IAAuB,EAAE,OAAiC;QACrG,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAChC,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,OAAO,CAAsB,QAAQ,CAAC,CAAC;QAChE,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,OAAO,CAAa,aAAa,CAAC,CAAC;QAEjE,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAE7C,EAAE,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAC;QAEtD,MAAM,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,EAAE,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;YAC/C,EAAE,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;YACpE,EAAE,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;YAC/D,OAAO;QACR,CAAC;QAED,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;YACtD,EAAE,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;YACtD,OAAO;QACR,CAAC;QAED,KAAK,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;YAC7B,EAAE,CAAC,GAAG,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;YAC7B,MAAM,UAAU,GAAG,iBAAiB,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YAChE,EAAE,CAAC,GAAG,CAAC,eAAe,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;YAE3C,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;gBAC5B,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACxE,CAAC;QACF,CAAC;QAED,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;CACD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.localdb.pools.cli-command.descriptor.js","sourceRoot":"","sources":["../../../../src/cli/commands/pools/dev.localdb.pools.cli-command.descriptor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"dev.localdb.pools.cli-command.descriptor.js","sourceRoot":"","sources":["../../../../src/cli/commands/pools/dev.localdb.pools.cli-command.descriptor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,eAAe,kBAAkB,CAAC;IACjC,EAAE,EAAE,mBAAmB;IACvB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,iCAAiC;IAC9C,KAAK,EAAE,aAAa;IACpB,QAAQ,EAAE,CAAC,KAAK,CAAC;IACjB,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { LocalDbCliCommandContext, LocalDbCliNoArguments } from '../../types.ts';
|
|
2
|
+
/** `vibes dev localdb pools` declares no options. */
|
|
3
|
+
type PoolsOptions = Readonly<Record<string, never>>;
|
|
4
|
+
declare const defaultExport: {
|
|
5
|
+
execute(_args: LocalDbCliNoArguments, _opts: PoolsOptions, context: LocalDbCliCommandContext): Promise<void>;
|
|
3
6
|
};
|
|
4
|
-
export default
|
|
7
|
+
export default defaultExport;
|
|
5
8
|
//# sourceMappingURL=dev.localdb.pools.cli-command.impl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.localdb.pools.cli-command.impl.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/pools/dev.localdb.pools.cli-command.impl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.localdb.pools.cli-command.impl.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/pools/dev.localdb.pools.cli-command.impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,qBAAqB,EAAuB,MAAM,gBAAgB,CAAC;AAI3G,qDAAqD;AACrD,KAAK,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;AAGpD,QAAA,MAAM,aAAa;mBACG,qBAAqB,SAAS,YAAY,WAAW,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;CA8BlH,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
async execute(_args, _opts) {
|
|
5
|
-
const runtime =
|
|
6
|
-
const ui =
|
|
7
|
-
const localdb =
|
|
1
|
+
import { formatAgeMs } from "../_shared.consumer.js";
|
|
2
|
+
// Hoisted const: tsc rewriteRelativeImportExtensions does not rewrite `.ts` specifiers inside `export default <expr>` (TS 6.0.3).
|
|
3
|
+
const defaultExport = {
|
|
4
|
+
async execute(_args, _opts, context) {
|
|
5
|
+
const runtime = context.runtime;
|
|
6
|
+
const ui = await runtime.context('cli/ui');
|
|
7
|
+
const localdb = await runtime.context('dev/localdb');
|
|
8
8
|
ui.log('\n=== Connection Pool Statistics ===\n');
|
|
9
9
|
const stats = localdb.getPoolStats();
|
|
10
10
|
ui.log(`Total Connections: ${stats.total}`);
|
|
@@ -25,4 +25,5 @@ export default {
|
|
|
25
25
|
ui.log('');
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
+
export default defaultExport;
|
|
28
29
|
//# sourceMappingURL=dev.localdb.pools.cli-command.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.localdb.pools.cli-command.impl.js","sourceRoot":"","sources":["../../../../src/cli/commands/pools/dev.localdb.pools.cli-command.impl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.localdb.pools.cli-command.impl.js","sourceRoot":"","sources":["../../../../src/cli/commands/pools/dev.localdb.pools.cli-command.impl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAKrD,kIAAkI;AAClI,MAAM,aAAa,GAAG;IACrB,KAAK,CAAC,OAAO,CAAC,KAA4B,EAAE,KAAmB,EAAE,OAAiC;QACjG,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAChC,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,OAAO,CAAsB,QAAQ,CAAC,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cli/commands/query/dev.localdb.query.cli-command.descriptor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"dev.localdb.query.cli-command.descriptor.js","sourceRoot":"","sources":["../../../../src/cli/commands/query/dev.localdb.query.cli-command.descriptor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,eAAe,kBAAkB,CAAC;IACjC,EAAE,EAAE,mBAAmB;IACvB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,oCAAoC;IACjD,KAAK,EAAE,aAAa;IACpB,QAAQ,EAAE,CAAC,KAAK,CAAC;IACjB,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,0BAA0B,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACrF,OAAO,EAAE;QACR,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,+BAA+B,EAAE;QACtE,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE;KAC1D;CACD,CAAC,CAAC"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { LocalDbCliCommandContext } from '../../types.ts';
|
|
2
|
+
/** The positional argument the CLI parses from this command's descriptor (required). */
|
|
3
|
+
interface QueryArguments {
|
|
4
|
+
sql: string;
|
|
5
|
+
}
|
|
6
|
+
/** The options the CLI parses from this command's descriptor. */
|
|
7
|
+
interface QueryOptions {
|
|
8
|
+
db?: string;
|
|
9
|
+
json?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const defaultExport: {
|
|
12
|
+
execute(args: QueryArguments, opts: QueryOptions, context: LocalDbCliCommandContext): Promise<void>;
|
|
3
13
|
};
|
|
4
|
-
export default
|
|
14
|
+
export default defaultExport;
|
|
5
15
|
//# sourceMappingURL=dev.localdb.query.cli-command.impl.consumer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.localdb.query.cli-command.impl.consumer.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/query/dev.localdb.query.cli-command.impl.consumer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.localdb.query.cli-command.impl.consumer.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/query/dev.localdb.query.cli-command.impl.consumer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEX,wBAAwB,EAGxB,MAAM,gBAAgB,CAAC;AAKxB,wFAAwF;AACxF,UAAU,cAAc;IACvB,GAAG,EAAE,MAAM,CAAC;CACZ;AAED,iEAAiE;AACjE,UAAU,YAAY;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,OAAO,CAAC;CACf;AA2CD,QAAA,MAAM,aAAa;kBACE,cAAc,QAAQ,YAAY,WAAW,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;CA2CzG,CAAC;AAEF,eAAe,aAAa,CAAC"}
|