@fonderie/client 0.30.0 → 0.31.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.
@@ -285,6 +285,8 @@ new AdminClient(opts: IAdminClientOptions): AdminClient
285
285
  .adminLog(query?: IAdminLogQuery): Promise<IApiResponse<IAdminLogPage>>
286
286
  .issueToken(input: IAdminIssueTokenInput): Promise<IApiResponse<IAdminIssuedToken>>
287
287
  .revokeToken(id: string): Promise<IApiResponse<undefined>>
288
+ .migrations(): Promise<IApiResponse<IAdminMigrationsReport>>
289
+ .applyMigrations(module: string, expect: readonly string[]): Promise<IApiResponse<IAdminMigrationModule>>
288
290
 
289
291
  interface IAuthAdminClientOptions {
290
292
  baseUrl: string;
@@ -861,6 +863,26 @@ interface IAdminIssuedToken extends IAdminTokenRecord {
861
863
  token: string;
862
864
  }
863
865
 
866
+ type MigrationImpact = 'additive' | 'destructive';
867
+
868
+ interface IAdminPendingMigration {
869
+ file: string;
870
+ impact: MigrationImpact;
871
+ destructive: string[];
872
+ }
873
+
874
+ interface IAdminMigrationModule {
875
+ name: string;
876
+ pending: IAdminPendingMigration[];
877
+ blockedBy: string | null;
878
+ appliable: boolean;
879
+ }
880
+
881
+ interface IAdminMigrationsReport {
882
+ everApplied: boolean;
883
+ modules: IAdminMigrationModule[];
884
+ }
885
+
864
886
  interface IAdminUserDTO extends IUserDTO {
865
887
  deletedAt: string | null;
866
888
  }
package/dist/index.cjs CHANGED
@@ -1828,6 +1828,26 @@ var AdminClient = class {
1828
1828
  revokeToken(id) {
1829
1829
  return this.call("DELETE", `/access/tokens/${encodeURIComponent(id)}`);
1830
1830
  }
1831
+ // What each module is waiting on, with every pending file's impact. Empty
1832
+ // when the deployment did not hand its migration sequence to the surface.
1833
+ migrations() {
1834
+ return this.get("/migrations");
1835
+ }
1836
+ /**
1837
+ * Apply one module's pending migrations — all of them, or none.
1838
+ *
1839
+ * `expect` is the pending list you were shown, in order. If it no longer
1840
+ * matches, the server refuses with 409 MIGRATIONS_CHANGED rather than
1841
+ * applying something nobody reviewed. Also refuses 409 when an earlier
1842
+ * module is behind, and 422 when any pending file deletes data.
1843
+ */
1844
+ applyMigrations(module2, expect) {
1845
+ return this.call(
1846
+ "POST",
1847
+ `/migrations/${encodeURIComponent(module2)}/apply`,
1848
+ { expect }
1849
+ );
1850
+ }
1831
1851
  };
1832
1852
 
1833
1853
  // src/modules/auth-admin.ts