import * as Option from "effect/Option"; import * as Result from "effect/Result"; import * as QueryStreamKey from "./QueryStreamKey"; import * as QueryStreamKeyLayout from "./QueryStreamKeyLayout"; import * as QueryStreamKeyValues from "./QueryStreamKeyValues"; /** * One side of a range: a (possibly prefix) key and whether it's included. * * @experimental */ export interface KeyBound { readonly keyValues: QueryStreamKeyValues.QueryStreamKeyValues; readonly inclusive: boolean; } /** * Bounds over a stream's key, in _ascending key space_ (`narrow` converts from * stream space, where `desc` reverses which end is which). * * @experimental */ export interface KeyBounds { readonly lower: Option.Option; readonly upper: Option.Option; } /** * Bounds in _full index-key space_: `eq`-pinned values appear as a shared * prefix of both keys (`fromBounds` re-derives them as `eq` constraints). An * empty key bounds nothing. * * @experimental */ export interface IndexBounds { readonly lower: KeyBound; readonly upper: KeyBound; } /** * The stricter (later) of two lower bounds. * * @experimental */ export declare const tightestLower: (self: KeyBound, that: KeyBound) => KeyBound; /** * The stricter (earlier) of two upper bounds. * * @experimental */ export declare const tightestUpper: (self: KeyBound, that: KeyBound) => KeyBound; /** * @experimental */ export declare const intersect: (self: ParsedBounds, that: ParsedBounds) => Result.Result; /** * @experimental */ export declare const isEmpty: (indexBounds: IndexBounds) => boolean; /** * @experimental */ export declare const intersectIndexBounds: (self: IndexBounds, that: IndexBounds) => IndexBounds; /** * Whether a compatible key sits after the lower bound (always, when unbounded). * * @experimental */ export declare const admittedByLower: (parsedBounds: ParsedBounds) => (key: QueryStreamKey.Complete) => Result.Result; /** * Whether a compatible key sits before the upper bound (always, when * unbounded). * * @experimental */ export declare const admittedByUpper: (parsedBounds: ParsedBounds) => (key: QueryStreamKey.Complete) => Result.Result; /** * At least one endpoint in stream order. Omit the other to leave that side * unbounded. * * @experimental */ export type NarrowBounds = { readonly start: KeyBound; readonly end?: KeyBound | undefined; } | { readonly start?: KeyBound | undefined; readonly end: KeyBound; }; /** * @experimental */ export interface ParsedBound { readonly key: QueryStreamKey.Prefix; readonly inclusive: boolean; } declare const TypeId = "~@confect/server/QueryStreamKeyBounds"; /** * @experimental */ export interface ParsedBounds { readonly [TypeId]: typeof TypeId; readonly keyLayout: QueryStreamKeyLayout.QueryStreamKeyLayout; readonly lower: Option.Option; readonly upper: Option.Option; } /** * @experimental */ export declare const unbounded: (keyLayout: QueryStreamKeyLayout.QueryStreamKeyLayout) => ParsedBounds; /** * @experimental */ export declare const forLayout: (keyLayout: QueryStreamKeyLayout.QueryStreamKeyLayout, parsedBounds: ParsedBounds) => Result.Result; /** * @experimental */ export declare const fromParsed: (keyLayout: QueryStreamKeyLayout.QueryStreamKeyLayout, endpoints: Pick) => Result.Result; /** * @experimental */ export declare const tightestParsedLower: (self: ParsedBound, that: ParsedBound) => Result.Result; /** * @experimental */ export declare const tightestParsedUpper: (self: ParsedBound, that: ParsedBound) => Result.Result; /** * @experimental */ export declare const parseBound: (keyLayout: QueryStreamKeyLayout.QueryStreamKeyLayout, { keyValues, inclusive }: KeyBound) => Result.Result; /** * @experimental */ export declare const parse: (keyLayout: QueryStreamKeyLayout.QueryStreamKeyLayout, keyBounds: KeyBounds) => Result.Result; /** * @experimental */ export declare const toBounds: (parsedBounds: ParsedBounds) => KeyBounds; export {}; //# sourceMappingURL=QueryStreamKeyBounds.d.ts.map