This commit is contained in:
Aiden McClelland
2025-02-18 15:54:33 -07:00
committed by GitHub
parent dd3a140cb1
commit df8c8dc93b
2 changed files with 10 additions and 2 deletions

View File

@@ -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),

View File

@@ -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),