@platform/cell.schema
Version:
URI and database schemas for the `cell.os`.
63 lines (62 loc) • 2.31 kB
TypeScript
import { t, hash, coord, Mime } from '../common';
import { FileSchema } from '../File';
import { RefSchema } from '../Ref';
import { Uri } from '../Uri';
import { Urls } from '../Url';
export declare class Schema {
static mime: typeof Mime;
static uri: typeof Uri;
static file: typeof FileSchema;
static ref: typeof RefSchema;
static cuid: () => string;
static slug: () => string;
static hash: typeof hash;
static coord: typeof coord;
static Urls: typeof Urls;
static urls: (host: string | number) => t.IUrls;
static ns: (id: string) => NsSchema;
static query: {
cells: string;
rows: string;
columns: string;
files: string;
};
static from: {
ns(input: string | t.IModel<t.INs, t.INs, t.IDbModelNsLinks, t.IDbModelNsChildren>): t.SchemaType<t.INsUri>;
cell(input: string | t.IModel<t.ICellData<t.ICellProps>, t.IDbModelCellDoc<{}>, t.IDbModelCellLinks, t.IDbModelCellChilden>): t.SchemaType<t.ICellUri>;
row(input: string | t.IModel<t.IRowData<t.IRowProps>, t.IRowData<t.IRowProps>, t.IDbModelRowLinks, t.IDbModelRowChildren>): t.SchemaType<t.IRowUri>;
column(input: string | t.IModel<t.IColumnData<t.IColumnProps>, t.IColumnData<t.IColumnProps>, t.IDbModelColumnLinks, t.IDbModelColumnChildren>): t.SchemaType<t.IColumnUri>;
file(input: string | t.IModel<t.IFileData, t.IFileData, t.IDbModelFileLinks, t.IDbModelFileChildren>): t.SchemaType<t.IFileUri>;
};
}
export declare class NsSchema {
readonly id: string;
readonly path: string;
readonly uri: string;
constructor(args: {
id: string;
});
cell(key: string): CoordSchema<t.ICellUri>;
column(key: string): CoordSchema<t.IColumnUri>;
row(key: string): CoordSchema<t.IRowUri>;
file(fileid: string): FileSchema;
static uri(args: {
path: string;
}): string;
}
export declare class CoordSchema<T extends t.ICellUri | t.IRowUri | t.IColumnUri> {
static uri(args: {
path: string;
}): string;
constructor(args: {
type: t.SchemaCoordType;
nsPath: string;
id: string;
uri: string;
});
readonly type: t.SchemaCoordType;
readonly id: string;
readonly path: string;
private readonly _uri;
get uri(): T;
}