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

Remove where clause from aggregate #1135

Merged
merged 3 commits into from
Jan 29, 2025
Merged
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
6 changes: 6 additions & 0 deletions .changeset/wet-parents-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@osdk/client": patch
"@osdk/api": patch
---

Remove where clause from aggregate options. This option was never actually doing anything before as it was not passed to the backend for processing, so we are removing it to prevent future confusion.
6 changes: 2 additions & 4 deletions etc/api.report.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ export type ActionValidationResponse = ValidateActionResponseV2;
// @public (undocumented)
export type AggregateOpts<Q extends ObjectOrInterfaceDefinition> = {
$select: UnorderedAggregationClause<Q> | OrderedAggregationClause<Q>;
$where?: WhereClause<Q>;
$groupBy?: GroupByClause<Q>;
};

Expand All @@ -150,7 +149,6 @@ export type AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy<
> = SingleKeyObject<AO["$groupBy"]> extends never ? (AO["$select"] extends UnorderedAggregationClause<Q> ? AggregateOptsThatErrors<Q, AO> : {} extends AO["$groupBy"] ? AggregateOptsThatErrors<Q, AO> : {
$groupBy: AO["$groupBy"];
$select: UnorderedAggregationClause<Q>;
$where?: AO["$where"];
}) : AggregateOptsThatErrors<Q, AO>;

// @public (undocumented)
Expand Down Expand Up @@ -1113,8 +1111,8 @@ export type WirePropertyTypes = SimpleWirePropertyTypes | Record<string, SimpleW

// Warnings were encountered during analysis:
//
// build/types/aggregate/AggregateOpts.d.ts:6:2 - (ae-forgotten-export) The symbol "UnorderedAggregationClause" needs to be exported by the entry point index.d.ts
// build/types/aggregate/AggregateOpts.d.ts:6:2 - (ae-forgotten-export) The symbol "OrderedAggregationClause" needs to be exported by the entry point index.d.ts
// build/types/aggregate/AggregateOpts.d.ts:5:2 - (ae-forgotten-export) The symbol "UnorderedAggregationClause" needs to be exported by the entry point index.d.ts
// build/types/aggregate/AggregateOpts.d.ts:5:2 - (ae-forgotten-export) The symbol "OrderedAggregationClause" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)

Expand Down
2 changes: 0 additions & 2 deletions packages/api/src/aggregate/AggregateOpts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ import type {
OrderedAggregationClause,
UnorderedAggregationClause,
} from "./AggregationsClause.js";
import type { WhereClause } from "./WhereClause.js";

export type AggregateOpts<Q extends ObjectOrInterfaceDefinition> = {
$select:
| UnorderedAggregationClause<Q>
| OrderedAggregationClause<Q>;
$where?: WhereClause<Q>;
$groupBy?: GroupByClause<Q>;
};
1 change: 0 additions & 1 deletion packages/api/src/aggregate/AggregateOptsThatErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export type AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy<
: {
$groupBy: AO["$groupBy"];
$select: UnorderedAggregationClause<Q>;
$where?: AO["$where"];
}
)
: AggregateOptsThatErrors<Q, AO>;
Expand Down
5 changes: 1 addition & 4 deletions packages/client/src/object/aggregate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import invariant from "tiny-invariant";
import { legacyToModernSingleAggregationResult } from "../internal/conversions/legacyToModernSingleAggregationResult.js";
import { modernToLegacyAggregationClause } from "../internal/conversions/modernToLegacyAggregationClause.js";
import { modernToLegacyGroupByClause } from "../internal/conversions/modernToLegacyGroupByClause.js";
import { modernToLegacyWhereClause } from "../internal/conversions/modernToLegacyWhereClause.js";
import type { MinimalClient } from "../MinimalClientContext.js";
import { addUserAgentAndRequestContextHeaders } from "../util/addUserAgentAndRequestContextHeaders.js";
import type { ArrayElement } from "../util/ArrayElement.js";
Expand Down Expand Up @@ -59,9 +58,7 @@ export async function aggregate<
if (req.$groupBy) {
body.groupBy = modernToLegacyGroupByClause(req.$groupBy);
}
if (req.$where) {
body.where = modernToLegacyWhereClause(req.$where, objectType);
}

const result = await OntologiesV2.OntologyObjectSets.aggregate(
addUserAgentAndRequestContextHeaders(clientCtx, objectType),
await clientCtx.ontologyRid,
Expand Down
Loading