mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-30 12:21:57 +00:00
fix the types
This commit is contained in:
@@ -42,12 +42,12 @@ export class Backups<M extends SDKManifest> {
|
||||
|
||||
private constructor(
|
||||
private options = DEFAULT_OPTIONS,
|
||||
private backupSet = [] as BackupSet<keyof M["volumes"] & string>[],
|
||||
private backupSet = [] as BackupSet<M["volumes"][0]>[],
|
||||
) {}
|
||||
static volumes<M extends SDKManifest = never>(
|
||||
...volumeNames: Array<keyof M["volumes"] & string>
|
||||
) {
|
||||
return new Backups().addSets(
|
||||
...volumeNames: Array<M["volumes"][0]>
|
||||
): Backups<M> {
|
||||
return new Backups<M>().addSets(
|
||||
...volumeNames.map((srcVolume) => ({
|
||||
srcVolume,
|
||||
srcPath: "./",
|
||||
@@ -57,7 +57,7 @@ export class Backups<M extends SDKManifest> {
|
||||
)
|
||||
}
|
||||
static addSets<M extends SDKManifest = never>(
|
||||
...options: BackupSet<keyof M["volumes"] & string>[]
|
||||
...options: BackupSet<M["volumes"][0]>[]
|
||||
) {
|
||||
return new Backups().addSets(...options)
|
||||
}
|
||||
@@ -75,7 +75,7 @@ export class Backups<M extends SDKManifest> {
|
||||
}
|
||||
return this
|
||||
}
|
||||
volumes(...volumeNames: Array<keyof M["volumes"] & string>) {
|
||||
volumes(...volumeNames: Array<M["volumes"][0]>) {
|
||||
return this.addSets(
|
||||
...volumeNames.map((srcVolume) => ({
|
||||
srcVolume,
|
||||
@@ -85,7 +85,7 @@ export class Backups<M extends SDKManifest> {
|
||||
})),
|
||||
)
|
||||
}
|
||||
addSets(...options: BackupSet<keyof M["volumes"] & string>[]) {
|
||||
addSets(...options: BackupSet<M["volumes"][0]>[]) {
|
||||
options.forEach((x) =>
|
||||
this.backupSet.push({ ...x, options: { ...this.options, ...x.options } }),
|
||||
)
|
||||
|
||||
@@ -4,14 +4,14 @@ import { ExpectedExports } from "../types"
|
||||
import { _ } from "../util"
|
||||
|
||||
export type SetupBackupsParams<M extends SDKManifest> = Array<
|
||||
(keyof M["volumes"] & string) | Backups<M>
|
||||
M["volumes"][0] | Backups<M>
|
||||
>
|
||||
|
||||
export function setupBackups<M extends SDKManifest>(
|
||||
...args: _<SetupBackupsParams<M>>
|
||||
) {
|
||||
const backups = Array<Backups<M>>()
|
||||
const volumes = new Set<keyof M["volumes"] & string>()
|
||||
const volumes = new Set<M["volumes"][0]>()
|
||||
for (const arg of args) {
|
||||
if (arg instanceof Backups) {
|
||||
backups.push(arg)
|
||||
|
||||
Reference in New Issue
Block a user