22 lines
689 B
TypeScript
22 lines
689 B
TypeScript
|
|
/**
|
||
|
|
* Loader for chain_roles.yaml dictionary config.
|
||
|
|
*/
|
||
|
|
|
||
|
|
import type { App } from "obsidian";
|
||
|
|
import { DictionaryLoader } from "./DictionaryLoader";
|
||
|
|
import { parseChainRoles } from "./parseChainRoles";
|
||
|
|
import type { ChainRolesConfig, DictionaryLoadResult } from "./types";
|
||
|
|
|
||
|
|
export class ChainRolesLoader {
|
||
|
|
/**
|
||
|
|
* Load chain roles config with last-known-good fallback.
|
||
|
|
*/
|
||
|
|
static async load(
|
||
|
|
app: App,
|
||
|
|
vaultRelativePath: string,
|
||
|
|
lastKnownGood: { data: ChainRolesConfig | null; loadedAt: number | null } | null = null
|
||
|
|
): Promise<DictionaryLoadResult<ChainRolesConfig>> {
|
||
|
|
return DictionaryLoader.load(app, vaultRelativePath, parseChainRoles, lastKnownGood);
|
||
|
|
}
|
||
|
|
}
|