signalk-server
Version:
An implementation of a [Signal K](http://signalk.org) server for boats.
50 lines • 2.29 kB
TypeScript
export declare const PRIORITIES_KEYS: readonly ["priorityGroups", "priorityOverrides", "priorityDefaults", "sourceAliases", "ignoredInstanceConflicts"];
export type PrioritiesKey = (typeof PRIORITIES_KEYS)[number];
type Settings = Record<string, any>;
interface MigrationApp {
config: {
configPath: string;
settings: Settings;
};
argv?: any;
}
export declare function getPrioritiesFilePath(app: MigrationApp): string;
/**
* Merge stored priorities into in-memory settings. When a priorities.json
* exists on disk, its values take precedence over whatever happened to be
* in settings.json (because settings.json might still carry stale copies
* left over from an older install). When it does not exist yet, leave
* settings alone — the migration step below is responsible for creating
* it.
*/
export declare function loadPrioritiesIntoSettings(app: MigrationApp): void;
/**
* One-shot migration from settings.json to priorities.json. Called at
* server start after settings are loaded. If the separate file does not
* exist yet but settings.json has any priority keys, copy them over and
* strip them from settings. The caller is responsible for persisting the
* stripped settings.json — we only mutate in-memory state and write the
* new priorities.json.
*
* Returns true if settings.json changed and should be written out.
*/
export declare function migratePrioritiesIntoSeparateFile(app: MigrationApp): boolean;
/**
* Extract the priority-related keys from a settings object, returning a
* shallow copy of the remaining settings. Used by writeSettingsFile so
* the on-disk settings.json never carries priority state.
*/
export declare function splitPrioritiesFromSettings(settings: Settings): {
settingsWithoutPriorities: Settings;
priorities: Settings;
};
export declare function writePrioritiesFile(app: MigrationApp, priorities: Settings): Promise<void>;
/**
* Wipe priority state: remove the file and reset in-memory keys to
* empty/undefined. After this call, the caller should also persist
* settings.json (in case it still had priority keys — shouldn't, but
* cheap to be safe).
*/
export declare function resetPriorities(app: MigrationApp): Promise<void>;
export {};
//# sourceMappingURL=priorities-file.d.ts.map