alinea
Version:
[](https://npmjs.org/package/alinea) [](https://packagephobia.com/result?p=alinea)
48 lines (47 loc) • 2.03 kB
TypeScript
import { Config } from './Config.js';
import { Connection } from './Connection.js';
import { PageSeed } from './Page.js';
import { Root } from './Root.js';
import { Schema } from './Schema.js';
import { Type } from './Type.js';
import { Workspace } from './Workspace.js';
import { Cursor } from './pages/Cursor.js';
import { Projection } from './pages/Projection.js';
import { Selection } from './pages/Selection.js';
export type Location = Root | Workspace | PageSeed;
export interface GraphRealmApi {
in(location: Location): GraphRealmApi;
locale(locale: string): GraphRealmApi;
maybeGet<S extends Projection | Type>(select: S): Promise<Projection.InferOne<S> | null>;
get<S extends Projection | Type>(select: S): Promise<Projection.InferOne<S>>;
find<S extends Projection | Type>(select: S): Promise<Selection.Infer<S>>;
count(cursor: Cursor.Find<any>): Promise<number>;
}
export interface GraphOrigin {
location?: Location;
locale?: string;
}
export declare class GraphRealm implements GraphRealmApi {
protected config: Config;
private resolve;
private origin;
targets: Schema.Targets;
constructor(config: Config, resolve: (params: Connection.ResolveParams) => Promise<unknown>, origin?: GraphOrigin);
in(location: Location): GraphRealmApi;
locale(locale: string): GraphRealm;
maybeGet<S extends Projection | Type>(select: S): Promise<Projection.InferOne<S> | null>;
get<S extends Projection | Type>(select: S): Promise<Projection.InferOne<S>>;
find<S extends Projection | Type>(select: S): Promise<Selection.Infer<S>>;
count(cursor: Cursor.Find<any>): Promise<number>;
}
export declare class Graph {
config: Config;
resolve: (params: Connection.ResolveParams) => Promise<unknown>;
drafts: GraphRealm;
archived: GraphRealm;
published: GraphRealm;
preferPublished: GraphRealm;
preferDraft: GraphRealm;
all: GraphRealm;
constructor(config: Config, resolve: (params: Connection.ResolveParams) => Promise<unknown>);
}