-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for ordering on $select clauses in aggregations (#393)
* Add OrderedAggregationClause with foo:bar properties * Update part of aggregate.test.ts Change the Exclude in the part to use keyof * Factor out ValidAggregationKeys * Update AggregationResultsWithoutGroups to handle new syntax - Replace AggregatableKeys | with ValidAggregationKeys * Move ValidAggregationKeys to AggregatableKeys.ts * Revert adding keyof to the Exclude in AOThatErrors * Add OrderedAggregateOpts to the union * Disallow ordered $select with multiple $groupBy in the type system This was done by wrapping the `AggregateOptionsThatErrors` in another `AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy` type. This also inadvertently fixed the broken aggregate.test.ts file. This makes no sense. Adding another layer somehow helped TypeScript correctly infer the original type again? * Update modernToLegacyAggregationClause to handle new format * Expect TS errors in legacyToModernSingleAggregationResult Fix later * Migrate AggregationsResults.test.ts to new syntax * Migrate more files to new syntax * Treat decimal and long as numeric properties instead of string properties * Remove long comment in aggregate.test.ts The issue the comment was describing was fixed in f1ca1e1. * Test mock request body for aggregate without grouping * Add orderBy with and without groupBy tests * Allow ordered select with empty groupBy * Add test for type errors in the case of multiple groupBys - no ordering on select allowed * Don't export AggregateOptsThatErrors * Revert "Expect TS errors in legacyToModernSingleAggregationResult" This reverts commit 519fd7b. * Restrict the types in legacyToModernSingleAggregationResult.ts as much as I can Leaving as is - it doesn't seem any worse than before this PR. * Rename k, v in modernToLegacyAggClause * Reorder fields in modernToLegacyAggClause to be consistent (micro-optimization) * Replace infer _ with string in AggResultsWOGroups * Fix broken tests after the order of fields was changed * Refactor AggregationResultsWithoutGroups with helper types * Remove AggregationCountResult type * Refactor test setup into a beforeEach * Add changeset * Use beforeAll instead of beforeEach in aggregate.test.ts * Remove outdated comment
- Loading branch information
1 parent
7adf5c7
commit 02c65c5
Showing
23 changed files
with
474 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@osdk/client": minor | ||
--- | ||
|
||
Rework $select syntax in aggregations to add support for ordering by metrics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.