Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export type Item<K extends Key, ID extends string> = {
sumValue: number;
};

export type { Key, Bound };
export type { Key, Bound, Bounds };

/**
* Write data to be aggregated, and read aggregated data.
Expand Down
11 changes: 10 additions & 1 deletion src/client/positions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ export type TuplePrefix<

export type Bounds<K extends Key, ID extends string> =
| SideBounds<K, ID>
| (K extends unknown[]
? { prefix: TuplePrefix<Extract<K, unknown[]>> }
: never)
| {
prefix: TuplePrefix<Extract<K, unknown[]>>;
eq: K;
};

// IDs are strings so in the Convex ordering, null < IDs < arrays.
Expand Down Expand Up @@ -83,6 +86,12 @@ export function boundsToPositions<K extends Key, ID extends string>(
if (bounds === undefined) {
return {};
}
if ("eq" in bounds) {
return {
k1: boundToPosition("lower", { key: bounds.eq, inclusive: true }),
k2: boundToPosition("upper", { key: bounds.eq, inclusive: true }),
};
}
if ("prefix" in bounds) {
const prefix: Key[] = bounds.prefix;
const exploded: Key = [];
Expand Down
Loading