mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
@@ -974,7 +974,7 @@ export class SystemForEmbassy implements System {
|
||||
})) as U.Config
|
||||
if (!oldConfig) return
|
||||
const moduleCode = await this.moduleCode
|
||||
const method = moduleCode.dependencies?.[id]?.autoConfigure
|
||||
const method = moduleCode?.dependencies?.[id]?.autoConfigure
|
||||
if (!method) return
|
||||
const newConfig = (await method(
|
||||
polyfillEffects(effects, this.manifest),
|
||||
|
||||
@@ -146,6 +146,7 @@ export function transformOldConfigToNew(
|
||||
spec: OldConfigSpec,
|
||||
config: Record<string, any>,
|
||||
): Record<string, any> {
|
||||
if (!config) return config
|
||||
return Object.entries(spec).reduce((obj, [key, val]) => {
|
||||
let newVal = config[key]
|
||||
|
||||
@@ -157,7 +158,12 @@ export function transformOldConfigToNew(
|
||||
}
|
||||
|
||||
if (isUnion(val)) {
|
||||
const selection = config[key][val.tag.id]
|
||||
if (!config[key]) return obj
|
||||
|
||||
const selection = config[key]?.[val.tag.id]
|
||||
|
||||
if (!selection) return obj
|
||||
|
||||
delete config[key][val.tag.id]
|
||||
|
||||
newVal = {
|
||||
@@ -170,6 +176,8 @@ export function transformOldConfigToNew(
|
||||
}
|
||||
|
||||
if (isList(val) && isObjectList(val)) {
|
||||
if (!config[key]) return obj
|
||||
|
||||
newVal = (config[key] as object[]).map((obj) =>
|
||||
transformOldConfigToNew(
|
||||
matchOldConfigSpec.unsafeCast(val.spec.spec),
|
||||
|
||||
Reference in New Issue
Block a user