chore: update the version and add the setupInit section

This commit is contained in:
BluJ
2023-04-25 14:36:43 -06:00
parent 5107d38547
commit 1b9e2cf503
11 changed files with 155 additions and 58 deletions

View File

@@ -0,0 +1,28 @@
import { ManifestVersion } from "../../manifest/ManifestTypes";
import { Effects } from "../../types";
import { Utils } from "../../util";
export class Migration<Version extends ManifestVersion> {
constructor(
readonly options: {
version: Version;
up: (opts: { effects: Effects }) => Promise<void>;
down: (opts: { effects: Effects }) => Promise<void>;
},
) {}
static of<Version extends ManifestVersion>(options: {
version: Version;
up: (opts: { effects: Effects }) => Promise<void>;
down: (opts: { effects: Effects }) => Promise<void>;
}) {
return new Migration(options);
}
async up(opts: { effects: Effects }) {
this.up(opts);
}
async down(opts: { effects: Effects }) {
this.down(opts);
}
}