git-documentdb
Version:
Offline-first database that syncs with Git
66 lines • 2.17 kB
TypeScript
/**
* GitDocumentDB
* Copyright (c) Hidekazu Kubota
*
* This source code is licensed under the Mozilla Public License Version 2.0
* found in the LICENSE file in the root directory of this source tree.
*/
import { ReadCommitResult } from 'isomorphic-git';
import { DocMetadata, NormalizedCommit, SerializeFormat } from './types';
/**
* @internal
*/
export declare function sleep(msec: number): Promise<unknown>;
/**
* utf8decode
*
* @internal
*/
export declare function utf8decode(uint8array: Uint8Array): string;
/**
* utf8encode
*
* @internal
*/
export declare function utf8encode(utf8: string): Uint8Array;
/**
* Returns JSON string which properties are sorted.
* The sorting follows the UTF-16 (Number < Uppercase < Lowercase), except that heading underscore _ is the last.
* Its indent is 2.
*
* NOTE: Heading underscore cannot be the first because replacing '\uffff' with '\u0000' does not effect to sorting order.
*
*/
export declare function toSortedJSONString(obj: Record<string, any>): string;
export declare function toYAML(obj: Record<string, any>): string;
export declare function toFrontMatterMarkdown(obj: Record<string, any>): string;
/**
* Get metadata of all files from current Git index
*
* @internal
*/
export declare function getAllMetadata(workingDir: string, serializeFormat: SerializeFormat): Promise<DocMetadata[]>;
/**
* Get normalized commit
*/
export declare function normalizeCommit(commit: ReadCommitResult): NormalizedCommit;
/**
* Template literal tag for console style
* https://bluesock.org/~willkg/dev/ansi.html#ansicodes
*
* @internal
*/
declare class ConsoleStyleClass {
private _style;
constructor(style?: string);
tag: () => (literals: TemplateStringsArray, ...placeholders: any[]) => string;
fgBlack: () => ConsoleStyleClass;
bgWhite: () => ConsoleStyleClass;
fgRed: () => ConsoleStyleClass;
bgRed: () => ConsoleStyleClass;
bgGreen: () => ConsoleStyleClass;
bgYellow: () => ConsoleStyleClass;
}
export declare const CONSOLE_STYLE: ConsoleStyleClass;
export {};
//# sourceMappingURL=utils.d.ts.map