1 | import { t } from '../common';
|
2 | declare type UriType = 'NS' | 'CELL' | 'ROW' | 'COLUMN' | 'FILE';
|
3 | declare type AllowPattern = string | ((input: string) => boolean);
|
4 | declare type Allow = {
|
5 | NS: AllowPattern[];
|
6 | };
|
7 | declare type P<T extends t.IUri> = (parsed: t.IUriParts<T>) => void;
|
8 | export declare const DEFAULT: {
|
9 | ALLOW: Allow;
|
10 | };
|
11 | export declare class Uri {
|
12 | static cuid: () => string;
|
13 | static slug: () => string;
|
14 | static ALLOW: {
|
15 | NS: AllowPattern[];
|
16 | };
|
17 | static create: {
|
18 | ns: (id: string) => string;
|
19 | cell: (ns: string, key: string) => string;
|
20 | row: (ns: string, key: string) => string;
|
21 | column: (ns: string, key: string) => string;
|
22 | file: (ns: string, fileid: string) => string;
|
23 | };
|
24 | static clean(input?: string): string;
|
25 | static parse<D extends t.IUri>(input?: string): t.IUriParts<D>;
|
26 | static ns(input?: string | t.INsUri | undefined, throwError?: boolean | P<t.INsUri>): t.INsUri;
|
27 | static cell(input: string | t.ICellUri | undefined, throwError?: boolean | P<t.ICellUri>): t.ICellUri;
|
28 | static row(input: string | t.IRowUri | undefined, throwError?: boolean | P<t.IRowUri>): t.IRowUri;
|
29 | static column(input: string | t.IColumnUri | undefined, throwError?: boolean | P<t.IColumnUri>): t.IColumnUri;
|
30 | static file(input: string | t.IFileUri | undefined, throwError?: boolean | P<t.IFileUri>): t.IFileUri;
|
31 | static eq(a?: t.IUri | string, b?: t.IUri | string): boolean;
|
32 | static is: {
|
33 | uri: (input?: string | undefined) => boolean;
|
34 | type: (type: t.UriType | t.UriType[], input?: string | undefined) => boolean;
|
35 | ns: (input?: string | undefined) => boolean;
|
36 | file: (input?: string | undefined) => boolean;
|
37 | cell: (input?: string | undefined) => boolean;
|
38 | row: (input?: string | undefined) => boolean;
|
39 | column: (input?: string | undefined) => boolean;
|
40 | valid: {
|
41 | ns(input?: string | undefined): boolean;
|
42 | };
|
43 | };
|
44 | static strip: {
|
45 | ns: (input?: string | undefined) => string;
|
46 | cell: (input?: string | undefined) => string;
|
47 | file: (input?: string | undefined) => string;
|
48 | };
|
49 | static toNs(input?: string | t.IUri): t.INsUri;
|
50 | static toRowIndex(input?: string | t.IUri): number;
|
51 | static toColumnIndex(input?: string | t.IUri): number;
|
52 | }
|
53 | export {};
|