mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 14:29:45 +00:00
chore: Remove the utils
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { ValueSpec } from "../configTypes"
|
||||
import { Utils } from "../../util/utils"
|
||||
import { Value } from "./value"
|
||||
import { _ } from "../../util"
|
||||
import { Effects } from "../../types"
|
||||
@@ -7,7 +6,6 @@ import { Parser, object } from "ts-matches"
|
||||
|
||||
export type LazyBuildOptions<Store> = {
|
||||
effects: Effects
|
||||
utils: Utils<any, Store>
|
||||
}
|
||||
export type LazyBuild<Store, ExpectedOut> = (
|
||||
options: LazyBuildOptions<Store>,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { SmtpValue } from "../types"
|
||||
import { GetSystemSmtp } from "../util/GetSystemSmtp"
|
||||
import { email } from "../util/patterns"
|
||||
import { Config, ConfigSpecOf } from "./builder/config"
|
||||
import { Value } from "./builder/value"
|
||||
@@ -47,8 +48,8 @@ export const customSmtp = Config.of<ConfigSpecOf<SmtpValue>, never>({
|
||||
* For service config. Gives users 3 options for SMTP: (1) disabled, (2) use system SMTP settings, (3) use custom SMTP settings
|
||||
*/
|
||||
export const smtpConfig = Value.filteredUnion(
|
||||
async ({ effects, utils }) => {
|
||||
const smtp = await utils.getSystemSmtp().once()
|
||||
async ({ effects }) => {
|
||||
const smtp = await new GetSystemSmtp(effects).once()
|
||||
return smtp ? [] : ["system"]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@ import { Effects, ExpectedExports } from "../types"
|
||||
import { SDKManifest } from "../manifest/ManifestTypes"
|
||||
import * as D from "./configDependencies"
|
||||
import { Config, ExtractConfigType } from "./builder/config"
|
||||
import { Utils, createUtils } from "../util/utils"
|
||||
import nullIfEmpty from "../util/nullIfEmpty"
|
||||
import { InterfaceReceipt } from "../interfaces/interfaceReceipt"
|
||||
import { InterfacesReceipt as InterfacesReceipt } from "../interfaces/setupInterfaces"
|
||||
@@ -22,7 +21,6 @@ export type Save<
|
||||
> = (options: {
|
||||
effects: Effects
|
||||
input: ExtractConfigType<A> & Record<string, any>
|
||||
utils: Utils<Manifest, Store>
|
||||
dependencies: D.ConfigDependencies<Manifest>
|
||||
}) => Promise<{
|
||||
dependenciesReceipt: DependenciesReceipt
|
||||
@@ -38,7 +36,6 @@ export type Read<
|
||||
| Config<Record<string, any>, never>,
|
||||
> = (options: {
|
||||
effects: Effects
|
||||
utils: Utils<Manifest, Store>
|
||||
}) => Promise<void | (ExtractConfigType<A> & Record<string, any>)>
|
||||
/**
|
||||
* We want to setup a config export with a get and set, this
|
||||
@@ -72,7 +69,6 @@ export function setupConfig<
|
||||
const { restart } = await write({
|
||||
input: JSON.parse(JSON.stringify(input)),
|
||||
effects,
|
||||
utils: createUtils(effects),
|
||||
dependencies: D.configDependenciesSet<Manifest>(),
|
||||
})
|
||||
if (restart) {
|
||||
@@ -80,14 +76,10 @@ export function setupConfig<
|
||||
}
|
||||
}) as ExpectedExports.setConfig,
|
||||
getConfig: (async ({ effects }) => {
|
||||
const myUtils = createUtils<Manifest, Store>(effects)
|
||||
const configValue = nullIfEmpty(
|
||||
(await read({ effects, utils: myUtils })) || null,
|
||||
)
|
||||
const configValue = nullIfEmpty((await read({ effects })) || null)
|
||||
return {
|
||||
spec: await spec.build({
|
||||
effects,
|
||||
utils: myUtils as any,
|
||||
}),
|
||||
config: configValue,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user