mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 12:33:40 +00:00
@@ -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