Freigeben über


PnP JSCore 1.0.5

The latest release, 1.0.5, of the Patterns and Practices JavaScript Core Library includes some new enhancements and fixes to issues reported since the last release. The largest change is the move to support TypeScript 2.0 and the new @types system for improved declaration support. This is a fairly large move, but comes with significant advantages as well as solves some immediate issues.

TypeScript 2.0

The library has been updated to use TypeScript 2.0 in the contribution side and work better with 2.0 on the usage side. If you are already a contributor the easiest way to update your development environment is to pull latest, delete your node_modules and typings folders, and then run npm install. It is no longer required to separately install typings as we have moved to using the new @types system with 2.0. You can see more details on setting up your development environment in the updated wiki article.

This also impacts your applications where you are consuming the library. You no longer need to install additional typings after installing the library into your project IF you are using TS 2.0. If you are using an earlier version you will still need to install the required typings (still applies). Check out the updated console application article for getting started with 2.0. The goal was to make using the library even easier than before.

Exported Classes

We are now exporting many of the internal classes for you to use in your applications directly and provide better support to webpack and other bundlers. This allows you to more easily access Web, Site, and other types directly. You can also use these exported types to explicitly type your variables and method parameters making your application easier to read and understand.

105_exports1

You can also import then entire namespace and use multiple classes or see what is available using intellisense. This is a fuller example showing the need to call the setup function within node (don't use this when building for the browser).

105_exports2

Removed Selectable Properties

We also removed the selectable properties from ContentType, Field, File, Version, and Folder. This was done to save file size and we were able to gain 11k in the minified file by removing these properties. If you were using them the update now requires you to use the select method to pull those fields - but does have the advantage of allowing you to select multiple properties in one call.

Enhancements & Fixes

Along with the additions outlined above we also had some great additions from the community.

  • Andrew Koltyakov added support for the getList method for retrieving a list from a web by url
  • Andrew Koltyakov also provided a fix for ordering items using orderBy
  • Fix for provisioning object handler related to GetFieldXml
  • Fixed issue with provisioning sequencer not correctly chaining promises
  • Elio Struyf submitted a fix for encoding client secrets that contain special characters when using the library on node
  • Removed the post install step that tried to run typings as well as rendering it not needed by the new @Types system
  • Updated some references in package.json

A small note on docs that because TypeDoc has not been updated to work with 2.0 we cannot currently update the docs so they were not updated as part of this release. We'll get them updated as soon as possible.

What is the JS Core Component?

The Patterns and Practices JavaScript Core Library was created to help developers by simplifying common operations within SharePoint and the SharePoint Framework. Currently it contains a fluent API for working with the full SharePoint REST API as well as utility and helper functions. This takes the guess work out of creating REST requests, letting developers focus on the what and less on the how.

"Sharing is Caring"