@vibesdotdev/localdb 0.0.1
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 +121 -0
- package/SPEC.md +119 -0
- package/dist/cli/commands/_shared.consumer.d.ts +5 -0
- package/dist/cli/commands/_shared.consumer.d.ts.map +1 -0
- package/dist/cli/commands/_shared.consumer.js +17 -0
- package/dist/cli/commands/_shared.consumer.js.map +1 -0
- package/dist/cli/commands/migrate/dev.localdb.migrate.cli-command.descriptor.d.ts +19 -0
- package/dist/cli/commands/migrate/dev.localdb.migrate.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/commands/migrate/dev.localdb.migrate.cli-command.descriptor.js +19 -0
- package/dist/cli/commands/migrate/dev.localdb.migrate.cli-command.descriptor.js.map +1 -0
- package/dist/cli/commands/migrate/dev.localdb.migrate.cli-command.impl.consumer.d.ts +5 -0
- package/dist/cli/commands/migrate/dev.localdb.migrate.cli-command.impl.consumer.d.ts.map +1 -0
- package/dist/cli/commands/migrate/dev.localdb.migrate.cli-command.impl.consumer.js +80 -0
- package/dist/cli/commands/migrate/dev.localdb.migrate.cli-command.impl.consumer.js.map +1 -0
- package/dist/cli/commands/namespaces/dev.localdb.namespaces.cli-command.descriptor.d.ts +19 -0
- package/dist/cli/commands/namespaces/dev.localdb.namespaces.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/commands/namespaces/dev.localdb.namespaces.cli-command.descriptor.js +16 -0
- package/dist/cli/commands/namespaces/dev.localdb.namespaces.cli-command.descriptor.js.map +1 -0
- package/dist/cli/commands/namespaces/dev.localdb.namespaces.cli-command.impl.d.ts +5 -0
- package/dist/cli/commands/namespaces/dev.localdb.namespaces.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/commands/namespaces/dev.localdb.namespaces.cli-command.impl.js +33 -0
- package/dist/cli/commands/namespaces/dev.localdb.namespaces.cli-command.impl.js.map +1 -0
- package/dist/cli/commands/pools/dev.localdb.pools.cli-command.descriptor.d.ts +15 -0
- package/dist/cli/commands/pools/dev.localdb.pools.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/commands/pools/dev.localdb.pools.cli-command.descriptor.js +15 -0
- package/dist/cli/commands/pools/dev.localdb.pools.cli-command.descriptor.js.map +1 -0
- package/dist/cli/commands/pools/dev.localdb.pools.cli-command.impl.d.ts +5 -0
- package/dist/cli/commands/pools/dev.localdb.pools.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/commands/pools/dev.localdb.pools.cli-command.impl.js +28 -0
- package/dist/cli/commands/pools/dev.localdb.pools.cli-command.impl.js.map +1 -0
- package/dist/cli/commands/query/dev.localdb.query.cli-command.descriptor.d.ts +24 -0
- package/dist/cli/commands/query/dev.localdb.query.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/commands/query/dev.localdb.query.cli-command.descriptor.js +20 -0
- package/dist/cli/commands/query/dev.localdb.query.cli-command.descriptor.js.map +1 -0
- package/dist/cli/commands/query/dev.localdb.query.cli-command.impl.consumer.d.ts +5 -0
- package/dist/cli/commands/query/dev.localdb.query.cli-command.impl.consumer.d.ts.map +1 -0
- package/dist/cli/commands/query/dev.localdb.query.cli-command.impl.consumer.js +63 -0
- package/dist/cli/commands/query/dev.localdb.query.cli-command.impl.consumer.js.map +1 -0
- package/dist/cli/commands/status/dev.localdb.status.cli-command.descriptor.d.ts +19 -0
- package/dist/cli/commands/status/dev.localdb.status.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/commands/status/dev.localdb.status.cli-command.descriptor.js +19 -0
- package/dist/cli/commands/status/dev.localdb.status.cli-command.descriptor.js.map +1 -0
- package/dist/cli/commands/status/dev.localdb.status.cli-command.impl.consumer.d.ts +5 -0
- package/dist/cli/commands/status/dev.localdb.status.cli-command.impl.consumer.d.ts.map +1 -0
- package/dist/cli/commands/status/dev.localdb.status.cli-command.impl.consumer.js +73 -0
- package/dist/cli/commands/status/dev.localdb.status.cli-command.impl.consumer.js.map +1 -0
- package/dist/core/connection-pool.d.ts +84 -0
- package/dist/core/connection-pool.d.ts.map +1 -0
- package/dist/core/connection-pool.js +191 -0
- package/dist/core/connection-pool.js.map +1 -0
- package/dist/core/database.d.ts +137 -0
- package/dist/core/database.d.ts.map +1 -0
- package/dist/core/database.js +347 -0
- package/dist/core/database.js.map +1 -0
- package/dist/core/error-context.d.ts +2 -0
- package/dist/core/error-context.d.ts.map +1 -0
- package/dist/core/error-context.js +17 -0
- package/dist/core/error-context.js.map +1 -0
- package/dist/core/migration-registry.d.ts +89 -0
- package/dist/core/migration-registry.d.ts.map +1 -0
- package/dist/core/migration-registry.js +226 -0
- package/dist/core/migration-registry.js.map +1 -0
- package/dist/core/runtime.d.ts +3 -0
- package/dist/core/runtime.d.ts.map +1 -0
- package/dist/core/runtime.js +17 -0
- package/dist/core/runtime.js.map +1 -0
- package/dist/dev.localdb.cli-group.descriptor.d.ts +9 -0
- package/dist/dev.localdb.cli-group.descriptor.d.ts.map +1 -0
- package/dist/dev.localdb.cli-group.descriptor.js +17 -0
- package/dist/dev.localdb.cli-group.descriptor.js.map +1 -0
- package/dist/dev.localdb.context.descriptor.d.ts +21 -0
- package/dist/dev.localdb.context.descriptor.d.ts.map +1 -0
- package/dist/dev.localdb.context.descriptor.js +12 -0
- package/dist/dev.localdb.context.descriptor.js.map +1 -0
- package/dist/dev.localdb.context.impl.consumer.d.ts +9 -0
- package/dist/dev.localdb.context.impl.consumer.d.ts.map +1 -0
- package/dist/dev.localdb.context.impl.consumer.js +10 -0
- package/dist/dev.localdb.context.impl.consumer.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/localdb.cloud.plugin.d.ts +17 -0
- package/dist/localdb.cloud.plugin.d.ts.map +1 -0
- package/dist/localdb.cloud.plugin.js +23 -0
- package/dist/localdb.cloud.plugin.js.map +1 -0
- package/dist/localdb.plugin.d.ts +8 -0
- package/dist/localdb.plugin.d.ts.map +1 -0
- package/dist/localdb.plugin.js +38 -0
- package/dist/localdb.plugin.js.map +1 -0
- package/dist/migrations/load-sql.d.ts +45 -0
- package/dist/migrations/load-sql.d.ts.map +1 -0
- package/dist/migrations/load-sql.js +117 -0
- package/dist/migrations/load-sql.js.map +1 -0
- package/dist/schemas/api.d.ts +82 -0
- package/dist/schemas/api.d.ts.map +1 -0
- package/dist/schemas/api.js +2 -0
- package/dist/schemas/api.js.map +1 -0
- package/package.json +146 -0
- package/src/cli/commands/_shared.consumer.ts +20 -0
- package/src/cli/commands/migrate/dev.localdb.migrate.cli-command.descriptor.ts +20 -0
- package/src/cli/commands/migrate/dev.localdb.migrate.cli-command.impl.consumer.ts +97 -0
- package/src/cli/commands/namespaces/dev.localdb.namespaces.cli-command.descriptor.ts +17 -0
- package/src/cli/commands/namespaces/dev.localdb.namespaces.cli-command.impl.ts +46 -0
- package/src/cli/commands/pools/dev.localdb.pools.cli-command.descriptor.ts +16 -0
- package/src/cli/commands/pools/dev.localdb.pools.cli-command.impl.ts +37 -0
- package/src/cli/commands/query/dev.localdb.query.cli-command.descriptor.ts +21 -0
- package/src/cli/commands/query/dev.localdb.query.cli-command.impl.consumer.ts +69 -0
- package/src/cli/commands/status/dev.localdb.status.cli-command.descriptor.ts +20 -0
- package/src/cli/commands/status/dev.localdb.status.cli-command.impl.consumer.ts +93 -0
- package/src/core/connection-pool.ts +240 -0
- package/src/core/database.ts +419 -0
- package/src/core/error-context.ts +19 -0
- package/src/core/migration-registry.ts +321 -0
- package/src/core/runtime.ts +17 -0
- package/src/dev.localdb.cli-group.descriptor.ts +20 -0
- package/src/dev.localdb.context.descriptor.ts +13 -0
- package/src/dev.localdb.context.impl.consumer.ts +12 -0
- package/src/index.ts +28 -0
- package/src/localdb.cloud.plugin.ts +24 -0
- package/src/localdb.plugin.ts +43 -0
- package/src/migrations/atlas/001-initial-schema.sql +173 -0
- package/src/migrations/atlas/002-lang-server-fields.sql +12 -0
- package/src/migrations/atlas/003-config-id-dedup.sql +31 -0
- package/src/migrations/atlas/004-fix-on-conflict-constraints.sql +25 -0
- package/src/migrations/atlas/005-diagnostics.sql +66 -0
- package/src/migrations/atlas/006-diagnostic-summaries.sql +65 -0
- package/src/migrations/atlas/007-diagnostic-slice.sql +83 -0
- package/src/migrations/load-sql.ts +133 -0
- package/src/schemas/api.ts +92 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration Registry
|
|
3
|
+
*
|
|
4
|
+
* Centralized registration and execution of database migrations.
|
|
5
|
+
* Consumers register their migrations with the registry, which ensures
|
|
6
|
+
* they run in order with proper error handling and version tracking.
|
|
7
|
+
*/
|
|
8
|
+
import { getLogger } from '@vibesdotdev/logging';
|
|
9
|
+
import { toErrorContext } from './error-context.js';
|
|
10
|
+
const logger = getLogger('localdb:migrations');
|
|
11
|
+
class MigrationRegistry {
|
|
12
|
+
namespaces = new Map();
|
|
13
|
+
hasVersionTable(db) {
|
|
14
|
+
const row = db
|
|
15
|
+
.query("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'vibes_schema_versions'")
|
|
16
|
+
.get();
|
|
17
|
+
return row?.name === 'vibes_schema_versions';
|
|
18
|
+
}
|
|
19
|
+
ensureVersionTable(db) {
|
|
20
|
+
if (this.hasVersionTable(db))
|
|
21
|
+
return;
|
|
22
|
+
db.exec(`
|
|
23
|
+
CREATE TABLE IF NOT EXISTS vibes_schema_versions (
|
|
24
|
+
namespace TEXT PRIMARY KEY,
|
|
25
|
+
version INTEGER NOT NULL DEFAULT 0,
|
|
26
|
+
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
27
|
+
)
|
|
28
|
+
`);
|
|
29
|
+
}
|
|
30
|
+
getLegacyUserVersion(db) {
|
|
31
|
+
let lastError;
|
|
32
|
+
const maxRetries = 3;
|
|
33
|
+
const baseDelay = 100;
|
|
34
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
35
|
+
try {
|
|
36
|
+
const result = db.query('PRAGMA user_version').get();
|
|
37
|
+
return result.user_version;
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
lastError = error;
|
|
41
|
+
if (error?.code === 'SQLITE_BUSY' && attempt < maxRetries - 1) {
|
|
42
|
+
const delay = baseDelay * Math.pow(2, attempt);
|
|
43
|
+
Bun.sleepSync(delay);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
throw lastError ?? new Error('All retries exhausted');
|
|
50
|
+
}
|
|
51
|
+
getTrackedSchemaVersion(db, namespace) {
|
|
52
|
+
this.ensureVersionTable(db);
|
|
53
|
+
const row = db
|
|
54
|
+
.query('SELECT version FROM vibes_schema_versions WHERE namespace = ?')
|
|
55
|
+
.get(namespace);
|
|
56
|
+
return row ? row.version : null;
|
|
57
|
+
}
|
|
58
|
+
bootstrapSchemaVersion(db, namespace) {
|
|
59
|
+
const tracked = this.getTrackedSchemaVersion(db, namespace);
|
|
60
|
+
if (tracked !== null)
|
|
61
|
+
return tracked;
|
|
62
|
+
const ns = this.namespaces.get(namespace);
|
|
63
|
+
if (!ns) {
|
|
64
|
+
throw new Error(`Unknown migration namespace: ${namespace}`);
|
|
65
|
+
}
|
|
66
|
+
const legacyVersion = this.getLegacyUserVersion(db);
|
|
67
|
+
const trackedNamespaceCount = db.query('SELECT COUNT(*) as count FROM vibes_schema_versions').get()
|
|
68
|
+
?.count ?? 0;
|
|
69
|
+
const bootstrapVersion = trackedNamespaceCount === 0 && legacyVersion > 0 && legacyVersion <= ns.currentVersion
|
|
70
|
+
? legacyVersion
|
|
71
|
+
: 0;
|
|
72
|
+
this.setSchemaVersion(db, namespace, bootstrapVersion);
|
|
73
|
+
return bootstrapVersion;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Register migrations for a namespace (e.g., 'atlas', 'session')
|
|
77
|
+
*/
|
|
78
|
+
register(namespace, migrations) {
|
|
79
|
+
if (this.namespaces.has(namespace)) {
|
|
80
|
+
throw new Error(`Migration namespace '${namespace}' is already registered`);
|
|
81
|
+
}
|
|
82
|
+
// Sort migrations by version
|
|
83
|
+
const sorted = [...migrations].sort((a, b) => a.version - b.version);
|
|
84
|
+
// Validate version sequence
|
|
85
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
86
|
+
const expected = i + 1;
|
|
87
|
+
const actual = sorted[i].version;
|
|
88
|
+
if (actual !== expected) {
|
|
89
|
+
throw new Error(`Invalid migration sequence in '${namespace}': expected version ${expected}, got ${actual}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const currentVersion = sorted.length > 0 ? sorted[sorted.length - 1].version : 0;
|
|
93
|
+
this.namespaces.set(namespace, {
|
|
94
|
+
namespace,
|
|
95
|
+
migrations: sorted,
|
|
96
|
+
currentVersion
|
|
97
|
+
});
|
|
98
|
+
logger.debug(`Registered ${migrations.length} migration(s) for namespace '${namespace}'`);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Get current schema version from database
|
|
102
|
+
*/
|
|
103
|
+
getSchemaVersion(db, namespace) {
|
|
104
|
+
return this.bootstrapSchemaVersion(db, namespace);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Set schema version in database
|
|
108
|
+
*/
|
|
109
|
+
setSchemaVersion(db, namespace, version) {
|
|
110
|
+
this.ensureVersionTable(db);
|
|
111
|
+
db.query(`INSERT INTO vibes_schema_versions (namespace, version, updated_at)
|
|
112
|
+
VALUES (?, ?, datetime('now'))
|
|
113
|
+
ON CONFLICT(namespace) DO UPDATE SET
|
|
114
|
+
version = excluded.version,
|
|
115
|
+
updated_at = datetime('now')`).run(namespace, version);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Check if database needs migration
|
|
119
|
+
*/
|
|
120
|
+
needsMigration(db, namespace) {
|
|
121
|
+
const ns = this.namespaces.get(namespace);
|
|
122
|
+
if (!ns) {
|
|
123
|
+
throw new Error(`Unknown migration namespace: ${namespace}`);
|
|
124
|
+
}
|
|
125
|
+
const currentVersion = this.getSchemaVersion(db, namespace);
|
|
126
|
+
return currentVersion < ns.currentVersion;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Check if database is from an incompatible/old migration system
|
|
130
|
+
* This happens when the version is higher than our max (legacy system)
|
|
131
|
+
*/
|
|
132
|
+
isIncompatibleDatabase(db, namespace) {
|
|
133
|
+
const ns = this.namespaces.get(namespace);
|
|
134
|
+
if (!ns) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
const trackedVersion = this.getTrackedSchemaVersion(db, namespace);
|
|
138
|
+
if (trackedVersion === null) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
return trackedVersion > ns.currentVersion;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Run all pending migrations for a namespace
|
|
145
|
+
*/
|
|
146
|
+
async runMigrations(db, namespace) {
|
|
147
|
+
const ns = this.namespaces.get(namespace);
|
|
148
|
+
if (!ns) {
|
|
149
|
+
throw new Error(`Unknown migration namespace: ${namespace}`);
|
|
150
|
+
}
|
|
151
|
+
let currentVersion = this.getSchemaVersion(db, namespace);
|
|
152
|
+
logger.debug(`Running migrations for '${namespace}' (v${currentVersion} → v${ns.currentVersion})`);
|
|
153
|
+
for (const migration of ns.migrations) {
|
|
154
|
+
if (migration.version > currentVersion) {
|
|
155
|
+
logger.debug(`Applying migration ${migration.version}: ${migration.name}`);
|
|
156
|
+
try {
|
|
157
|
+
await migration.up(db);
|
|
158
|
+
currentVersion = migration.version;
|
|
159
|
+
this.setSchemaVersion(db, namespace, currentVersion);
|
|
160
|
+
logger.debug(`[LocalDB] Migration ${migration.version} completed`);
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
logger.error(`[LocalDB] Migration ${migration.version} failed:`, toErrorContext(error));
|
|
164
|
+
throw new Error(`Migration ${migration.version} (${migration.name}) failed: ${error}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
logger.debug(`[LocalDB] All migrations completed for '${namespace}'`);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Get migration status for all namespaces
|
|
172
|
+
*/
|
|
173
|
+
getStatus() {
|
|
174
|
+
const status = [];
|
|
175
|
+
for (const ns of this.namespaces.values()) {
|
|
176
|
+
status.push({
|
|
177
|
+
namespace: ns.namespace,
|
|
178
|
+
currentVersion: 0, // Will be determined per-database
|
|
179
|
+
targetVersion: ns.currentVersion,
|
|
180
|
+
pendingMigrations: 0 // Will be determined per-database
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
return status;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Get migration status for a specific database and namespace
|
|
187
|
+
*/
|
|
188
|
+
getDatabaseStatus(db, namespace) {
|
|
189
|
+
const ns = this.namespaces.get(namespace);
|
|
190
|
+
if (!ns) {
|
|
191
|
+
throw new Error(`Unknown migration namespace: ${namespace}`);
|
|
192
|
+
}
|
|
193
|
+
const currentVersion = this.getSchemaVersion(db, namespace);
|
|
194
|
+
const pending = Math.max(0, ns.currentVersion - currentVersion);
|
|
195
|
+
return {
|
|
196
|
+
namespace,
|
|
197
|
+
currentVersion,
|
|
198
|
+
targetVersion: ns.currentVersion,
|
|
199
|
+
pendingMigrations: pending,
|
|
200
|
+
migrations: ns.migrations.map((m) => ({
|
|
201
|
+
version: m.version,
|
|
202
|
+
name: m.name,
|
|
203
|
+
applied: m.version <= currentVersion
|
|
204
|
+
}))
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* List all registered namespaces
|
|
209
|
+
*/
|
|
210
|
+
listNamespaces() {
|
|
211
|
+
return Array.from(this.namespaces.keys());
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Get migrations for a namespace
|
|
215
|
+
*/
|
|
216
|
+
getMigrations(namespace) {
|
|
217
|
+
const ns = this.namespaces.get(namespace);
|
|
218
|
+
if (!ns) {
|
|
219
|
+
throw new Error(`Unknown migration namespace: ${namespace}`);
|
|
220
|
+
}
|
|
221
|
+
return [...ns.migrations];
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
// Singleton instance
|
|
225
|
+
export const migrationRegistry = new MigrationRegistry();
|
|
226
|
+
//# sourceMappingURL=migration-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-registry.js","sourceRoot":"","sources":["../../src/core/migration-registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,MAAM,GAAG,SAAS,CAAC,oBAAoB,CAAC,CAAC;AAmB/C,MAAM,iBAAiB;IACd,UAAU,GAAG,IAAI,GAAG,EAA8B,CAAC;IAEnD,eAAe,CAAC,EAAY;QACnC,MAAM,GAAG,GAAG,EAAE;aACZ,KAAK,CAGJ,wFAAwF,CAAC;aAC1F,GAAG,EAAE,CAAC;QACR,OAAO,GAAG,EAAE,IAAI,KAAK,uBAAuB,CAAC;IAC9C,CAAC;IAEO,kBAAkB,CAAC,EAAY;QACtC,IAAI,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;YAAE,OAAO;QAErC,EAAE,CAAC,IAAI,CAAC;;;;;;GAMP,CAAC,CAAC;IACJ,CAAC;IAEO,oBAAoB,CAAC,EAAY;QACxC,IAAI,SAA4B,CAAC;QACjC,MAAM,UAAU,GAAG,CAAC,CAAC;QACrB,MAAM,SAAS,GAAG,GAAG,CAAC;QAEtB,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC;YACvD,IAAI,CAAC;gBACJ,MAAM,MAAM,GAAG,EAAE,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,GAAG,EAA8B,CAAC;g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AAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACrC,OAAO,EAAE,CAAC,CAAC,OAAO;gBAClB,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,cAAc;aACpC,CAAC,CAAC;SACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,cAAc;QACb,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,SAAiB;QAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,CAAC,EAAE,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,gCAAgC,SAAS,EAAE,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;IAC3B,CAAC;CACD;AAED,qBAAqB;AACrB,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev LocalDB CLI Group Descriptor
|
|
3
|
+
*
|
|
4
|
+
* Groups LocalDB development commands under `vibes dev localdb`.
|
|
5
|
+
*/
|
|
6
|
+
import type { CLIGroupAssetDescriptor } from '@vibesdotdev/cli/schemas/types';
|
|
7
|
+
declare const descriptor: CLIGroupAssetDescriptor;
|
|
8
|
+
export default descriptor;
|
|
9
|
+
//# sourceMappingURL=dev.localdb.cli-group.descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.localdb.cli-group.descriptor.d.ts","sourceRoot":"","sources":["../src/dev.localdb.cli-group.descriptor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAE9E,QAAA,MAAM,UAAU,EAAE,uBASjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev LocalDB CLI Group Descriptor
|
|
3
|
+
*
|
|
4
|
+
* Groups LocalDB development commands under `vibes dev localdb`.
|
|
5
|
+
*/
|
|
6
|
+
const descriptor = {
|
|
7
|
+
kind: 'cli/group',
|
|
8
|
+
id: 'dev.localdb',
|
|
9
|
+
name: 'localdb',
|
|
10
|
+
description: 'Manage local SQLite databases (migrations, connections, status)',
|
|
11
|
+
parent: 'dev',
|
|
12
|
+
surfaces: ['cli'],
|
|
13
|
+
hardware: ['consumer'],
|
|
14
|
+
enabled: true
|
|
15
|
+
};
|
|
16
|
+
export default descriptor;
|
|
17
|
+
//# sourceMappingURL=dev.localdb.cli-group.descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.localdb.cli-group.descriptor.js","sourceRoot":"","sources":["../src/dev.localdb.cli-group.descriptor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,UAAU,GAA4B;IAC3C,IAAI,EAAE,WAAW;IACjB,EAAE,EAAE,aAAa;IACjB,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,iEAAiE;IAC9E,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,CAAC,KAAK,CAAC;IACjB,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,OAAO,EAAE,IAAI;CACb,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev LocalDB Context Descriptor
|
|
3
|
+
*
|
|
4
|
+
* Provides LocalDB API for dev commands and workflows.
|
|
5
|
+
*/
|
|
6
|
+
declare const _default: {
|
|
7
|
+
id: string;
|
|
8
|
+
kind: "context";
|
|
9
|
+
name?: string | undefined;
|
|
10
|
+
description?: string | undefined;
|
|
11
|
+
tags?: string[] | undefined;
|
|
12
|
+
hardware?: string[] | undefined;
|
|
13
|
+
enabled?: boolean | undefined;
|
|
14
|
+
priority?: number | undefined;
|
|
15
|
+
requiredContext?: string[] | undefined;
|
|
16
|
+
optionalContext?: string[] | undefined;
|
|
17
|
+
config?: Record<string, unknown> | undefined;
|
|
18
|
+
valueSchema?: unknown;
|
|
19
|
+
};
|
|
20
|
+
export default _default;
|
|
21
|
+
//# sourceMappingURL=dev.localdb.context.descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.localdb.context.descriptor.d.ts","sourceRoot":"","sources":["../src/dev.localdb.context.descriptor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;;;;;;;;;;;;;AAIH,wBAIG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev LocalDB Context Descriptor
|
|
3
|
+
*
|
|
4
|
+
* Provides LocalDB API for dev commands and workflows.
|
|
5
|
+
*/
|
|
6
|
+
import { createContextDescriptor } from '@vibesdotdev/runtime';
|
|
7
|
+
export default createContextDescriptor({
|
|
8
|
+
id: 'dev/localdb',
|
|
9
|
+
description: 'LocalDB API for managing local SQLite databases.',
|
|
10
|
+
hardware: ['consumer']
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=dev.localdb.context.descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.localdb.context.descriptor.js","sourceRoot":"","sources":["../src/dev.localdb.context.descriptor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,eAAe,uBAAuB,CAAC;IACtC,EAAE,EAAE,aAAa;IACjB,WAAW,EAAE,kDAAkD;IAC/D,QAAQ,EAAE,CAAC,UAAU,CAAC;CACtB,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev LocalDB Context Implementation (Consumer)
|
|
3
|
+
*/
|
|
4
|
+
import type { LocaldbApi } from './schemas/api';
|
|
5
|
+
declare const _default: {
|
|
6
|
+
provide: () => Promise<LocaldbApi>;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
9
|
+
//# sourceMappingURL=dev.localdb.context.impl.consumer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.localdb.context.impl.consumer.d.ts","sourceRoot":"","sources":["../src/dev.localdb.context.impl.consumer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;;mBAG5B,OAAO,CAAC,UAAU,CAAC;;AADvC,wBAKE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.localdb.context.impl.consumer.js","sourceRoot":"","sources":["../src/dev.localdb.context.impl.consumer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,eAAe;IACd,OAAO,EAAE,KAAK,IAAyB,EAAE;QACxC,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;QAC5C,OAAO,OAAO,CAAC;IAChB,CAAC;CACD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local Database (LocalDB)
|
|
3
|
+
*
|
|
4
|
+
* Unified SQLite database management for vibes dev toolkit.
|
|
5
|
+
* Provides connection pooling, migration management, and consistent configuration.
|
|
6
|
+
*/
|
|
7
|
+
export type { LocaldbApi, LocaldbRawDatabase, LocalDatabase as LocalDatabaseInterface, Migration, MigrationFunction, ConnectionStats, ConnectionPoolApi, MigrationRegistryApi } from './schemas/api';
|
|
8
|
+
export { LocalDatabase, localdb } from './core/database';
|
|
9
|
+
export { connectionPool } from './core/connection-pool';
|
|
10
|
+
export { migrationRegistry } from './core/migration-registry';
|
|
11
|
+
export { loadMigrationSQL, loadMigrationSQLSync, listMigrationFiles, parseVersionFromFilename, parseMigrationName } from './migrations/load-sql';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EACX,UAAU,EACV,kBAAkB,EAClB,aAAa,IAAI,sBAAsB,EACvC,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EACN,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EAClB,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local Database (LocalDB)
|
|
3
|
+
*
|
|
4
|
+
* Unified SQLite database management for vibes dev toolkit.
|
|
5
|
+
* Provides connection pooling, migration management, and consistent configuration.
|
|
6
|
+
*/
|
|
7
|
+
export { LocalDatabase, localdb } from './core/database.js';
|
|
8
|
+
export { connectionPool } from './core/connection-pool.js';
|
|
9
|
+
export { migrationRegistry } from './core/migration-registry.js';
|
|
10
|
+
export { loadMigrationSQL, loadMigrationSQLSync, listMigrationFiles, parseVersionFromFilename, parseMigrationName } from './migrations/load-sql.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EACN,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EAClB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localdb.cloud.plugin.d.ts","sourceRoot":"","sources":["../src/localdb.cloud.plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;;AAIH,wBAMG"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localdb.plugin.d.ts","sourceRoot":"","sources":["../src/localdb.plugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAeH,wBAuBG"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LocalDB Plugin
|
|
3
|
+
*
|
|
4
|
+
* Local SQLite database management — migrations, connections, status.
|
|
5
|
+
*/
|
|
6
|
+
import { createRuntimePlugin, loader } from '@vibesdotdev/runtime';
|
|
7
|
+
// CLI
|
|
8
|
+
import localdbGroup from "./dev.localdb.cli-group.descriptor.js";
|
|
9
|
+
import localdbMigrate from "./cli/commands/migrate/dev.localdb.migrate.cli-command.descriptor.js";
|
|
10
|
+
import localdbNamespaces from "./cli/commands/namespaces/dev.localdb.namespaces.cli-command.descriptor.js";
|
|
11
|
+
import localdbPools from "./cli/commands/pools/dev.localdb.pools.cli-command.descriptor.js";
|
|
12
|
+
import localdbQuery from "./cli/commands/query/dev.localdb.query.cli-command.descriptor.js";
|
|
13
|
+
import localdbStatus from "./cli/commands/status/dev.localdb.status.cli-command.descriptor.js";
|
|
14
|
+
// Context
|
|
15
|
+
import localdbContextDescriptor from "./dev.localdb.context.descriptor.js";
|
|
16
|
+
export default createRuntimePlugin({
|
|
17
|
+
id: 'localdb',
|
|
18
|
+
name: 'LocalDB',
|
|
19
|
+
description: 'Local SQLite database management — migrations, connections, status',
|
|
20
|
+
descriptors: [
|
|
21
|
+
localdbGroup,
|
|
22
|
+
localdbMigrate,
|
|
23
|
+
localdbNamespaces,
|
|
24
|
+
localdbPools,
|
|
25
|
+
localdbQuery,
|
|
26
|
+
localdbStatus,
|
|
27
|
+
localdbContextDescriptor
|
|
28
|
+
],
|
|
29
|
+
loaders: [
|
|
30
|
+
loader('dev.localdb.migrate', 'consumer', () => import('./cli/commands/migrate/dev.localdb.migrate.cli-command.impl.consumer.js')),
|
|
31
|
+
loader('dev.localdb.namespaces', () => import('./cli/commands/namespaces/dev.localdb.namespaces.cli-command.impl.js')),
|
|
32
|
+
loader('dev.localdb.pools', () => import('./cli/commands/pools/dev.localdb.pools.cli-command.impl.js')),
|
|
33
|
+
loader('dev.localdb.query', 'consumer', () => import('./cli/commands/query/dev.localdb.query.cli-command.impl.consumer.js')),
|
|
34
|
+
loader('dev.localdb.status', 'consumer', () => import('./cli/commands/status/dev.localdb.status.cli-command.impl.consumer.js')),
|
|
35
|
+
loader('dev/localdb', 'consumer', () => import('./dev.localdb.context.impl.consumer.js'))
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=localdb.plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localdb.plugin.js","sourceRoot":"","sources":["../src/localdb.plugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnE,MAAM;AACN,OAAO,YAAY,MAAM,uCAAuC,CAAC;AACjE,OAAO,cAAc,MAAM,sEAAsE,CAAC;AAClG,OAAO,iBAAiB,MAAM,4EAA4E,CAAC;AAC3G,OAAO,YAAY,MAAM,kEAAkE,CAAC;AAC5F,OAAO,YAAY,MAAM,kEAAkE,CAAC;AAC5F,OAAO,aAAa,MAAM,oEAAoE,CAAC;AAE/F,UAAU;AACV,OAAO,wBAAwB,MAAM,qCAAqC,CAAC;AAE3E,eAAe,mBAAmB,CAAC;IAClC,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,oEAAoE;IAEjF,WAAW,EAAE;QACZ,YAAY;QACZ,cAAc;QACd,iBAAiB;QACjB,YAAY;QACZ,YAAY;QACZ,aAAa;QACb,wBAAwB;KACxB;IAED,OAAO,EAAE;QACR,MAAM,CAAC,qBAAqB,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,yEAAyE,CAAC,CAAC;QAClI,MAAM,CAAC,wBAAwB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,sEAAsE,CAAC,CAAC;QACtH,MAAM,CAAC,mBAAmB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,4DAA4D,CAAC,CAAC;QACvG,MAAM,CAAC,mBAAmB,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,qEAAqE,CAAC,CAAC;QAC5H,MAAM,CAAC,oBAAoB,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,uEAAuE,CAAC,CAAC;QAC/H,MAAM,CAAC,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,wCAAwC,CAAC,CAAC;KACzF;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQL Migration Loader
|
|
3
|
+
*
|
|
4
|
+
* Utility for loading SQL migration files from the filesystem.
|
|
5
|
+
* Uses Bun's file API for fast synchronous reads.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Load a SQL migration file by namespace and filename (async)
|
|
9
|
+
*
|
|
10
|
+
* @param namespace - The migration namespace (atlas, session, external)
|
|
11
|
+
* @param filename - The SQL filename (e.g., '001-initial-schema.sql')
|
|
12
|
+
* @returns Promise resolving to the SQL content as a string
|
|
13
|
+
*/
|
|
14
|
+
export declare function loadMigrationSQL(namespace: string, filename: string): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Synchronously load a SQL migration file
|
|
17
|
+
* Uses Node's fs.readFileSync for truly synchronous reads
|
|
18
|
+
*
|
|
19
|
+
* @param namespace - The migration namespace (atlas, session, external)
|
|
20
|
+
* @param filename - The SQL filename (e.g., '001-initial-schema.sql')
|
|
21
|
+
* @returns The SQL content as a string
|
|
22
|
+
*/
|
|
23
|
+
export declare function loadMigrationSQLSync(namespace: string, filename: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* List all SQL files in a namespace directory
|
|
26
|
+
*
|
|
27
|
+
* @param namespace - The migration namespace (atlas, session, external)
|
|
28
|
+
* @returns Array of SQL filenames sorted by version number
|
|
29
|
+
*/
|
|
30
|
+
export declare function listMigrationFiles(namespace: string): string[];
|
|
31
|
+
/**
|
|
32
|
+
* Parse version number from a migration filename
|
|
33
|
+
*
|
|
34
|
+
* @param filename - The SQL filename (e.g., '001-initial-schema.sql')
|
|
35
|
+
* @returns The version number
|
|
36
|
+
*/
|
|
37
|
+
export declare function parseVersionFromFilename(filename: string): number;
|
|
38
|
+
/**
|
|
39
|
+
* Parse migration name from a filename
|
|
40
|
+
*
|
|
41
|
+
* @param filename - The SQL filename (e.g., '001-initial-schema.sql')
|
|
42
|
+
* @returns The migration name (e.g., 'initial_schema')
|
|
43
|
+
*/
|
|
44
|
+
export declare function parseMigrationName(filename: string): string;
|
|
45
|
+
//# sourceMappingURL=load-sql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-sql.d.ts","sourceRoot":"","sources":["../../src/migrations/load-sql.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgBH;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAarF;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAahF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAgB9D;AAkBD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMjE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM3D"}
|