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

fix!: Remove unecessary exports, utilize core types instead of SynchroCharts #600

Merged
merged 1 commit into from
Feb 22, 2023

Conversation

diehbria
Copy link
Contributor

@diehbria diehbria commented Feb 21, 2023

Overview

This pull request cleans up the IoT App Kit APIs, untangling it from Synchro Charts. There is more work required to fully untangle IoT App Kit from Synchro Charts - but this PR takes major strides towards that direction.

Breaking Changes

  • Removed optional types yMin and yMax from Viewport type exported from @iot-app-kit/core
  • Updated TimeSeriesDataModule to utilize Viewport from @iot-app-kit/core instead of MinimalViewPortConfig from ‘@synchro-charts/core’
  • Updated TimeSeriesDataRequest type to refer to Viewport from @iot-app-kit/core instead of @synchro-charts/core
  • Removed exported mock widget properties from @iot-app-kit/core
  • Updated viewportManager to utilize Viewport from @iot-app-kit/core instead of @synchro-charts/core
  • Export the data types as DATA_TYPE constant from @iot-app-kit/core, instead of as a DataType enum.

Notable, non-breaking changes

  • Added new exports DurationViewport and HistoricalViewport from @iot-app-kit/core
  • Export Primitive, DataStreamid, Timestamp, StreamAssociation, and DataPoint from @iot-app-kit/core

Legal

This project is available under the Apache 2.0 License.

@tracy-french
Copy link
Contributor

What is the breaking change?

@diehbria
Copy link
Contributor Author

What is the breaking change?

Added to PR overview, will update commit message with a bit more detail for conventional commit generated change logs

@tracy-french
Copy link
Contributor

LGTM. No blockers to merge.

tracy-french
tracy-french previously approved these changes Feb 21, 2023
packages/react-components/src/utils/sort.ts Outdated Show resolved Hide resolved
@@ -26,5 +25,5 @@ export const round = (num: number): number => {
/**
* Checks if value can be used as a number
*/
export const isNumeric = (value: ThresholdDataTypes): boolean =>
export const isNumeric = (value: Primitive): boolean =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason why these predicates are not written as type predicates?

packages/core/src/common/predicates.ts Outdated Show resolved Hide resolved
Comment on lines -180 to +149
expect(isMinimalStaticViewport(viewport as unknown as MinimalLiveViewport)).toBeFalse();
expect(isHistoricalViewport({ start: new Date() } as unknown as DurationViewport)).toBeFalse();
});

it('returns false when the start date is missing', () => {
const viewport: Omit<MinimalStaticViewport, 'start'> = {
yMin: 0,
yMax: 10,
end: new Date(),
};

expect(isMinimalStaticViewport(viewport as unknown as MinimalLiveViewport)).toBeFalse();
expect(isHistoricalViewport({ end: new Date() } as unknown as DurationViewport)).toBeFalse();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these object literals cast as unknown? Looks like a hack?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is necessary because i'm passing invalid inputs into the utility function that don't adhere to the typescript types but open to other suggestions

…oChart types

BREAKING CHANGES:

* Removed optional types yMin and yMax from Viewport type exported from @iot-app-kit/core
* Updated TimeSeriesDataModule to utilize Viewport from @iot-app-kit/core instead of MinimalViewPortConfig from ‘@synchro-charts/core’
* Updated TimeSeriesDataRequest type to refer to Viewport from @iot-app-kit/core instead of @synchro-charts/core
* Removed exported mock widget properties from @iot-app-kit/core
* Updated viewportManager to utilize Viewport from @iot-app-kit/core instead of @synchro-charts/core
* Export the data types as DATA_TYPE constant from @iot-app-kit/core, instead of as a DataType enum.
@diehbria diehbria merged commit 15d6740 into main Feb 22, 2023
@diehbria diehbria deleted the remove-exports-2 branch February 22, 2023 17:14
@github-actions github-actions bot mentioned this pull request Feb 22, 2023
tjuranek pushed a commit that referenced this pull request Feb 22, 2023
…oChart types (#600)

BREAKING CHANGES:

* Removed optional types yMin and yMax from Viewport type exported from @iot-app-kit/core
* Updated TimeSeriesDataModule to utilize Viewport from @iot-app-kit/core instead of MinimalViewPortConfig from ‘@synchro-charts/core’
* Updated TimeSeriesDataRequest type to refer to Viewport from @iot-app-kit/core instead of @synchro-charts/core
* Removed exported mock widget properties from @iot-app-kit/core
* Updated viewportManager to utilize Viewport from @iot-app-kit/core instead of @synchro-charts/core
* Export the data types as DATA_TYPE constant from @iot-app-kit/core, instead of as a DataType enum.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants