UNPKG

@platform/cell.schema

Version:

URI and database schemas for the `cell.os`.

55 lines (54 loc) 2.24 kB
import { t } from '../common'; declare type UriType = 'NS' | 'CELL' | 'ROW' | 'COLUMN' | 'FILE'; declare type AllowPattern = string | ((input: string) => boolean); declare type Allow = { NS: AllowPattern[]; }; declare type P<T extends t.IUri> = (parsed: t.IUriParts<T>) => void; export declare const DEFAULT: { ALLOW: Allow; }; export declare class Uri { static cuid: () => string; static slug: () => string; static ALLOW: { NS: AllowPattern[]; }; static create: { ns: (id: string) => string; cell: (ns: string, key: string) => string; row: (ns: string, key: string) => string; column: (ns: string, key: string) => string; file: (ns: string, fileid: string) => string; A1: () => string; }; static clean(input?: string): string; static parse<D extends t.IUri>(input?: string): t.IUriParts<D>; static ns(input?: string | t.INsUri | undefined, throwError?: boolean | P<t.INsUri>): t.INsUri; static cell(input: string | t.ICellUri | undefined, throwError?: boolean | P<t.ICellUri>): t.ICellUri; static row(input: string | t.IRowUri | undefined, throwError?: boolean | P<t.IRowUri>): t.IRowUri; static column(input: string | t.IColumnUri | undefined, throwError?: boolean | P<t.IColumnUri>): t.IColumnUri; static file(input: string | t.IFileUri | undefined, throwError?: boolean | P<t.IFileUri>): t.IFileUri; static eq(a?: t.IUri | string, b?: t.IUri | string): boolean; static is: { uri: (input?: string) => boolean; type: (type: t.UriType | t.UriType[], input?: string) => boolean; ns: (input?: string) => boolean; file: (input?: string) => boolean; cell: (input?: string) => boolean; row: (input?: string) => boolean; column: (input?: string) => boolean; valid: { ns(input?: string): boolean; }; }; static strip: { ns: (input?: string) => string; cell: (input?: string) => string; file: (input?: string) => string; }; static toNs(input?: string | t.IUri): t.INsUri; static toRowIndex(input?: string | t.IUri): number; static toColumnIndex(input?: string | t.IUri): number; } export {};