refactor(setup): reuse scoped config prelude in patched adapters

This commit is contained in:
Peter Steinberger
2026-03-17 03:54:04 +00:00
parent 4ae71485e9
commit 233ef31190

View File

@@ -172,7 +172,7 @@ export function createPatchedAccountSetupAdapter(params: {
return {
resolveAccountId: ({ accountId }) => normalizeAccountId(accountId),
applyAccountName: ({ cfg, accountId, name }) =>
applyAccountNameToChannelSection({
prepareScopedSetupConfig({
cfg,
channelKey: params.channelKey,
accountId,
@@ -181,21 +181,14 @@ export function createPatchedAccountSetupAdapter(params: {
}),
validateInput: params.validateInput,
applyAccountConfig: ({ cfg, accountId, input }) => {
const namedConfig = applyAccountNameToChannelSection({
const next = prepareScopedSetupConfig({
cfg,
channelKey: params.channelKey,
accountId,
name: input.name,
alwaysUseAccounts: params.alwaysUseAccounts,
migrateBaseName: !params.alwaysUseAccounts,
});
const next =
accountId !== DEFAULT_ACCOUNT_ID
? migrateBaseNameToDefaultAccount({
cfg: namedConfig,
channelKey: params.channelKey,
alwaysUseAccounts: params.alwaysUseAccounts,
})
: namedConfig;
const patch = params.buildPatch(input);
return patchScopedAccountConfig({
cfg: next,