Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up where clause types #991

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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 packages/api/src/aggregate/GeoFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type { BBox, Point, Polygon } from "geojson";
import type { Just } from "./Just.js";
import type { DistanceUnitMapping } from "./WhereClause.js";

interface GeoFilterOptions {
export interface GeoFilterOptions {
"$within":
| {
$distance: [number, keyof typeof DistanceUnitMapping];
Expand Down
1 change: 1 addition & 0 deletions packages/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export type { AggregationResultsWithGroups } from "./aggregate/AggregationResult
export type { AggregationResultsWithoutGroups } from "./aggregate/AggregationResultsWithoutGroups.js";
export type { AggregationClause } from "./aggregate/AggregationsClause.js";
export type { AggregationsResults } from "./aggregate/AggregationsResults.js";
export type { GeoFilterOptions } from "./aggregate/GeoFilter.js";
export { DistanceUnitMapping } from "./aggregate/WhereClause.js";
export type {
GeoFilter_Intersects,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
*/

import type {
GeoFilter_Intersects,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot remove these two types from api package because that would be a break

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So why can we remove them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait I didn't remove them from the api package exports? Just removed our use of it internally here

GeoFilter_Within,
GeoFilterOptions,
ObjectOrInterfaceDefinition,
PossibleWhereClauseFilters,
WhereClause,
Expand Down Expand Up @@ -182,7 +181,7 @@ function handleWherePair(
}

if (firstKey === "$within") {
const withinBody = filter[firstKey] as GeoFilter_Within["$within"];
const withinBody = filter[firstKey] as GeoFilterOptions["$within"];

if (Array.isArray(withinBody)) {
return makeGeoFilterBbox(field, withinBody, firstKey);
Expand Down Expand Up @@ -217,8 +216,7 @@ function handleWherePair(
}
}
if (firstKey === "$intersects") {
const intersectsBody =
filter[firstKey] as GeoFilter_Intersects["$intersects"];
const intersectsBody = filter[firstKey] as GeoFilterOptions["$intersects"];
if (Array.isArray(intersectsBody)) {
return makeGeoFilterBbox(field, intersectsBody, firstKey);
} else if ("$bbox" in intersectsBody && intersectsBody.$bbox != null) {
Expand Down
Loading