mongodb-js / charts-embed-sdk

The easiest way to embed MongoDB Charts visualisations into your web app
https://docs.mongodb.com/charts/master/embedding-charts-sdk/
Apache License 2.0
43 stars 31 forks source link

Missing mongodb-stitch-browser-sdk #14

Closed alexandrucom closed 4 years ago

alexandrucom commented 4 years ago

While installing only charts-embed-sdk, there is a build error saying:

node_modules/@mongodb-js/charts-embed-dom/dist/declarations/src/realm-auth.d.ts:1:33 - error TS2307: Cannot find module 'mongodb-stitch-browser-sdk' or its corresponding type declarations. import { StitchAppClient } from 'mongodb-stitch-browser-sdk';

Is is not mentioned that mongodb-stitch-browser-sdk is a peerDependency for charts-embed-sdk and since not using the Realm Authentication would like to not install this package as well just to use the charts SDK

I'm setting up the SDK v 1.1.2. in an Angular 10 project

scottsidwell commented 4 years ago

Hi! 👋 Thanks for raising this ticket.

The mongodb-stitch-browser-sdk is only used for to improve typings in this project - hence why it isn't listed as a dependency/peerDependency for this project. You've raised a valid point that TSC does complain when it's missing, which would lead anyone using the chart-sdk to need to install the stitch-browser-sdk anyway.

I'll work on raising a PR to fix this issue - likely by temporarily removing the import to mongodb-stitch-browser-sdk entirely while we work out an approach to do this in a way that doesn't break your case. This will result in weaker typings for any projects using getRealmUserToken, but that's probably fine in the short-term since we have plenty of runtime checks to make sure things don't break.

This fix will take a little while to push out to prod since it's a long weekend - in the short-term, you can get the TSC compiler to ignore these errors by passing the --skipLibCheck option to tsc. I recognise that's not an ideal fix, and appreciate your patience while we work on getting this change out to prod :)

alexandrucom commented 4 years ago

@scottsidwell thank you for your prompt reply, looking forward to the PR, your suggestion is a good solution but unfortunately we can't use that on our project

scottsidwell commented 4 years ago

@alexandrucom that should be fixed in the latest version of @mongodb-js/charts-embed-dom@1.1.3 - let us know how that works for you :)

kristinamongo commented 4 years ago

Closing this as it should have been fixed in v1.1.3