@platform/cell.typesystem
Version:
The 'strongly typed sheets' system of the CellOS.
62 lines (61 loc) • 2.09 kB
TypeScript
import { Observable, Subject } from 'rxjs';
import { t } from './common';
import { TypedSheetState } from './TypedSheetState';
export declare class TypedSheet<T = Record<string, unknown>> implements t.ITypedSheet<T> {
static client: (client: t.IHttpClient) => {
load: <T_1>(ns: string | t.INsUri) => Promise<t.ITypedSheet<T_1>>;
};
static ctx(args: {
fetch: t.ISheetFetcher;
cache?: t.IMemoryCache;
event$?: Subject<t.TypedSheetEvent>;
dispose$?: Observable<void>;
pool?: t.ISheetPool;
}): t.SheetCtx;
static load<T>(args: {
fetch: t.ISheetFetcher;
ns: string | t.INsUri;
cache?: t.IMemoryCache;
event$?: Subject<t.TypedSheetEvent>;
pool?: t.ISheetPool;
}): Promise<t.ITypedSheet<T>>;
static create<T = Record<string, unknown>>(args: {
fetch: t.ISheetFetcher;
implements: string | t.INsUri;
ns?: string | t.INsUri;
cache?: t.IMemoryCache;
event$?: Subject<t.TypedSheetEvent>;
pool?: t.ISheetPool;
}): Promise<t.ITypedSheet<T>>;
private constructor();
dispose(): void;
private readonly _ctx;
private readonly _errorList;
private readonly _dispose$;
private readonly _typeDefs;
private _types;
private _data;
readonly uri: t.INsUri;
readonly implements: t.INsUri;
readonly state: TypedSheetState;
readonly pool: t.ISheetPool;
readonly dispose$: Observable<void>;
readonly event$: Observable<t.TypedSheetEvent>;
get isDisposed(): boolean;
get ok(): boolean;
get errors(): t.ITypeError[];
get changes(): t.ITypedSheetChanges;
get types(): {
typename: string;
columns: t.IColumnTypeDef<t.IType>[];
}[];
toString(): string;
info<P extends t.INsProps = t.INsProps>(): Promise<{
exists: boolean;
ns: P;
}>;
data<K extends keyof T>(input: K | t.ITypedSheetDataArgs<T, K>): t.ITypedSheetData<T, K>;
change(changes: t.ITypedSheetChanges): this;
private throwIfDisposed;
private isThisNamespace;
}