gatsby-source-drupal
Advanced tools
Comparing version 1.0.0-alpha14-alpha.e5097827 to 1.0.0-alpha15
{ | ||
"name": "gatsby-source-drupal", | ||
"version": "1.0.0-alpha14-alpha.e5097827", | ||
"version": "1.0.0-alpha15", | ||
"description": "Gatsby source plugin for building websites using the Drupal CMS as a data source", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -12,5 +12,7 @@ const axios = require(`axios`) | ||
const newEnt = { | ||
id: ent.id, | ||
internal: { | ||
type: ent.type, | ||
}, | ||
...ent.attributes, | ||
id: ent.id, | ||
type: ent.type, | ||
created: new Date(ent.attributes.created * 1000).toJSON(), | ||
@@ -47,11 +49,4 @@ changed: new Date(ent.attributes.changed * 1000).toJSON(), | ||
// Touch existing Drupal nodes so Gatsby doesn't garbage collect them. | ||
// console.log( | ||
// "existing drupal nodes", | ||
// _.values(store.getState().nodes) | ||
// .filter(n => n.type.slice(0, 8) === `drupal__`) | ||
// .map(n => n.id) | ||
// ) | ||
_.values(store.getState().nodes) | ||
.filter(n => n.type.slice(0, 8) === `drupal__`) | ||
.filter(n => n.internal.type.slice(0, 8) === `drupal__`) | ||
.forEach(n => touchNode(n.id)) | ||
@@ -99,8 +94,11 @@ | ||
...node, | ||
children: [], | ||
parent: `__SOURCE__`, | ||
type: makeTypeName(node.type), | ||
children: [], | ||
content: nodeStr, | ||
internal: { | ||
...node.internal, | ||
type: makeTypeName(node.internal.type), | ||
content: nodeStr, | ||
mediaType: `application/json`, | ||
}, | ||
author___NODE: result.data.data[i].relationships.uid.data.id, | ||
mediaType: `application/json`, | ||
} | ||
@@ -114,3 +112,3 @@ | ||
gatsbyNode.contentDigest = contentDigest | ||
gatsbyNode.internal.contentDigest = contentDigest | ||
@@ -131,7 +129,9 @@ createNode(gatsbyNode) | ||
...user, | ||
children: [], | ||
parent: `__SOURCE__`, | ||
type: makeTypeName(user.type), | ||
children: [], | ||
content: userStr, | ||
mediaType: `application/json`, | ||
internal: { | ||
type: makeTypeName(user.internal.type), | ||
content: userStr, | ||
mediaType: `application/json`, | ||
}, | ||
} | ||
@@ -146,3 +146,3 @@ | ||
userResult.data.data[i].relationships.user_picture.links.related, | ||
{ timeout: 3000 } | ||
{ timeout: 20000 } | ||
) | ||
@@ -159,3 +159,3 @@ .catch(() => console.log(`fail fetch`, gatsbyUser)) | ||
gatsbyUser.contentDigest = contentDigest | ||
gatsbyUser.internal.contentDigest = contentDigest | ||
@@ -162,0 +162,0 @@ createNode(gatsbyUser) |
146
7070