Releases: mongodb/stitch-js-sdk
Release 4.1.3
- Various improvements to documentation comments, and generated TypeDoc documentation.
- Added
BSON
as an export of thebrowser
,server
andreact-native
SDKs. This means you no longer need to separately import BSON to use native BSON types likeBSON.ObjectId
. See the README.md for each respective SDK for example usage. - Fixed a bug where logging in with a redirect credential was broken due to using an improper base URL for certain types of Stitch applications.
Release 4.1.2
- Fixed a bug where the headers in the response object of the HTTP service contained
undefined
values before the actual values contained in the header.
Release 4.1.1
- Support for contacting applications deployed with a "local" deployment model
- Before the first call to the client v2 API, the SDK now contacts the global stitch server to find out the deployment model and localized hostname for the application. The call is then redirected to the localized hostname (e.g. calls to Stitch for an app deployed locally to US-VA will hit a stitch server residing specifically in that location, while an app deployed globally will always use the global Stitch URL)
- Subsequent calls to the API use the cached result
- Added
toArray
to all find operations, with soft deprecation ofasArray
- This creates parity between this and the Function JS SDK
Release 4.1.0
- Packages are no longer exposed as UMD modules. Packages are exposed as either a CommonJS module (via the
“main”
field in “package.json”), or as an ES6 module (via the“module”
field in "package.json").- This was done because the React Native bundler cannot handle UMD modules produced by TypeScript (facebook/metro#225). Most use cases that were handled using our UMD modules as AMD modules can now be handled using our ES6 modules, or our pre-bundled hosted modules as described in our Browser SDK README. Please open an issue if you have any trouble using the SDK.
- As a side-effect, the React Native SDK now officially supports the latest version of React Native (
0.57.0
)
- minAge and maxAge in StitchUserProfile are now exposed as Strings instead of numbers. This is to more accurately the reflect the response returned from the API, and to protect against invalid API responses that aren’t numbers
- Fixed a bug in
getAppClient
in theStitch
class that prevented getting initialized app clients without an error being thrown.
Release 4.0.13
- Added generic AWS service
- New NPM packages:
mongodb-stitch-browser-services-aws
mongodb-stitch-server-services-aws
mongodb-stitch-react-native-services-aws
- New NPM packages:
- Exposed StitchServiceClient to support services which are not well-defined by the SDK
Release 3.0.1
3.0.1
Note: A previous 3.0.0 version was unpublished from NPM and this version serves as the 3.0.0 release.
Usage of StitchClient
StitchClient
can longer be constructed directly. Instead, StitchClientFactory
has been introduced to asynchronously perform any initialization steps needed to create a StitchClient
. StitchClientFactory
has a function called create
that will return a Promise
that will resolve with a StitchClient
after initialization. The resolved client should be used for the lifetime of the application.
Migration Path
// old, 2.x.x usage
import { StitchClient } from 'mongodb-stitch';
const stitchClient = new StitchClient('<app-id>');
stitchClient.login().then(authedId => console.log(authedId));
// app initialization code
// new, 3.x.x usage
import { StitchClientFactory } from 'mongodb-stitch';
const stitchClientPromise = StitchClientFactory.create('<app-id>');
stitchClientPromise.then(stitchClient => stitchClient.login().then(authedId => {
console.log(authedId);
initializeApp(stitchClient);
}));
Since the StitchClient
is only available after the Promise resolves, initialization of an app should be deferred until this time and the client reference should be passed to some initialization component/function.
NOTE: Attempting to construct a StitchClient
without using StitchClientFactory
will result in an error being thrown.
Multiple Apps
- Add support for multiple
StitchClient
s (with different associated applications).
Authentication
Previously, logging in with a provider while already logging caused no log in to happen which proved to be confusing. These new semantics are in effect:
- Authenticating multiple times with anonymous authentication while already authenticated anonymously does nothing and returns the current user ID.
- Authenticating with any provider but anonymous will log out the current user and then log in with the new provider.
- Add
isAuthenticated()
method to theStitchClient
class. This method should be used to check if any authentication work needs to happen. It returns a boolean declaring whether or not the current client is authenticated. - Add Client API key management. This feature allows one to create API keys linked to the currently logged in user. This does not work on anonymous users or Server API key users.
Services
- Add missing
findOne()
method to the MongoDB service class.
Miscellaneous
- Expose BSON module directly alongside
StitchClientFactory
.
3.0.0 Release
3.0.0
Usage of StitchClient
StitchClient
can longer be constructed directly. Instead, StitchClientFactory
has been introduced to asynchronously perform any initialization steps needed to create a StitchClient
. StitchClientFactory
has a function called create
that will return a Promise
that will resolve with a StitchClient
after initialization. The resolved client should be used for the lifetime of the application.
Migration Path
// old, 2.x.x usage
import { StitchClient } from 'mongodb-stitch';
const stitchClient = new StitchClient('<app-id>');
stitchClient.login().then(authedId => console.log(authedId));
// app initialization code
// new, 3.x.x usage
import { StitchClientFactory } from 'mongodb-stitch';
const stitchClientPromise = StitchClientFactory.create('<app-id>');
stitchClientPromise.then(stitchClient => stitchClient.login().then(authedId => {
console.log(authedId);
initializeApp(stitchClient);
}));
Since the StitchClient
is only available after the Promise resolves, initialization of an app should be deferred until this time and the client reference should be passed to some initialization component/function.
NOTE: Attempting to construct a StitchClient
without using StitchClientFactory
will result in an error being thrown.
Multiple Apps
- Add support for multiple
StitchClient
s (with different associated applications).
Authentication
Previously, logging in with a provider while already logging caused no log in to happen which proved to be confusing. These new semantics are in effect:
- Authenticating multiple times with anonymous authentication while already authenticated anonymously does nothing and returns the current user ID.
- Authenticating with any provider but anonymous will log out the current user and then log in with the new provider.
- Add
isAuthenticated()
method to theStitchClient
class. This method should be used to check if any authentication work needs to happen. It returns a boolean declaring whether or not the current client is authenticated. - Add Client API key management. This feature allows one to create API keys linked to the currently logged in user. This does not work on anonymous users or Server API key users.
Services
- Add missing
findOne()
method to the MongoDB service class.
Miscellaneous
- Expose BSON module directly alongside
StitchClientFactory
.