mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-30 12:21:57 +00:00
feat: Add vault through utils + sdk
This commit is contained in:
@@ -2,27 +2,39 @@ import { ManifestVersion } from "../../manifest/ManifestTypes"
|
||||
import { Effects } from "../../types"
|
||||
import { Utils } from "../../util/utils"
|
||||
|
||||
export class Migration<Store, Version extends ManifestVersion> {
|
||||
export class Migration<Store, Vault, Version extends ManifestVersion> {
|
||||
constructor(
|
||||
readonly options: {
|
||||
version: Version
|
||||
up: (opts: { effects: Effects; utils: Utils<Store> }) => Promise<void>
|
||||
down: (opts: { effects: Effects; utils: Utils<Store> }) => Promise<void>
|
||||
up: (opts: {
|
||||
effects: Effects
|
||||
utils: Utils<Store, Vault>
|
||||
}) => Promise<void>
|
||||
down: (opts: {
|
||||
effects: Effects
|
||||
utils: Utils<Store, Vault>
|
||||
}) => Promise<void>
|
||||
},
|
||||
) {}
|
||||
static of<Store, Version extends ManifestVersion>(options: {
|
||||
static of<Store, Vault, Version extends ManifestVersion>(options: {
|
||||
version: Version
|
||||
up: (opts: { effects: Effects; utils: Utils<Store> }) => Promise<void>
|
||||
down: (opts: { effects: Effects; utils: Utils<Store> }) => Promise<void>
|
||||
up: (opts: {
|
||||
effects: Effects
|
||||
utils: Utils<Store, Vault>
|
||||
}) => Promise<void>
|
||||
down: (opts: {
|
||||
effects: Effects
|
||||
utils: Utils<Store, Vault>
|
||||
}) => Promise<void>
|
||||
}) {
|
||||
return new Migration<Store, Version>(options)
|
||||
return new Migration<Store, Vault, Version>(options)
|
||||
}
|
||||
|
||||
async up(opts: { effects: Effects; utils: Utils<Store> }) {
|
||||
async up(opts: { effects: Effects; utils: Utils<Store, Vault> }) {
|
||||
this.up(opts)
|
||||
}
|
||||
|
||||
async down(opts: { effects: Effects; utils: Utils<Store> }) {
|
||||
async down(opts: { effects: Effects; utils: Utils<Store, Vault> }) {
|
||||
this.down(opts)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user