@oliasoft-open-source/node-json-migrator 5.5.0 → 5.6.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 CHANGED
@@ -155,6 +155,19 @@ Or, you can backfit a script earlier in the sequence
155
155
  - set its sequence to for example `1.1` (subsequence number)
156
156
  - the backfitted script _will_ execute one time on all payloads
157
157
 
158
+ ## Checking migration plans in CI
159
+
160
+ `checkMigrationPlan({ directory })` uses the same validation as a real migrator run. It throws if the plan is invalid
161
+ or the migrator would rewrite it. It does not access a database, execute migration scripts, or modify files.
162
+ Whitespace is normalized before comparison; entry and field ordering are checked. Both CI and regular migration runs
163
+ reject active migration files absent from `plan.json`. Skipped scripts and test files remain excluded.
164
+
165
+ ```ts
166
+ import { checkMigrationPlan } from '@oliasoft-open-source/node-json-migrator';
167
+
168
+ await checkMigrationPlan({ directory: './migrations' });
169
+ ```
170
+
158
171
  # How to contribute
159
172
 
160
173
  Contribution is welcome via [issue tickets](https://gitlab.com/oliasoft-open-source/node-json-migrator/-/issues)
package/dist/index.d.mts CHANGED
@@ -1,5 +1,13 @@
1
1
  import { IDatabase, IHelpers, ITask } from "pg-promise";
2
2
 
3
+ //#region src/plan/check-migration-plan.d.ts
4
+ /** Check the plan as a real migrator run would, without modifying files or accessing a database. */
5
+ declare const checkMigrationPlan: ({
6
+ directory
7
+ }: {
8
+ directory: string;
9
+ }) => Promise<void>;
10
+ //#endregion
3
11
  //#region src/create/create.d.ts
4
12
  /**
5
13
  * Generate a new entity migration
@@ -100,6 +108,7 @@ declare const getPlannedMigrations: ({
100
108
  migrator: (payload: unknown, metaData?: unknown) => unknown;
101
109
  }[];
102
110
  nextVersion: string;
111
+ planHasChanged: boolean;
103
112
  }>;
104
113
  //#endregion
105
114
  //#region src/plan/planned-version.d.ts
@@ -165,4 +174,4 @@ declare const printVersionHistory: ({
165
174
  config: TConfig;
166
175
  }) => Promise<void>;
167
176
  //#endregion
168
- export { type TAfterMigrateRecord, type TAfterMigrateRecordPayload, type TBeforeMigrateRecord, type TBeforeMigrateRecordPayload, type TConfig, type TEntityColumnNames, type TMetaData, type TMigration, type TMigrationErrorPayload, type TOnMigrationErrors, type TOnMigrationErrorsPayload, type TPayload, type TPlan, type TPlanEntry, type TRecord, type TRecordDetails, type TRecordDetailsList, createMigration, getPlannedMigrations, getPlannedVersion, getVersions, migrate, migrateAll, pipe, printVersionHistory };
177
+ export { type TAfterMigrateRecord, type TAfterMigrateRecordPayload, type TBeforeMigrateRecord, type TBeforeMigrateRecordPayload, type TConfig, type TEntityColumnNames, type TMetaData, type TMigration, type TMigrationErrorPayload, type TOnMigrationErrors, type TOnMigrationErrorsPayload, type TPayload, type TPlan, type TPlanEntry, type TRecord, type TRecordDetails, type TRecordDetailsList, checkMigrationPlan, createMigration, getPlannedMigrations, getPlannedVersion, getVersions, migrate, migrateAll, pipe, printVersionHistory };