diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b942932..d42793db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +## v2.0.0 [**alpha**] _Second Toughest in the Infants_ +- **BREAKING**: "Node-style" error-first callbacks (_e.g._ `.get( ( err, data ) => {} )`) are no longer supported. All transport request methods return Promises. +- **BREAKING**: The module exported as `wpapi` no longer includes HTTP methods. Install `superagent` as a peer dependency and `require( 'wpapi/superagent' )` in order to make HTTP requests. +- **BREAKING**: Autodiscovery now either succeeds or fails; a WPAPI instance configured with default routes will no longer be returned. + + +## v1.2.2 _(future release)_ + +- Throw an error early when `.file()` is passed a Buffer object without an accompanying name string, props @cungminh2710 & @mvhirsch + + +## v1.2.1 _Colomb_ + +- Fix issue where `li` was improperly declared as a dev-only dependency, props @el-lsan & @jerolan. + + +## v1.2.0 _Space Is Only Noise_ + +- **BREAKING**: The minimum supported node version is now v8.6, or v8.2.1 with the `--harmony` flag. +- **BREAKING**: `._paging.total` and `._paging.totalPages` response properties are now returned as integers, not strings. +- Bundled route handlers are now available for new first-party endpoints in WordPress 5.0. +- The project now uses Jest and ESLint in place of Mocha, Chai, JSCS and JSHint. Thank you for your years of service, ["nyan" reporter](https://mochajs.org/#nyan)! +- Browser bundle size has been reduced. + + ## v1.1.2 _If I Survive_ - Resolves an issue where authentication credentials where not maintained properly when iterating through pages of a connection with `._paging.next` or `._paging.prev`, props @motleydev for the reproducible bug report @@ -43,9 +68,9 @@ v1.0 namesake album _Emotional Technology_ by BT. - Add CHANGELOG.md - Reduce complexity of, and rename, default routes JSON file -- BREAKING: Remove third "merge" argument from `.param()` method signature +- **BREAKING**: Remove third "merge" argument from `.param()` method signature - Document `.settings()` top-level route handler -- BREAKING: Return API error objects directly from HTTP transport: only return a transport-level error object in the event of a non-API error +- **BREAKING**: Return API error objects directly from HTTP transport: only return a transport-level error object in the event of a non-API error - Add `.status()` parameter method mixin - Properly register `.password()` and `.sticky()` parameter mixins - Utilize the HTTP transport methods during auto-discovery process diff --git a/README.md b/README.md index 349408c3..3668a032 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ A WordPress REST API client for JavaScript ========================================== -This library is an isomorphic client for the [WordPress REST API](http://developer.wordpress.org/rest-api), designed to work with WordPress 4.7 or later. If you are using the older [WP REST API plugin](https://github.com/WP-API/WP-API), some commands will not work. +This library is an isomorphic client for the [WordPress REST API](http://developer.wordpress.org/rest-api), designed to work with WordPress 5.0 or later. If you are using the older [WP REST API plugin](https://github.com/WP-API/WP-API) or WordPress 4.9, some commands will not work. [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/wp-api/node-wpapi?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) @@ -11,6 +11,7 @@ This library is an isomorphic client for the [WordPress REST API](http://develop - [About](#about) - [Installation](#installation) + - [Upgrading from v1](#upgrading-from-v1) - [Using the Client](#using-the-client) - [Auto-Discovery](#auto-discovery) - [Creating Posts](#creating-posts) @@ -18,7 +19,7 @@ This library is an isomorphic client for the [WordPress REST API](http://develop - [Requesting Different Resources](#requesting-different-resources) - [API Query Parameters & Filtering Collections](#api-query-parameters) - [Uploading Media](#uploading-media) -- [Custom Routes](#custom-routes) +- [Querying Custom Routes](#custom-routes) - [Setter Method Naming](#setter-method-naming-for-named-route-components) - [Query Parameters & Filtering](#query-parameters--filtering-custom-routes) - [Mixins](#mixins) @@ -35,13 +36,13 @@ This library is an isomorphic client for the [WordPress REST API](http://develop `node-wpapi` is an isomorphic JavaScript client for the [WordPress REST API](https://developer.wordpress.org/rest-api) that makes it easy for your JavaScript application to request specific resources from a [WordPress](https://wordpress.org) website. It uses a query builder-style syntax to let you craft the request being made to REST API endpoints, then returns the API's response to your application as a JSON object. And don't let the name fool you: with [Webpack](https://webpack.github.io/) or [Browserify](http://browserify.org/), `node-wpapi` works just as well in the browser as it does on the server! -This library is maintained by K. Adam White at [Bocoup](https://bocoup.com), with contributions from a [great community](https://github.com/WP-API/node-wpapi/graphs/contributors) of WordPress and JavaScript developers. +This library is maintained by K. Adam White at [Human Made](https://humanmade.com), with contributions from a [great community](https://github.com/WP-API/node-wpapi/graphs/contributors) of WordPress and JavaScript developers. To get started, `npm install wpapi` or [download the browser build](https://wp-api.github.io/node-wpapi/wpapi.zip) and check out "Installation" and "Using the Client" below. ## Installation -`node-wpapi` works both on the server or in the browser. Node.js version 8 or higher is required, and the latest LTS release is recommended. +`node-wpapi` works both on the server or in the browser. Node.js version 8.6 or higher (or version 8.2.1 with the `--harmony` flag) is required, and the latest LTS release is recommended. In the browser `node-wpapi` officially supports the latest two versions of all evergreen browsers, and Internet Explorer 11. @@ -53,45 +54,83 @@ To use the library from Node, install it with [npm](http://npmjs.org): npm install --save wpapi ``` -Then, within your application's script files, `require` the module to gain access to it: +Then, within your application's script files, `require` the module to gain access to it. As `wpapi` is both a query builder and a transport layer (_i.e._ a tool for getting and sending HTTP requests), we leave it up to you as the author of your application whether you need both parts of this functionality. You may use `wpapi` with [superagent](https://www.npmjs.com/package/superagent) if you wish to send and receive HTTP requests using this library, but you may also use only the query builder part of the library if you intend to submit your HTTP requests with `fetch`, `axios` or other tools. + +To import only the query builder (without the `.get()`, `.create()`, `.delete()`, `.update()` or `.then()` chaining methods): ```javascript var WPAPI = require( 'wpapi' ); ``` -This library is designed to work in the browser as well, via a build system such as Browserify or Webpack; just install the package and `require( 'wpapi' )` from your application code. +To import the superagent bundle, which contains the full suite of HTTP interaction methods: + +```js +var WPAPI = require( 'wpapi/superagent' ); +``` + +This library is designed to work in the browser as well, via a build system such as Browserify or Webpack; just install the package and `require( 'wpapi' )` (or `'wpapi/superagent'`) from your application code. ### Download the UMD Bundle Alternatively, you may download a [ZIP archive of the bundled library code](https://wp-api.github.io/node-wpapi/wpapi.zip). These files are UMD modules, which may be included directly on a page using a regular `