import type * as Duration from 'effect/Duration'; import * as Effect from 'effect/Effect'; import * as Option from 'effect/Option'; import * as GraphBuilder from './AppGraphBuilder.ts'; /** * A single `(prefix, id?)` pair as parsed by `@dxos/app-toolkit`'s `UrlPath.parse`. Kept as a * plain structural type here (rather than importing `UrlPath.Pair`) because app-graph must not * depend on app-toolkit. */ export type UrlPair = { key: string; id?: string; workspace: string; }; /** * A resolved pair: the index it occupied in the parsed chain, and the qualified graph node id it * resolved to. `null` in the caller's result array means the pair didn't resolve (unknown key or * no matching node); how an unresolved pair is surfaced is the caller's concern. */ export type ResolvedPair = { pairIndex: number; nodeId: string; }; /** * One pair's outcome. Exactly one of `nodeId`/`candidateId` is set — `candidateId` is the id the node * *would* have, so callers can keep addressing an unresolved pair by what it asked for. A pair with * no candidate at all (an unknown key) is `null`. */ export type PairResolution = { pairIndex: number; nodeId?: string; candidateId?: string; }; /** The graph-path representation of a node, the reverse of a `UrlPair` (`id` is absent for singleton keys). */ export type RepresentedNode = { key: string; id?: string; workspace: string; }; /** * A single registered URL prefix key, in the shape `UrlPath.parse` expects. Kept as a plain * structural type here (rather than importing `UrlPath.KeyTableEntry`) because app-graph must not * depend on app-toolkit. */ export type UrlKeyTableEntry = { key: string; hasId: boolean; anchor: boolean; }; /** * Build the `urlKey -> { key, hasId }` table consumed by `UrlPath.parse`, straight from the * builder's current `urlKey`/`urlKeyHasId` declarations — the "registration, not parser" property * the URL grammar requires. Callers (the layout url-handler) pass this to `UrlPath.parse` * to tokenize a pathname into a pair chain. */ export declare const buildUrlKeyTable: (builder: GraphBuilder.GraphBuilder) => Map; /** * Resolve a parsed URL's pair chain to graph node ids, walking left to right. Resolution is fully * explicit — each binding's shape names its candidate (a resolver locates data-dependent ones); there is * no generic search. {@link representNode} is the reverse. * * An unknown key, or a key whose extension produces no matching node, yields `null` at that index; * how a `null` is surfaced is the caller's concern. A linked pair resolves against the *preceding * item's* node, not the raw preceding pair. */ export type ResolveUrlOptions = { /** * How long to wait for a pair's candidate node to materialize, by pair index. Per-pair because * the answer differs: a pair whose object is known to exist is merely late, while one nothing * vouches for is absent and must not hold up the restore. Return `undefined` to read immediately. */ readonly wait?: (pairIndex: number) => Duration.Input | undefined; }; export declare const resolveUrl: (builder: GraphBuilder.GraphBuilder, parsed: { workspace: string; pairs: ReadonlyArray; }, options?: ResolveUrlOptions) => Effect.Effect>; /** * Reverse-map a graph node id back to its `(key, id?, workspace)` representation, the inverse of * `resolveUrl`. A linked node (a `` segment) maps to the grammar's `linked` key with the * variant as its id. Any other node maps through the most specific binding whose shape addresses its id, * so the answer is the same whether or not the node is loaded; an id no binding addresses returns * `Option.none()`. */ export declare const representNode: (builder: GraphBuilder.GraphBuilder, nodeId: string) => Option.Option; //# sourceMappingURL=path-resolution.d.ts.map