From cf24efbeafb35ffc457fcc297bdfc18e98965c4e Mon Sep 17 00:00:00 2001 From: Saurav Date: Wed, 20 Nov 2024 08:40:15 -0500 Subject: [PATCH 1/4] use new types --- packages/api/src/aggregate/GeoFilter.ts | 2 +- packages/api/src/index.ts | 1 + .../internal/conversions/modernToLegacyWhereClause.ts | 9 ++++----- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/api/src/aggregate/GeoFilter.ts b/packages/api/src/aggregate/GeoFilter.ts index c9cb06d76..1aa1a4f55 100644 --- a/packages/api/src/aggregate/GeoFilter.ts +++ b/packages/api/src/aggregate/GeoFilter.ts @@ -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]; diff --git a/packages/api/src/index.ts b/packages/api/src/index.ts index 690d7a1c8..1c68eac6b 100644 --- a/packages/api/src/index.ts +++ b/packages/api/src/index.ts @@ -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, diff --git a/packages/client/src/internal/conversions/modernToLegacyWhereClause.ts b/packages/client/src/internal/conversions/modernToLegacyWhereClause.ts index 82cd1b09d..b11f7af76 100644 --- a/packages/client/src/internal/conversions/modernToLegacyWhereClause.ts +++ b/packages/client/src/internal/conversions/modernToLegacyWhereClause.ts @@ -15,12 +15,12 @@ */ import type { - GeoFilter_Intersects, - GeoFilter_Within, + GeoFilterOptions, ObjectOrInterfaceDefinition, PossibleWhereClauseFilters, WhereClause, } from "@osdk/api"; + import { DistanceUnitMapping } from "@osdk/api"; import type { SearchJsonQueryV2 } from "@osdk/internal.foundry.core"; @@ -182,7 +182,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); @@ -217,8 +217,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) { From 8d23b985e38eb07d60315040dc5430e7e671daf2 Mon Sep 17 00:00:00 2001 From: Saurav Date: Wed, 20 Nov 2024 08:41:36 -0500 Subject: [PATCH 2/4] remove new line --- .../client/src/internal/conversions/modernToLegacyWhereClause.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/client/src/internal/conversions/modernToLegacyWhereClause.ts b/packages/client/src/internal/conversions/modernToLegacyWhereClause.ts index b11f7af76..7573e3e1d 100644 --- a/packages/client/src/internal/conversions/modernToLegacyWhereClause.ts +++ b/packages/client/src/internal/conversions/modernToLegacyWhereClause.ts @@ -20,7 +20,6 @@ import type { PossibleWhereClauseFilters, WhereClause, } from "@osdk/api"; - import { DistanceUnitMapping } from "@osdk/api"; import type { SearchJsonQueryV2 } from "@osdk/internal.foundry.core"; From cba90e2019717def5e058bf4e5c18934a261b994 Mon Sep 17 00:00:00 2001 From: Saurav Date: Wed, 20 Nov 2024 08:42:46 -0500 Subject: [PATCH 3/4] add changeset --- .changeset/popular-ducks-rush.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/popular-ducks-rush.md diff --git a/.changeset/popular-ducks-rush.md b/.changeset/popular-ducks-rush.md new file mode 100644 index 000000000..e02bd304c --- /dev/null +++ b/.changeset/popular-ducks-rush.md @@ -0,0 +1,6 @@ +--- +"@osdk/client": patch +"@osdk/api": patch +--- + +Cleaning up where clause types. From 2cdb481c7ae2796f7bdc15e8c6b49b4ee3336102 Mon Sep 17 00:00:00 2001 From: Saurav Date: Thu, 21 Nov 2024 10:34:27 -0500 Subject: [PATCH 4/4] add report --- etc/api.report.api.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/etc/api.report.api.md b/etc/api.report.api.md index c41d214be..3a0426df5 100644 --- a/etc/api.report.api.md +++ b/etc/api.report.api.md @@ -432,6 +432,37 @@ export type GeoFilter_Within = { } | Polygon; }; +// @public (undocumented) +export interface GeoFilterOptions { + // (undocumented) + "$intersects": { + $bbox: BBox; + $polygon?: never; + } | BBox | { + $polygon: Polygon["coordinates"]; + $bbox?: never; + } | Polygon; + // (undocumented) + "$isNull": boolean; + // (undocumented) + "$within": { + $distance: [number, keyof typeof DistanceUnitMapping]; + $of: [number, number] | Readonly; + $bbox?: never; + $polygon?: never; + } | { + $bbox: BBox; + $distance?: never; + $of?: never; + $polygon?: never; + } | BBox | { + $polygon: Polygon["coordinates"]; + $bbox?: never; + $distance?: never; + $of?: never; + } | Polygon; +} + // @public (undocumented) export interface GeotimeSeriesProperty { // Warning: (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@"