APIDemo

@alinea/core

/**
Accumulate all entries of an AsyncGenerator into an array */
export function accumulate<T>(
gen: AsyncGenerator<T, any, unknown>
): Promise<Array<T>>
export namespace Auth {
}
/**
Configuration options for the dashboard */
/**
Configuration options */
/**
Create a new config instance */
export function createConfig<T extends Workspaces>(
options: ConfigOptions<T>
): Config<T>
export function createError(
code: number
): ErrorWithCode
export function createError(
code: ErrorCode
): ErrorWithCode
export function createError(
message: string
): ErrorWithCode
export function createError(
code: number,
message: string
): ErrorWithCode
export function createError(
code: ErrorCode,
message: string
): ErrorWithCode
/**
Create a ksuid */
export function createId(): string
export function docFromEntry(
entry: Omit<Entry, "url" | "path" | "workspace" | "root" | "parent" | "parents" | "$status" | "$isContainer" | "i18n"> & {i18n: {id: string}} & {
[key extends string]: any
},
getType: {},
doc: Doc
): Doc
export namespace Entry {
}
export const Entry: Collection<Entry>
export function entryFromDoc(
doc: Doc,
getType: {}
): Entry
/**
*/
export namespace Field {
export function withView<V, M, Q, F extends Field<V, M, Q, F>, C extends {}>(
create: C,
view: FieldRenderer<V, M, F>
): C
}
export function future<T>(
promise: Promise<T>
): Future<T>
export namespace Hub {
export const routes:
{
draft(
id: string
): string
drafts(): string
entry(
id: string,
stateVector: Uint8Array
): string
files(
location: string
): string
publish(): string
query(): string
upload(): string
}
}
export function isError(
error: Error
): error is ErrorWithCode
export function isSeparator(
char: string
): boolean
export namespace Label {
}
export function Label(
data: Data
): {$label: Data}
export namespace Media {
export namespace File {
}
export const File: Collection<File>
export const Library: Collection<Entry>
export const imageExtensions: Array<string>
export function isImage(
path: string
): undefined | boolean | ""
}
export const outcome:
{}
&
{
fails<Run extends OutcomeRunner>(
run: OutcomeRunner
): OutcomeResult<Run>
succeeds<Run extends OutcomeRunner>(
run: OutcomeRunner
): OutcomeResult<Run>
}
export namespace Outcome {
export function Failure<T>(
error: any
): Outcome<T>
export function Success<T>(
data: T
): Outcome<T>
export function fromJSON<T>(
json: JSONRep<T>
): Outcome<T>
export function unpack<T>(
outcome: Outcome<T>
): T
}
/**
Parse a ksuid into a Date of creation and a Buffer containing the random bits */
export function parseId(
str: string
): readonly [Date, Buffer]
export namespace Reference {
}
export function renderLabel(
label: Label
): string
export function root<T>(
label: Label,
options: RootOptions<T>
): RootConfig<T>
export const ROOT_KEY: "#root"
/**
Create a schema, expects a string record of Type instances */
export function schema<Types extends LazyRecord<TypeConfig<any>>>(
types: Types
): SchemaConfig<TypeToEntry<TypeToRows<Types>>>
/**
Describes the different types of entries */
export const Search: Collection<Search>
export namespace Section {
export function from<T>(
input: Input<T>
): Section<T>
export function withView<T extends Section<any, T>, Factory extends {}>(
create: Factory,
view: ComponentType<{section: T, state: InputState<any>}>
): Factory
}
export namespace Shape {
export function List(
label: Label,
shapes: Record<string, RecordShape<any>>
): ListShape<any>
export function Record<T>(
label: Label,
shape: Record<string, Shape<any, any>>
): RecordShape<T>
export function RichText(
label: Label,
shapes: Record<string, RecordShape<any>>
): RichTextShape<any>
export function Scalar<T>(
label: Label
): ScalarShape<T>
}
export function slugify(
input: string,
separator: string
): string
export namespace TextNode {
}
export namespace Tree {
export function children(
id: EV<string>,
depth: number
): Cursor<Entry>
export function nextSibling(
id: EV<string>
): CursorSingleRow<Entry>
export function parent(
id: EV<string>
): Cursor<Entry>
export function parents(
id: EV<string>
): Cursor<Entry>
export function prevSibling(
id: EV<string>
): CursorSingleRow<Entry>
export function siblings(
id: EV<string>
): Cursor<Entry>
}
/**
Create a new type */
export function type<T extends Array<Input<any>>>(
label: Label,
sections: T
): TypeConfig<Section.FieldsOf<T[number]>>
/**
Describes the structure of an entry by their fields and type */
/**
Optional settings to configure a Type */
export function unreachable(
value: never
): never
export function view<T, S extends SelectionInput, Params extends any>(
selection: ViewSelection<T, S>,
component: ComponentType<Params>
): View<T, Params>
export namespace View {
export function getSelection<T>(
schema: Schema<any>,
summaryView: "summaryRow" | "summaryThumb",
collection: Collection<T>
): Record<string, SelectionInput>
}
/**
Create a workspace */
export function workspace<T>(
label: Label,
options: WorkspaceOptions<T>
): WorkspaceConfig<T>
/**
Use a workspace to divide content. It is possible to create internal links between workspaces. */
/**
A record of multiple named workspaces */