@warlock.js/cascade 4.11.0 → 4.13.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/CHANGELOG.md +14 -0
- package/cjs/index.cjs +32 -1
- package/cjs/index.cjs.map +1 -1
- package/esm/index.d.mts +3 -3
- package/esm/index.mjs +2 -2
- package/esm/migration/index.d.mts +1 -1
- package/esm/migration/migration-runner.d.mts +11 -2
- package/esm/migration/migration-runner.d.mts.map +1 -1
- package/esm/migration/migration-runner.mjs +10 -1
- package/esm/migration/migration-runner.mjs.map +1 -1
- package/esm/migration/types.d.mts +1 -18
- package/esm/migration/types.d.mts.map +1 -1
- package/esm/operations/index.d.mts +1 -1
- package/esm/operations/index.mjs +1 -1
- package/esm/operations/migrations.d.mts +25 -1
- package/esm/operations/migrations.d.mts.map +1 -1
- package/esm/operations/migrations.mjs +22 -1
- package/esm/operations/migrations.mjs.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@ All notable changes to `@warlock.js/cascade` are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
|
|
6
6
|
|
|
7
|
+
## 4.12.0
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **`listPendingMigrations()`** — the registered migrations that have not executed, **in the order they will execute**, mirroring `listExecutedMigrations()`. The set was already computed inside the runner on every migrate run; `getPendingMigrations()` was `private` and had no read-only exit, so nothing outside could ask "what will run next?" without running it
|
|
12
|
+
|
|
13
|
+
Returns `PendingMigration { name, createdAt? }` rather than the migration classes: `MigrationClass` is module-local, so a public API returning it would hand consumers a type they cannot name. It deliberately omits `table`, which `status()` obtains by constructing each migration — instantiating user classes to decorate a listing lets a constructor throw inside the very call meant to report on a broken tree
|
|
14
|
+
|
|
15
|
+
`getPendingMigrations()` is now public alongside it. **Both document the trap in their own JSDoc:** only *registered* migrations can be pending, so a caller that has not registered anything receives `[]` — indistinguishable from a database with nothing pending, and the reason `@warlock.js/core`'s CLI loads before it reports
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Declares its own test runner and pins it to an exact version (`vitest@4.1.10`). The package is its own repository, so a runner resolved from a workspace root it may not be cloned with is a runner it cannot rely on. The pin is exact rather than a range because the version moved underneath the suite mid-development on an unrelated install — a suite whose runner can change without anyone choosing it proves less than it appears to
|
|
20
|
+
|
|
7
21
|
## 4.9.2
|
|
8
22
|
|
|
9
23
|
### Fixed
|
package/cjs/index.cjs
CHANGED
|
@@ -22359,7 +22359,16 @@ var MigrationRunner = class {
|
|
|
22359
22359
|
return lines.join("\n");
|
|
22360
22360
|
}
|
|
22361
22361
|
/**
|
|
22362
|
-
* Get pending (not executed) registered migrations
|
|
22362
|
+
* Get pending (not executed) registered migrations, in the order they would
|
|
22363
|
+
* execute.
|
|
22364
|
+
*
|
|
22365
|
+
* ⚠️ "Registered" is load-bearing. This filters `this.migrations`, which is
|
|
22366
|
+
* populated only by `register()` / `registerMany()`. A caller that has not
|
|
22367
|
+
* registered anything gets `[]` — indistinguishable from a database with
|
|
22368
|
+
* nothing pending. Anything reporting this set to a human MUST register
|
|
22369
|
+
* migrations first, or it will print a confident all-clear over an unknown.
|
|
22370
|
+
*
|
|
22371
|
+
* @see listPendingMigrations
|
|
22363
22372
|
*/
|
|
22364
22373
|
async getPendingMigrations() {
|
|
22365
22374
|
const executed = await this.getExecutedMigrations();
|
|
@@ -22529,6 +22538,27 @@ async function exportMigrationsSQL(options = {}) {
|
|
|
22529
22538
|
async function listExecutedMigrations() {
|
|
22530
22539
|
return migrationRunner.getExecutedMigrations();
|
|
22531
22540
|
}
|
|
22541
|
+
/**
|
|
22542
|
+
* Return the registered migrations that have NOT been executed, **in the order
|
|
22543
|
+
* they will execute**. The order is the point: it makes the result a dry run
|
|
22544
|
+
* rather than a set.
|
|
22545
|
+
*
|
|
22546
|
+
* ⚠️ Only registered migrations can be pending. Register them first — via
|
|
22547
|
+
* `migrationRunner.register()` / `registerMany()`, or whatever the host
|
|
22548
|
+
* framework's loader does — or this returns `[]`, which reads as "nothing
|
|
22549
|
+
* pending" and is not the same thing.
|
|
22550
|
+
*
|
|
22551
|
+
* @example
|
|
22552
|
+
* migrationRunner.registerMany([CreateUsersTable, AddEmailIndex]);
|
|
22553
|
+
* const pending = await listPendingMigrations();
|
|
22554
|
+
* console.log(pending.map((migration) => migration.name));
|
|
22555
|
+
*/
|
|
22556
|
+
async function listPendingMigrations() {
|
|
22557
|
+
return (await migrationRunner.getPendingMigrations()).map((MigrationClass) => ({
|
|
22558
|
+
name: MigrationClass.migrationName,
|
|
22559
|
+
createdAt: MigrationClass.createdAt
|
|
22560
|
+
}));
|
|
22561
|
+
}
|
|
22532
22562
|
|
|
22533
22563
|
//#endregion
|
|
22534
22564
|
exports.$agg = $agg;
|
|
@@ -22621,6 +22651,7 @@ exports.isMongoDBDriverLoaded = isMongoDBDriverLoaded;
|
|
|
22621
22651
|
exports.json = json;
|
|
22622
22652
|
exports.lineString = lineString;
|
|
22623
22653
|
exports.listExecutedMigrations = listExecutedMigrations;
|
|
22654
|
+
exports.listPendingMigrations = listPendingMigrations;
|
|
22624
22655
|
exports.longText = longText;
|
|
22625
22656
|
exports.macAddress = macAddress;
|
|
22626
22657
|
exports.mediumText = mediumText;
|