Resin-SDK v7.0.0 released

After 6 months of steady smaller releases and improvements for SDK v6, yesterday we released version 7.0.0 of Resin-SDK. This comes with a few bugfixes, performance improvements and usability tweaks, but most importantly moves the SDK to use the new v3 of the API, which sets us on the path towards multicontainer.

This is quite a breaking change though, so if you’re using the SDK it’s well worth carefully checking the below and making sure your code handles the changes when you upgrade. The old v2 of the API is still fully supported, so old versions of the SDK should continue to work for quite some time, but they won’t receive exciting new updates (like multicontainer) or further bugfixes, so you’ll want to upgrade as soon as you can.

Note that there’ll also be another breaking change coming soon too (SDK v8), to complete the full move to a multicontainer model, but we’d recommend you do the upgrade in two stages, since the changes at each stage are quite different and separate.

What’s changed?

The full CHANGELOG is here:

I won’t repeat all that again, but to summarize the important breaking changes you’ll need to watch out for:

  • Relationships between objects now include the verbs used in our model. This is part of our API changes, and lets you differentiate some cases such as devices that manage or are managed by other devices, if you’re using our dependent devices functionality. In practice, this means if you previously used device.application, you’ll now want device.belongs_to__application
  • We no longer automatically include various related models when you query for one model. Previously for example if you asked for an application’s info, we loaded the info for all devices owned by that application. This is sometimes useful, but makes the request slower and the response much larger. Now, if you want that info, you need to opt in explicitly, e.g. with
    resin.models.application.get(appId, { expand: 'owns__devices' });
  • We’ve removed some awkward and rarely used methods and properties that don’t fit well into the new architecture, including:
    • The online_devices and device_length properties previously returned on application objects - if you want this information, you can expand application.owns__device, and count (or filter then count) the devices for yourself
    • The dashboard_url and application_name properties previously returned on device objects - if you want this information, you can expand device.belongs_to__application to get that application’s details, and you can build a dashboard url with the device.getDashboardUrl method.
    • device.ensureSupervisorCompatibility has been removed - you can use node-semver directly on supervisor versions for yourself instead.
  • getAppWithOwner has been renamed to getAppByOwner, to more clearly describe what it does.
  • The previously deprecated application.getApiKey() method has been removed - you should generally use application.generateProvisioningKey() instead.
  • We’ve removed explicit support for Node 4, now that’s it’s officially out of active LTS. Node 4 will probably keep working for quite some time, but we’re not going to actively test or ensure against that, and we’d recommend you update to Node 6 (the current LTS) or Node 8 (the latest Node release) as soon as you can.

In addition to this, there’s a sprinkling of bug fixes and usability improvements, and a general boost in performance as part of ensuring the SDK doesn’t load more data than it needs.

If you want more details, the SDK documentation should cover how everything works, or feel free to ping us with questions below.