@c9up/atlas 0.1.19 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -14
- package/db.darwin-arm64.node +0 -0
- package/db.darwin-x64.node +0 -0
- package/db.linux-arm64-gnu.node +0 -0
- package/db.linux-x64-gnu.node +0 -0
- package/db.win32-x64-msvc.node +0 -0
- package/dist/AtlasProvider.d.ts +6 -0
- package/dist/AtlasProvider.d.ts.map +1 -1
- package/dist/AtlasProvider.js +2 -2
- package/dist/AtlasProvider.js.map +1 -1
- package/dist/BaseEntity.d.ts +164 -5
- package/dist/BaseEntity.d.ts.map +1 -1
- package/dist/BaseEntity.js +339 -33
- package/dist/BaseEntity.js.map +1 -1
- package/dist/BaseModel.d.ts +91 -0
- package/dist/BaseModel.d.ts.map +1 -0
- package/dist/BaseModel.js +193 -0
- package/dist/BaseModel.js.map +1 -0
- package/dist/BaseRepository.d.ts +71 -15
- package/dist/BaseRepository.d.ts.map +1 -1
- package/dist/BaseRepository.js +1355 -384
- package/dist/BaseRepository.js.map +1 -1
- package/dist/ModelQuery.d.ts +341 -18
- package/dist/ModelQuery.d.ts.map +1 -1
- package/dist/ModelQuery.js +1406 -177
- package/dist/ModelQuery.js.map +1 -1
- package/dist/Transaction.d.ts +17 -0
- package/dist/Transaction.d.ts.map +1 -1
- package/dist/Transaction.js +57 -5
- package/dist/Transaction.js.map +1 -1
- package/dist/adapters/NapiDbAdapter.d.ts +33 -4
- package/dist/adapters/NapiDbAdapter.d.ts.map +1 -1
- package/dist/adapters/NapiDbAdapter.js +101 -11
- package/dist/adapters/NapiDbAdapter.js.map +1 -1
- package/dist/console/migrationCommands.d.ts +48 -0
- package/dist/console/migrationCommands.d.ts.map +1 -0
- package/dist/console/migrationCommands.js +220 -0
- package/dist/console/migrationCommands.js.map +1 -0
- package/dist/decorators/entity.d.ts +37 -6
- package/dist/decorators/entity.d.ts.map +1 -1
- package/dist/decorators/entity.js +32 -2
- package/dist/decorators/entity.js.map +1 -1
- package/dist/events.d.ts +64 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +82 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/metadata-keys.d.ts +3 -2
- package/dist/metadata-keys.d.ts.map +1 -1
- package/dist/naming/NamingStrategy.d.ts +7 -0
- package/dist/naming/NamingStrategy.d.ts.map +1 -1
- package/dist/naming/NamingStrategy.js +16 -0
- package/dist/naming/NamingStrategy.js.map +1 -1
- package/dist/schema/Migration.d.ts +26 -3
- package/dist/schema/Migration.d.ts.map +1 -1
- package/dist/schema/Migration.js +33 -24
- package/dist/schema/Migration.js.map +1 -1
- package/dist/schema/MigrationRunner.d.ts +43 -32
- package/dist/schema/MigrationRunner.d.ts.map +1 -1
- package/dist/schema/MigrationRunner.js +211 -26
- package/dist/schema/MigrationRunner.js.map +1 -1
- package/dist/schema/Schema.d.ts +57 -0
- package/dist/schema/Schema.d.ts.map +1 -1
- package/dist/schema/Schema.js +138 -3
- package/dist/schema/Schema.js.map +1 -1
- package/dist/schema/TableBuilder.d.ts +247 -8
- package/dist/schema/TableBuilder.d.ts.map +1 -1
- package/dist/schema/TableBuilder.js +607 -41
- package/dist/schema/TableBuilder.js.map +1 -1
- package/dist/schema/catalog.d.ts +47 -0
- package/dist/schema/catalog.d.ts.map +1 -0
- package/dist/schema/catalog.js +111 -0
- package/dist/schema/catalog.js.map +1 -0
- package/dist/schema/types.d.ts +150 -1
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/types.js +11 -0
- package/dist/schema/types.js.map +1 -1
- package/dist/services/db.d.ts +6 -0
- package/dist/services/db.d.ts.map +1 -1
- package/dist/services/db.js +17 -0
- package/dist/services/db.js.map +1 -1
- package/dist/testing/DatabaseCleanup.d.ts +7 -4
- package/dist/testing/DatabaseCleanup.d.ts.map +1 -1
- package/dist/testing/DatabaseCleanup.js +21 -18
- package/dist/testing/DatabaseCleanup.js.map +1 -1
- package/dist/testing/Factory.d.ts +70 -5
- package/dist/testing/Factory.d.ts.map +1 -1
- package/dist/testing/Factory.js +209 -10
- package/dist/testing/Factory.js.map +1 -1
- package/index.darwin-arm64.node +0 -0
- package/index.darwin-x64.node +0 -0
- package/index.linux-arm64-gnu.node +0 -0
- package/index.linux-x64-gnu.node +0 -0
- package/index.win32-x64-msvc.node +0 -0
- package/package.json +3 -1
- package/scripts/guard-publish.mjs +15 -0
- package/src/AtlasProvider.ts +8 -1
- package/src/BaseEntity.ts +431 -41
- package/src/BaseModel.ts +324 -0
- package/src/BaseRepository.ts +1589 -419
- package/src/ModelQuery.ts +1817 -203
- package/src/Transaction.ts +68 -5
- package/src/adapters/NapiDbAdapter.ts +159 -10
- package/src/console/migrationCommands.ts +258 -0
- package/src/decorators/entity.ts +53 -6
- package/src/events.ts +112 -0
- package/src/index.ts +19 -0
- package/src/metadata-keys.ts +3 -2
- package/src/naming/NamingStrategy.ts +23 -0
- package/src/schema/Migration.ts +42 -3
- package/src/schema/MigrationRunner.ts +270 -27
- package/src/schema/Schema.ts +210 -3
- package/src/schema/TableBuilder.ts +735 -41
- package/src/schema/catalog.ts +166 -0
- package/src/schema/types.ts +137 -2
- package/src/services/db.ts +28 -0
- package/src/testing/DatabaseCleanup.ts +23 -22
- package/src/testing/Factory.ts +332 -15
|
@@ -1,8 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* NapiDbAdapter — bridges the Rust atlas-db NAPI binding to Atlas.
|
|
3
3
|
*/
|
|
4
|
+
import { emitDbQuery, hasDbQueryListeners } from "../events.js";
|
|
5
|
+
import { runAfterHooks, } from "../Transaction.js";
|
|
4
6
|
import { dialectFromUrl } from "../utils/dialectFromUrl.js";
|
|
5
7
|
import { TRANSACTION_BRAND } from "../utils/transactionBrand.js";
|
|
8
|
+
/**
|
|
9
|
+
* JSON replacer for the napi boundary. `BigInt` throws in a plain
|
|
10
|
+
* `JSON.stringify` and a `Uint8Array`/`Buffer` serializes to a useless
|
|
11
|
+
* index-map, so both are wrapped in envelopes the Rust side decodes and binds
|
|
12
|
+
* losslessly: `{"$bigint": "123"}` → i64, `{"$bytes": "<base64>"}` → BLOB/BYTEA.
|
|
13
|
+
*/
|
|
14
|
+
function napiReplacer(_key, value) {
|
|
15
|
+
if (typeof value === "bigint")
|
|
16
|
+
return { $bigint: value.toString() };
|
|
17
|
+
if (value instanceof Uint8Array) {
|
|
18
|
+
return { $bytes: Buffer.from(value).toString("base64") };
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* JSON reviver for napi result sets. Rebuilds `{"$bytes": …}` envelopes (emitted
|
|
24
|
+
* by the Rust decoder for BLOB/BYTEA columns) into a `Uint8Array`. Integers
|
|
25
|
+
* beyond JS's safe range arrive pre-stringified by Rust — no precision loss — so
|
|
26
|
+
* they stay strings, matching the pg/mysql driver convention.
|
|
27
|
+
*/
|
|
28
|
+
function napiReviver(_key, value) {
|
|
29
|
+
if (typeof value === "object" &&
|
|
30
|
+
value !== null &&
|
|
31
|
+
!Array.isArray(value) &&
|
|
32
|
+
"$bytes" in value &&
|
|
33
|
+
Object.keys(value).length === 1) {
|
|
34
|
+
const bytes = value.$bytes;
|
|
35
|
+
if (typeof bytes === "string") {
|
|
36
|
+
return Uint8Array.from(Buffer.from(bytes, "base64"));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
6
41
|
/**
|
|
7
42
|
* Connect to a database via the Rust NAPI driver.
|
|
8
43
|
*
|
|
@@ -10,7 +45,8 @@ import { TRANSACTION_BRAND } from "../utils/transactionBrand.js";
|
|
|
10
45
|
* const db = await createNapiConnection('postgres://user:pass@host/db')
|
|
11
46
|
* const db = await createNapiConnection('mysql://user:pass@host/db')
|
|
12
47
|
*/
|
|
13
|
-
export async function createNapiConnection(url, poolMin = 1, poolMax = 10, pragmas, retry) {
|
|
48
|
+
export async function createNapiConnection(url, poolMin = 1, poolMax = 10, pragmas, retry, observability = {}) {
|
|
49
|
+
const { debug = false, connectionName } = observability;
|
|
14
50
|
// Throws with the underlying cause if the binary can't be loaded.
|
|
15
51
|
const native = await loadNativeDb();
|
|
16
52
|
// Validate sqlite pragmas before crossing the NAPI boundary.
|
|
@@ -45,20 +81,29 @@ export async function createNapiConnection(url, poolMin = 1, poolMax = 10, pragm
|
|
|
45
81
|
// here routes to that same connection until commit/rollback hands it back.
|
|
46
82
|
async function openPinned(isolationLevel) {
|
|
47
83
|
const native = await db.begin(isolationLevel);
|
|
84
|
+
// Root (non-nested) transaction: after-hooks fire once the underlying
|
|
85
|
+
// COMMIT / ROLLBACK is durable (Lucid `trx.after(...)`), errors swallowed.
|
|
86
|
+
const commitHooks = [];
|
|
87
|
+
const rollbackHooks = [];
|
|
48
88
|
return {
|
|
49
89
|
async execute(sql, params = []) {
|
|
50
|
-
const affected = await native.execute(sql, JSON.stringify(params));
|
|
90
|
+
const affected = await native.execute(sql, JSON.stringify(params, napiReplacer));
|
|
51
91
|
return { rowsAffected: affected };
|
|
52
92
|
},
|
|
53
93
|
async query(sql, params = []) {
|
|
54
|
-
const json = await native.query(sql, JSON.stringify(params));
|
|
55
|
-
return JSON.parse(json);
|
|
94
|
+
const json = await native.query(sql, JSON.stringify(params, napiReplacer));
|
|
95
|
+
return JSON.parse(json, napiReviver);
|
|
56
96
|
},
|
|
57
97
|
async commit() {
|
|
58
98
|
await native.commit();
|
|
99
|
+
await runAfterHooks(commitHooks);
|
|
59
100
|
},
|
|
60
101
|
async rollback() {
|
|
61
102
|
await native.rollback();
|
|
103
|
+
await runAfterHooks(rollbackHooks);
|
|
104
|
+
},
|
|
105
|
+
after(event, cb) {
|
|
106
|
+
(event === "commit" ? commitHooks : rollbackHooks).push(cb);
|
|
62
107
|
},
|
|
63
108
|
isNested: false,
|
|
64
109
|
[TRANSACTION_BRAND]: true,
|
|
@@ -85,21 +130,66 @@ export async function createNapiConnection(url, poolMin = 1, poolMax = 10, pragm
|
|
|
85
130
|
throw err;
|
|
86
131
|
}
|
|
87
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Run `fn`, emitting a `db:query` event around it when observation is on.
|
|
135
|
+
*
|
|
136
|
+
* The fast path is a single boolean pair: with no listeners, or with debug
|
|
137
|
+
* off and no per-query override, this adds nothing but the check. The event
|
|
138
|
+
* is emitted on failure too — a slow query that then throws is exactly the
|
|
139
|
+
* one worth seeing.
|
|
140
|
+
*/
|
|
141
|
+
async function observed(sql, params, meta, fn) {
|
|
142
|
+
if (!(debug || meta?.debug) || !hasDbQueryListeners())
|
|
143
|
+
return fn();
|
|
144
|
+
const startedAt = performance.now();
|
|
145
|
+
try {
|
|
146
|
+
const result = await fn();
|
|
147
|
+
emitDbQuery({
|
|
148
|
+
sql,
|
|
149
|
+
bindings: params,
|
|
150
|
+
duration: performance.now() - startedAt,
|
|
151
|
+
connection: connectionName,
|
|
152
|
+
model: meta?.model,
|
|
153
|
+
method: meta?.method,
|
|
154
|
+
ddl: meta?.ddl,
|
|
155
|
+
inTransaction: false,
|
|
156
|
+
});
|
|
157
|
+
return result;
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
emitDbQuery({
|
|
161
|
+
sql,
|
|
162
|
+
bindings: params,
|
|
163
|
+
duration: performance.now() - startedAt,
|
|
164
|
+
connection: connectionName,
|
|
165
|
+
model: meta?.model,
|
|
166
|
+
method: meta?.method,
|
|
167
|
+
ddl: meta?.ddl,
|
|
168
|
+
inTransaction: false,
|
|
169
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
170
|
+
});
|
|
171
|
+
throw error;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
88
174
|
return {
|
|
89
175
|
dialect,
|
|
90
176
|
transaction,
|
|
91
|
-
async query(sql, params = []) {
|
|
92
|
-
|
|
93
|
-
|
|
177
|
+
async query(sql, params = [], meta) {
|
|
178
|
+
return observed(sql, params, meta, async () => {
|
|
179
|
+
const json = await db.query(sql, JSON.stringify(params, napiReplacer));
|
|
180
|
+
return JSON.parse(json, napiReviver);
|
|
181
|
+
});
|
|
94
182
|
},
|
|
95
|
-
async execute(sql, params = []) {
|
|
96
|
-
|
|
97
|
-
|
|
183
|
+
async execute(sql, params = [], meta) {
|
|
184
|
+
return observed(sql, params, meta, async () => {
|
|
185
|
+
const affected = await db.execute(sql, JSON.stringify(params, napiReplacer));
|
|
186
|
+
return { rowsAffected: affected };
|
|
187
|
+
});
|
|
98
188
|
},
|
|
99
189
|
async runInTransaction(batch) {
|
|
100
190
|
// Rust side expects `[[sql, params], ...]`
|
|
101
191
|
const payload = batch.map((s) => [s.sql, s.params ?? []]);
|
|
102
|
-
return db.runInTransaction(JSON.stringify(payload));
|
|
192
|
+
return db.runInTransaction(JSON.stringify(payload, napiReplacer));
|
|
103
193
|
},
|
|
104
194
|
async close() {
|
|
105
195
|
await db.close();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NapiDbAdapter.js","sourceRoot":"","sources":["../../src/adapters/NapiDbAdapter.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"NapiDbAdapter.js","sourceRoot":"","sources":["../../src/adapters/NapiDbAdapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAEN,aAAa,GAEb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE;;;;;GAKG;AACH,SAAS,YAAY,CAAC,IAAY,EAAE,KAAc;IACjD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACpE,IAAI,KAAK,Y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AAI,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;QACpD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACrD,mFAAmF;QACnF,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QACtD,OAAO,OAAO,CAAC,UAAU,CAAe,CAAC;IAC1C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,wEAAwE;QACxE,yEAAyE;QACzE,gEAAgE;QAChE,MAAM,IAAI,KAAK,CACd,0CAA0C,UAAU,SAAS,QAAQ,IAAI,IAAI,IAAI;YAChF,mCAAmC,EACpC,EAAE,KAAK,EAAE,GAAG,EAAE,CACd,CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration console commands — the Ream-idiomatic CLI for running, rolling back,
|
|
3
|
+
* inspecting, and wiping migrations. Same shape and contract as
|
|
4
|
+
* {@link schemaCheckCommand}: plain `{ name, description, run }` objects
|
|
5
|
+
* registered in `reamrc.commands` and dispatched by the console kernel.
|
|
6
|
+
*
|
|
7
|
+
* Each command resolves the live connection from atlas's OWN service locator
|
|
8
|
+
* (`getDb`), never importing `@c9up/ream`, and drives the already-tested
|
|
9
|
+
* {@link MigrationRunner}. Atlas has no global config registry (Lucid parity —
|
|
10
|
+
* you pass your own paths), so every factory takes the `migrationsDir`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // commands/migrate.ts
|
|
14
|
+
* import { migrationRunCommand } from '@c9up/atlas'
|
|
15
|
+
* export default migrationRunCommand({ migrationsDir: 'database/migrations' })
|
|
16
|
+
*
|
|
17
|
+
* // reamrc.ts → commands: [() => import('./commands/migrate.js')]
|
|
18
|
+
* // run: <console-entry> migration:run
|
|
19
|
+
*/
|
|
20
|
+
import type { AtlasCommand } from "./schemaCheckCommand.js";
|
|
21
|
+
export interface MigrationCommandOptions {
|
|
22
|
+
/** Directory holding the numbered migration files. */
|
|
23
|
+
migrationsDir: string;
|
|
24
|
+
}
|
|
25
|
+
/** `migration:run` — apply every pending migration. */
|
|
26
|
+
export declare function migrationRunCommand(options: MigrationCommandOptions): AtlasCommand;
|
|
27
|
+
/**
|
|
28
|
+
* `migration:rollback` — undo the latest batch, or with `--batch=N` roll back
|
|
29
|
+
* everything applied after batch N (`--batch=0` rolls back all).
|
|
30
|
+
*/
|
|
31
|
+
export declare function migrationRollbackCommand(options: MigrationCommandOptions): AtlasCommand;
|
|
32
|
+
/** `migration:status` — list every migration and whether it is applied. */
|
|
33
|
+
export declare function migrationStatusCommand(options: MigrationCommandOptions): AtlasCommand;
|
|
34
|
+
/** `migration:reset` — roll back every applied migration. */
|
|
35
|
+
export declare function migrationResetCommand(options: MigrationCommandOptions): AtlasCommand;
|
|
36
|
+
/** `migration:refresh` — roll everything back, then re-run all migrations. */
|
|
37
|
+
export declare function migrationRefreshCommand(options: MigrationCommandOptions): AtlasCommand;
|
|
38
|
+
/** `db:wipe` — drop every table, including the migrations bookkeeping table. */
|
|
39
|
+
export declare function dbWipeCommand(options: MigrationCommandOptions): AtlasCommand;
|
|
40
|
+
/**
|
|
41
|
+
* `make:migration <name>` — scaffold a timestamped migration file in
|
|
42
|
+
* `migrationsDir`. The `Date.now()` prefix keeps files in creation order under
|
|
43
|
+
* the runner's lexicographic sort (same convention as AdonisJS/Lucid). The name
|
|
44
|
+
* is validated (no path separators / traversal) and the file is written with
|
|
45
|
+
* `wx` so an existing migration is never clobbered.
|
|
46
|
+
*/
|
|
47
|
+
export declare function makeMigrationCommand(options: MigrationCommandOptions): AtlasCommand;
|
|
48
|
+
//# sourceMappingURL=migrationCommands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrationCommands.d.ts","sourceRoot":"","sources":["../../src/console/migrationCommands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAWH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,WAAW,uBAAuB;IACvC,sDAAsD;IACtD,aAAa,EAAE,MAAM,CAAC;CACtB;AAsCD,uDAAuD;AACvD,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,uBAAuB,GAC9B,YAAY,CAad;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACvC,OAAO,EAAE,uBAAuB,GAC9B,YAAY,CAuBd;AAED,2EAA2E;AAC3E,wBAAgB,sBAAsB,CACrC,OAAO,EAAE,uBAAuB,GAC9B,YAAY,CAkBd;AAED,6DAA6D;AAC7D,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,uBAAuB,GAC9B,YAAY,CAed;AAED,8EAA8E;AAC9E,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,uBAAuB,GAC9B,YAAY,CAWd;AAED,gFAAgF;AAChF,wBAAgB,aAAa,CAAC,OAAO,EAAE,uBAAuB,GAAG,YAAY,CAW5E;AAkBD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,uBAAuB,GAC9B,YAAY,CAyBd"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration console commands — the Ream-idiomatic CLI for running, rolling back,
|
|
3
|
+
* inspecting, and wiping migrations. Same shape and contract as
|
|
4
|
+
* {@link schemaCheckCommand}: plain `{ name, description, run }` objects
|
|
5
|
+
* registered in `reamrc.commands` and dispatched by the console kernel.
|
|
6
|
+
*
|
|
7
|
+
* Each command resolves the live connection from atlas's OWN service locator
|
|
8
|
+
* (`getDb`), never importing `@c9up/ream`, and drives the already-tested
|
|
9
|
+
* {@link MigrationRunner}. Atlas has no global config registry (Lucid parity —
|
|
10
|
+
* you pass your own paths), so every factory takes the `migrationsDir`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // commands/migrate.ts
|
|
14
|
+
* import { migrationRunCommand } from '@c9up/atlas'
|
|
15
|
+
* export default migrationRunCommand({ migrationsDir: 'database/migrations' })
|
|
16
|
+
*
|
|
17
|
+
* // reamrc.ts → commands: [() => import('./commands/migrate.js')]
|
|
18
|
+
* // run: <console-entry> migration:run
|
|
19
|
+
*/
|
|
20
|
+
import * as fsp from "node:fs/promises";
|
|
21
|
+
import * as path from "node:path";
|
|
22
|
+
import { MigrationRunner, } from "../schema/MigrationRunner.js";
|
|
23
|
+
import { getDb } from "../services/db.js";
|
|
24
|
+
import { assertSafeName } from "../utils/safePath.js";
|
|
25
|
+
/**
|
|
26
|
+
* Adapt the shared singleton connection to the runner's {@link DatabaseAdapter}.
|
|
27
|
+
* `close()` is intentionally a no-op — the console kernel owns the connection's
|
|
28
|
+
* lifecycle, so a command must not tear down a connection other commands share.
|
|
29
|
+
*/
|
|
30
|
+
function toAdapter(conn) {
|
|
31
|
+
return {
|
|
32
|
+
execute: async (sql, params) => {
|
|
33
|
+
await conn.execute(sql, params);
|
|
34
|
+
},
|
|
35
|
+
query: (sql, params) => conn.query(sql, params),
|
|
36
|
+
runInTransaction: (batch) => conn.runInTransaction(batch),
|
|
37
|
+
close: async () => { },
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Resolve a runner from the live connection, or report and set a failing exit
|
|
42
|
+
* code when no connection is registered (mirrors `schemaCheckCommand`).
|
|
43
|
+
*/
|
|
44
|
+
function resolveRunner(options) {
|
|
45
|
+
const db = getDb();
|
|
46
|
+
if (!db) {
|
|
47
|
+
console.error("[atlas] no database connection — is AtlasProvider registered?");
|
|
48
|
+
process.exitCode = 1;
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
return new MigrationRunner(toAdapter(db), {
|
|
52
|
+
migrationsDir: options.migrationsDir,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/** `migration:run` — apply every pending migration. */
|
|
56
|
+
export function migrationRunCommand(options) {
|
|
57
|
+
return {
|
|
58
|
+
name: "migration:run",
|
|
59
|
+
description: "Run all pending migrations",
|
|
60
|
+
async run() {
|
|
61
|
+
const runner = resolveRunner(options);
|
|
62
|
+
if (!runner)
|
|
63
|
+
return;
|
|
64
|
+
const ran = await runner.migrate();
|
|
65
|
+
console.log(ran.length ? `Migrated: ${ran.join(", ")}` : "Already up to date");
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* `migration:rollback` — undo the latest batch, or with `--batch=N` roll back
|
|
71
|
+
* everything applied after batch N (`--batch=0` rolls back all).
|
|
72
|
+
*/
|
|
73
|
+
export function migrationRollbackCommand(options) {
|
|
74
|
+
return {
|
|
75
|
+
name: "migration:rollback",
|
|
76
|
+
description: "Roll back the latest batch (or --batch=N)",
|
|
77
|
+
async run(_args, flags) {
|
|
78
|
+
const runner = resolveRunner(options);
|
|
79
|
+
if (!runner)
|
|
80
|
+
return;
|
|
81
|
+
const batch = parseBatchFlag(flags.batch);
|
|
82
|
+
if (batch === "invalid") {
|
|
83
|
+
console.error("[atlas] --batch must be a non-negative integer");
|
|
84
|
+
process.exitCode = 1;
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const rolled = await runner.rollback(batch === undefined ? {} : { batch });
|
|
88
|
+
console.log(rolled.length
|
|
89
|
+
? `Rolled back: ${rolled.join(", ")}`
|
|
90
|
+
: "Nothing to roll back");
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/** `migration:status` — list every migration and whether it is applied. */
|
|
95
|
+
export function migrationStatusCommand(options) {
|
|
96
|
+
return {
|
|
97
|
+
name: "migration:status",
|
|
98
|
+
description: "Show applied and pending migrations",
|
|
99
|
+
async run() {
|
|
100
|
+
const runner = resolveRunner(options);
|
|
101
|
+
if (!runner)
|
|
102
|
+
return;
|
|
103
|
+
const rows = await runner.status();
|
|
104
|
+
if (rows.length === 0) {
|
|
105
|
+
console.log("No migrations found");
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
for (const row of rows) {
|
|
109
|
+
const batch = row.batch === undefined ? "" : ` (batch ${row.batch})`;
|
|
110
|
+
console.log(`${row.status.padEnd(8)} ${row.name}${batch}`);
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/** `migration:reset` — roll back every applied migration. */
|
|
116
|
+
export function migrationResetCommand(options) {
|
|
117
|
+
return {
|
|
118
|
+
name: "migration:reset",
|
|
119
|
+
description: "Roll back all migrations",
|
|
120
|
+
async run() {
|
|
121
|
+
const runner = resolveRunner(options);
|
|
122
|
+
if (!runner)
|
|
123
|
+
return;
|
|
124
|
+
const rolled = await runner.reset();
|
|
125
|
+
console.log(rolled.length
|
|
126
|
+
? `Rolled back: ${rolled.join(", ")}`
|
|
127
|
+
: "Nothing to reset");
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/** `migration:refresh` — roll everything back, then re-run all migrations. */
|
|
132
|
+
export function migrationRefreshCommand(options) {
|
|
133
|
+
return {
|
|
134
|
+
name: "migration:refresh",
|
|
135
|
+
description: "Roll back all migrations, then re-run them",
|
|
136
|
+
async run() {
|
|
137
|
+
const runner = resolveRunner(options);
|
|
138
|
+
if (!runner)
|
|
139
|
+
return;
|
|
140
|
+
const { rolled, executed } = await runner.refresh();
|
|
141
|
+
console.log(`Rolled back: ${rolled.length}, re-ran: ${executed.length}`);
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/** `db:wipe` — drop every table, including the migrations bookkeeping table. */
|
|
146
|
+
export function dbWipeCommand(options) {
|
|
147
|
+
return {
|
|
148
|
+
name: "db:wipe",
|
|
149
|
+
description: "Drop all tables (including the migrations table)",
|
|
150
|
+
async run() {
|
|
151
|
+
const runner = resolveRunner(options);
|
|
152
|
+
if (!runner)
|
|
153
|
+
return;
|
|
154
|
+
await runner.wipe();
|
|
155
|
+
console.log("Dropped all tables");
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/** Scaffold body for a fresh migration (`make:migration`). */
|
|
160
|
+
const MIGRATION_STUB = `import { Migration } from '@c9up/atlas'
|
|
161
|
+
|
|
162
|
+
export default class extends Migration {
|
|
163
|
+
async up() {
|
|
164
|
+
// this.schema.createTable('table_name', (table) => {
|
|
165
|
+
// table.increments('id')
|
|
166
|
+
// })
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
async down() {
|
|
170
|
+
// this.schema.dropTable('table_name')
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
`;
|
|
174
|
+
/**
|
|
175
|
+
* `make:migration <name>` — scaffold a timestamped migration file in
|
|
176
|
+
* `migrationsDir`. The `Date.now()` prefix keeps files in creation order under
|
|
177
|
+
* the runner's lexicographic sort (same convention as AdonisJS/Lucid). The name
|
|
178
|
+
* is validated (no path separators / traversal) and the file is written with
|
|
179
|
+
* `wx` so an existing migration is never clobbered.
|
|
180
|
+
*/
|
|
181
|
+
export function makeMigrationCommand(options) {
|
|
182
|
+
return {
|
|
183
|
+
name: "make:migration",
|
|
184
|
+
description: "Scaffold a new timestamped migration file",
|
|
185
|
+
async run(args) {
|
|
186
|
+
const name = args[0];
|
|
187
|
+
if (!name) {
|
|
188
|
+
console.error("[atlas] usage: make:migration <name>");
|
|
189
|
+
process.exitCode = 1;
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
try {
|
|
193
|
+
assertSafeName(name, "MIGRATION_INVALID", "migration");
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
console.error(`[atlas] invalid migration name: ${name}`);
|
|
197
|
+
process.exitCode = 1;
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
const fileName = `${Date.now()}_${name}.ts`;
|
|
201
|
+
const filePath = path.join(options.migrationsDir, fileName);
|
|
202
|
+
await fsp.mkdir(options.migrationsDir, { recursive: true });
|
|
203
|
+
await fsp.writeFile(filePath, MIGRATION_STUB, { flag: "wx" });
|
|
204
|
+
console.log(`Created ${filePath}`);
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Parse the `--batch` flag: absent → undefined (default rollback), a
|
|
210
|
+
* non-negative integer string → that number, anything else → `"invalid"`.
|
|
211
|
+
*/
|
|
212
|
+
function parseBatchFlag(value) {
|
|
213
|
+
if (value === undefined || value === true)
|
|
214
|
+
return undefined;
|
|
215
|
+
if (value === false)
|
|
216
|
+
return "invalid";
|
|
217
|
+
const n = Number(value);
|
|
218
|
+
return Number.isInteger(n) && n >= 0 ? n : "invalid";
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=migrationCommands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrationCommands.js","sourceRoot":"","sources":["../../src/console/migrationCommands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAEN,eAAe,GACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAQtD;;;;GAIG;AACH,SAAS,SAAS,CAAC,IAA6B;IAC/C,OAAO;QACN,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE;YAC9B,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACjC,CAAC;QACD,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM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EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YAC9D,OAAO,CAAC,GAAG,CAAC,WAAW,QAAQ,EAAE,CAAC,CAAC;QACpC,CAAC;KACD,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,cAAc,CACtB,KAAmC;IAEnC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5D,IAAI,KAAK,KAAK,KAAK;QAAE,OAAO,SAAS,CAAC;IACtC,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC"}
|
|
@@ -46,8 +46,14 @@ export interface ColumnAdapter {
|
|
|
46
46
|
*
|
|
47
47
|
* MUST stay synchronous; the bind layer cannot await before handing values
|
|
48
48
|
* to the Rust DML compiler. Returning a Promise throws.
|
|
49
|
+
*
|
|
50
|
+
* Signature mirrors Adonis Lucid: `(value, attribute, model)`. `attribute` is
|
|
51
|
+
* the model property key; `model` is the entity instance being persisted, or
|
|
52
|
+
* `undefined` on query-builder paths that carry no instance (e.g.
|
|
53
|
+
* `updateWhere`). Both extra args are optional — a one-argument adapter keeps
|
|
54
|
+
* working unchanged.
|
|
49
55
|
*/
|
|
50
|
-
prepare?: (value: unknown) => unknown;
|
|
56
|
+
prepare?: (value: unknown, attribute?: string, model?: unknown) => unknown;
|
|
51
57
|
/**
|
|
52
58
|
* Transform the raw DB value into the model attribute (DB → model). Mirror
|
|
53
59
|
* of Adonis Lucid's `@column.consume`. For entity columns, runs in
|
|
@@ -60,8 +66,12 @@ export interface ColumnAdapter {
|
|
|
60
66
|
* null/undefined inputs to preserve nullable semantics.
|
|
61
67
|
*
|
|
62
68
|
* MUST stay synchronous (same constraint as `prepare`).
|
|
69
|
+
*
|
|
70
|
+
* Signature mirrors Adonis Lucid: `(value, attribute, model)`. `attribute` is
|
|
71
|
+
* the model property key; `model` is the entity being hydrated. Both extra
|
|
72
|
+
* args are optional — a one-argument adapter keeps working unchanged.
|
|
63
73
|
*/
|
|
64
|
-
consume?: (value: unknown) => unknown;
|
|
74
|
+
consume?: (value: unknown, attribute?: string, model?: unknown) => unknown;
|
|
65
75
|
}
|
|
66
76
|
export interface ColumnMetadata extends ColumnAdapter {
|
|
67
77
|
propertyKey: string;
|
|
@@ -69,16 +79,24 @@ export interface ColumnMetadata extends ColumnAdapter {
|
|
|
69
79
|
nullable?: boolean;
|
|
70
80
|
default?: unknown;
|
|
71
81
|
serializeAs?: string | null;
|
|
72
|
-
serialize?: (value: unknown) => unknown;
|
|
82
|
+
serialize?: (value: unknown, attribute?: string, model?: unknown) => unknown;
|
|
83
|
+
/** Explicit DB column name override (AdonisJS Lucid `columnName`). */
|
|
84
|
+
columnName?: string;
|
|
73
85
|
}
|
|
74
86
|
export interface ColumnOptions extends ColumnAdapter {
|
|
75
87
|
type?: string;
|
|
76
88
|
nullable?: boolean;
|
|
77
89
|
default?: unknown;
|
|
90
|
+
/**
|
|
91
|
+
* Map this property to an explicitly-named DB column (AdonisJS Lucid
|
|
92
|
+
* `columnName`), instead of the default `camelCase → snake_case` convention.
|
|
93
|
+
* For legacy/non-conventional schemas, e.g. `@Column({ columnName: 'USR_MAIL' })`.
|
|
94
|
+
*/
|
|
95
|
+
columnName?: string;
|
|
78
96
|
/** Rename this column at `toJSON` time. Use `null` to hide it entirely. */
|
|
79
97
|
serializeAs?: string | null;
|
|
80
98
|
/** Transform the value at `toJSON` time (e.g. mask a phone number, coerce a Date). */
|
|
81
|
-
serialize?: (value: unknown) => unknown;
|
|
99
|
+
serialize?: (value: unknown, attribute?: string, model?: unknown) => unknown;
|
|
82
100
|
}
|
|
83
101
|
type Constructor = new (...args: unknown[]) => unknown;
|
|
84
102
|
export interface ManyToManyOptions {
|
|
@@ -226,7 +244,12 @@ export declare function BelongsTo(target: () => Constructor, options?: RelationO
|
|
|
226
244
|
export declare function HasOne(target: () => Constructor, options?: RelationOptions): PropertyDecorator;
|
|
227
245
|
/** @HasMany(() => Related, { localKey, foreignKey, onQuery, serializeAs }) */
|
|
228
246
|
export declare function HasMany(target: () => Constructor, options?: RelationOptions): PropertyDecorator;
|
|
229
|
-
/**
|
|
247
|
+
/**
|
|
248
|
+
* `@HasOneThrough(() => Related, () => Through, { firstKey, secondKey, localKey, secondLocalKey, onQuery })`
|
|
249
|
+
*
|
|
250
|
+
* An atlas addition — Lucid has no hasOneThrough relation. Same two-hop
|
|
251
|
+
* traversal as {@link HasManyThrough}, returning a single row.
|
|
252
|
+
*/
|
|
230
253
|
export declare function HasOneThrough(target: () => Constructor, through: () => Constructor, options?: ThroughOptions): PropertyDecorator;
|
|
231
254
|
/** @HasManyThrough(() => Related, () => Through, { firstKey, secondKey, localKey, secondLocalKey, onQuery }) */
|
|
232
255
|
export declare function HasManyThrough(target: () => Constructor, through: () => Constructor, options?: ThroughOptions): PropertyDecorator;
|
|
@@ -234,9 +257,17 @@ export declare function HasManyThrough(target: () => Constructor, through: () =>
|
|
|
234
257
|
export declare function ManyToMany(target: () => Constructor, options: ManyToManyOptions & RelationOptions): PropertyDecorator;
|
|
235
258
|
/** Get entity metadata for a class. */
|
|
236
259
|
export declare function getEntityMetadata(target: Constructor): EntityMetadata | undefined;
|
|
260
|
+
/**
|
|
261
|
+
* Return the class's `@Entity` metadata, SYNTHESIZING it when the decorator is
|
|
262
|
+
* absent: the table name is inferred from the class name via the naming strategy
|
|
263
|
+
* (or an explicit `static table`). AdonisJS Lucid parity — a model needs no
|
|
264
|
+
* explicit `@Entity('table')`. Used by both `BaseModel` and the `BaseRepository`
|
|
265
|
+
* constructor so the Data-Mapper and Active-Record paths share one convention.
|
|
266
|
+
*/
|
|
267
|
+
export declare function ensureEntityMetadata(target: Constructor): EntityMetadata;
|
|
237
268
|
/** Get column metadata for a class (returns a copy). */
|
|
238
269
|
export declare function getColumnMetadata(target: Constructor): ColumnMetadata[];
|
|
239
|
-
/** Get primary key property name. */
|
|
270
|
+
/** Get primary key property name. A `static primaryKey` (AdonisJS Lucid) wins over the `@PrimaryKey()` decorator. */
|
|
240
271
|
export declare function getPrimaryKey(target: Constructor): string | undefined;
|
|
241
272
|
/** Get relation metadata for a class (returns a copy). */
|
|
242
273
|
export declare function getRelationMetadata(target: Constructor): RelationMetadata[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../src/decorators/entity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../src/decorators/entity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,kBAAkB,CAAC;AAc1B,sEAAsE;AACtE,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEzC,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACvD;;;;;OAKG;IACH,SAAS,CAAC,EAAE,mBAAmB,CAAC;CAChC;AAED,MAAM,WAAW,cAAc;IAC9B,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;IAC3E;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;CAC3E;AAED,MAAM,WAAW,cAAe,SAAQ,aAAa;IACpD,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM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