///
declare type config = {
mainFolder?: string,
indexFile?: string,
taskFolder?: string,
archiveFolder?: string,
defaultBoard?: string,
boards?: {
exclude?: string[],
order?: string[],
[slug: string]: any
}
};
declare type board = {
slug: string,
path: string,
name: string,
description: string,
main: boolean
};
declare type boardSummary = board & {
columns: number,
tasks: number,
completed: number,
completedPercentage: number,
modified: Date | null
};
declare type columnContentEntry = {
position: number,
text: string,
raw: string,
block?: boolean
};
declare type index = {
name: string,
description: string,
options: Record,
columns: Record,
// Lines in a column that aren't task links. Preserved verbatim and ignored by everything else
columnContent?: Record
};
declare type missingTaskFile = {
task: string,
column: string
};
declare type simpleTask = {
column: string,
position: number,
text: string,
raw: string
};
declare type columnContentWarning = {
board: string,
column: string,
type: 'non-task-line' | 'untracked-task-line' | 'malformed-task-link',
text: string,
message: string
};
declare type subTask = {
text: string,
completed: boolean
};
declare type relation = {
task: string,
type: string
};
declare type comment = {
text: string,
author: string,
date: Date
};
declare type task = {
id: string,
name: string,
description: string,
metadata: Record,
subTasks: subTask[],
relations: relation[],
comments: comment[],
column?: string,
workload?: number,
progress?: number,
remainingWorkload?: number,
due?: Record
};
declare type status = {
tasks: number,
columnTasks: Record,
startedTasks?: number,
completedTasks?: number
};
declare type sprint = {
start: Date,
name: string,
description?: string
};
declare type contributor = {
name: string,
displayName: string,
aliases: string[],
email?: string,
colour?: string
};
declare type contributorSpelling = {
value: string,
assigned: number,
comments: number,
tasks: string[]
};
declare type contributorUsage = {
contributors: (contributor & {
assigned: number,
comments: number,
tasks: number,
spellings: contributorSpelling[]
})[],
unknown: contributorSpelling[]
};
declare type contributorWarning = {
task: string,
type: 'unknown-contributor',
value: string,
message: string
};
declare type actionRule = {
name?: string,
on: string,
when?: Record,
for?: {
related?: string,
direction?: 'incoming' | 'outgoing',
where?: Record
},
anyBoard?: boolean,
then: Record[]
};
declare type actionWarning = {
type: 'conflicting-actions' | 'unresolvable-user',
message: string
};
export class Kanbn {
constructor(root?: any, options?: { board?: string, caches?: any, actions?: boolean });
ROOT: string;
CONFIG_YAML: string;
CONFIG_JSON: string;
configMemo: any;
/**
* The board this instance is scoped to, or null for the main board
*/
boardSlug: string | null;
/**
* Rules that were skipped during the last operation, for the caller to report
*/
lastActionWarnings: string[];
/**
* Whether scripted actions run for operations on this instance
*/
actionsEnabled: boolean;
/**
* Get an instance that runs no actions
*/
withoutActions(): Kanbn;
/**
* Get the action rules that apply to this board
*/
getActionRules(index?: index | null): Promise;
/**
* Check whether actions should run at all
*/
actionsAllowed(): boolean;
/**
* Find things about this board's action rules that are legal but probably not what the author meant
*/
findActionWarnings(): Promise;
/**
* Get a copy of this instance scoped to another board, sharing this one's cached config
* @param {?string} [slug=null] The board slug, or null/"main"/"default" for the main board
*/
board(slug?: string | null): Kanbn;
/**
* Alias for board()
*/
withBoard(slug?: string | null): Kanbn;
/**
* Check if a separate config file exists
* @returns {Promise} True if a config file exists
*/
configExists(): Promise;
/**
* Save configuration data to a separate config file
*/
saveConfig(config: any): Promise;
/**
* Get configuration settings from the config file if it exists, otherwise return null
* @return {Promise