Skip to content
This repository has been archived by the owner on Jun 28, 2018. It is now read-only.

1.0.0

Latest
Compare
Choose a tag to compare
@dsifford dsifford released this 03 Mar 19:56

Initial stable release.

Two Breaking Changes from v0.12.0

Change 1

The config interface was adjusted slightly. Authentication can now be handed via HTTP Basic Auth or via Cookie Auth (using a generated nonce in WordPress).

Previously, only cookie-based auth was supported in the following form.

const transport = new WPGraphQL('http://localhost:8080/wp-json', { nonce: 'nonce-goes-here' });

Now, auth is handed via an auth param on the Config interface which has the following shape..

interface BasicAuth {
    username: string;
    password: string;
}

type Auth = BasicAuth | string;

Where string would be the cookie-based "nonce" auth.

So in practice, it can be used the following ways...

// Cookie auth
const transport = new WPGraphQL('http://localhost:8080/wp-json', { auth: 'nonce-goes-here' });

// Basic auth
const transport = new WPGraphQL('http://localhost:8080/wp-json', { auth: { username: 'foo', password: 'bar' } });

It should be stressed that BasicAuth should only be used in a secure setting.


Change 2

Previously, the fields title and guid were type String for Post, Page, and Revision. This has been changed to align with the REST API (in order to avoid confusion).

The type of these fields now is RawOrRendered

interface RawOrRendered {
    raw: string;
    rendered: string;
}

raw is the plain text content of the field.

rendered is the content after all wordpress filters are applied -- Which may or may not include HTML entities.