From f9b97b9b6f4942f8e4dcc05ea1c25962f23f5373 Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Sun, 17 Apr 2022 16:43:41 +0200 Subject: [PATCH] feat(API): :sparkles: Add refreshIndex method (#369) --- src/API.ts | 3 +++ src/interfaces.ts | 17 ++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/API.ts b/src/API.ts index f2ba635a..4026e887 100644 --- a/src/API.ts +++ b/src/API.ts @@ -18,6 +18,7 @@ import { iterateHiers, } from "./Utils/HierUtils"; import { createIndex } from "./Commands/CreateIndex"; +import { refreshIndex } from "./refreshIndex"; export class BCAPI implements BCAPII { app: App; @@ -37,6 +38,8 @@ export class BCAPI implements BCAPII { public buildObsGraph = () => buildObsGraph(this.app); + public refreshIndex = async () => await refreshIndex(this.plugin) + public getSubInDirs = (dirs: Directions[], g = this.mainG) => getSubInDirs(g, ...dirs); diff --git a/src/interfaces.ts b/src/interfaces.ts index efc97de5..6614a32b 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -133,13 +133,13 @@ export type RawValue = export interface dvFrontmatterCache { file: TFile; [field: string]: - | string - | string[] - | string[][] - | dvLink - | dvLink[] - | Pos - | TFile; + | string + | string[] + | string[][] + | dvLink + | dvLink[] + | Pos + | TFile; } export type Directions = typeof DIRECTIONS[number]; @@ -352,6 +352,9 @@ export interface BCAPII { /** Build the obsidian graph as a graphology MultiGraph */ buildObsGraph: () => MultiGraph; + /** Refresh the Breadcrumb Index programmatically. */ + refreshIndex: () => Promise + /** * Return a subgraph of all nodes & edges with `dirs.includes(a.dir)` *