ui : derive the syncable parameter list in the parameter sync service

The syncable parameter mapping is only consumed by the sync service, so
derive it there from the registry instead of exporting it from the
constants file.
This commit is contained in:
Aleksander Grygier
2026-08-15 08:37:44 +02:00
parent 4efe1b9d2a
commit 1778c97cff
2 changed files with 15 additions and 16 deletions
@@ -23,8 +23,7 @@ import type {
SettingsEntry,
SettingsFieldConfig,
SettingsSection,
SettingsSectionEntry,
SyncableParameter
SettingsSectionEntry
} from '$lib/types';
/** Settings sections — slug is the routing identity, title is the display label. */
@@ -754,15 +753,3 @@ export const NUMERIC_FIELDS = getAllSettings()
export const POSITIVE_INTEGER_FIELDS = getAllSettings()
.filter((s) => s.isPositiveInteger)
.map((s) => s.key) as readonly string[];
/** Mapping of UI setting keys to server parameter keys, for the sync service. */
export const SYNCABLE_PARAMETERS: SyncableParameter[] = SETTINGS_REGISTRY.flatMap(
(section) => section.settings
)
.filter((s) => s.sync !== undefined)
.map((s) => ({
canSync: true,
key: s.key,
serverKey: s.sync!.serverKey,
type: s.sync!.paramType
}));
@@ -6,11 +6,23 @@
* No reactive state; consumed by settingsStore.
*/
import { SETTINGS_KEYS, SYNCABLE_PARAMETERS } from '$lib/constants';
import { SETTINGS_KEYS, SETTINGS_REGISTRY } from '$lib/constants';
import { ParameterSource, SyncableParameterType } from '$lib/enums';
import type { ParameterInfo, ParameterRecord, ParameterValue } from '$lib/types';
import type { ParameterInfo, ParameterRecord, ParameterValue, SyncableParameter } from '$lib/types';
import { normalizeFloatingPoint } from '$lib/utils';
/** Mapping of UI setting keys to server parameter keys, derived from the registry. */
export const SYNCABLE_PARAMETERS: SyncableParameter[] = SETTINGS_REGISTRY.flatMap(
(section) => section.settings
)
.filter((s) => s.sync !== undefined)
.map((s) => ({
canSync: true,
key: s.key,
serverKey: s.sync!.serverKey,
type: s.sync!.paramType
}));
export class ParameterSyncService {
/**
* Check if a parameter can be synced from server.