src / constants.ts
/** OneNote COM constants (ported from local-onenote-mcp's constants.py). */
export const ONE_NS = "http://schemas.microsoft.com/office/onenote/2013/onenote";
export const XML_SCHEMA_2013 = 2;
export const HIERARCHY_SCOPES: Record<string, number> = {
self: 0,
children: 1,
notebooks: 2,
sections: 3,
pages: 4,
};
export const CREATE_FILE_TYPES: Record<string, number> = {
none: 0,
notebook: 1,
folder: 2,
section_group: 2,
section: 3,
};
export const NEW_PAGE_STYLES: Record<string, number> = {
default: 0,
blank_with_title: 1,
blank_no_title: 2,
};
export const PAGE_INFO: Record<string, number> = {
basic: 0,
binary: 1,
selection: 2,
binary_selection: 3,
file_type: 4,
binary_file_type: 5,
selection_file_type: 6,
all: 7,
};
export const PUBLISH_FORMATS: Record<string, number> = {
one: 0,
onepkg: 1,
mhtml: 2,
mht: 2,
pdf: 3,
xps: 4,
word: 5,
doc: 5,
docx: 5,
emf: 6,
html: 7,
one2007: 8,
};
export const SPECIAL_LOCATIONS: Record<string, number> = {
backup: 0,
unfiled: 1,
default_notebook_folder: 2,
};
export const FILING_LOCATIONS: Record<string, number> = {
email: 0,
contacts: 1,
tasks: 2,
meetings: 3,
web_content: 4,
printouts: 5,
};
export const FILING_LOCATION_TYPES: Record<string, number> = {
named_section_new_page: 0,
current_section_new_page: 1,
current_page: 2,
named_page: 4,
};
export function enumValue(name: string, value: string, options: Record<string, number>): number {
const key = value.toLowerCase();
if (!(key in options)) {
const allowed = Object.keys(options).sort().join(", ");
throw new Error(`${name} must be one of: ${allowed}`);
}
return options[key];
}