gatsby-source-drupal
Advanced tools
Comparing version 1.0.0-alpha15-alpha.17ca92e9 to 1.0.0-alpha15-alpha.336b6aa8
{ | ||
"name": "gatsby-source-drupal", | ||
"version": "1.0.0-alpha15-alpha.17ca92e9", | ||
"version": "1.0.0-alpha15-alpha.336b6aa8", | ||
"description": "Gatsby source plugin for building websites using the Drupal CMS as a data source", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -5,8 +5,6 @@ const axios = require(`axios`) | ||
const makeTypeName = type => { | ||
return `drupal__${type.replace(/-/g, `_`)}` | ||
} | ||
const makeTypeName = type => `drupal__${type.replace(/-/g, `_`)}` | ||
const processEntities = ents => { | ||
return ents.map(ent => { | ||
const processEntities = ents => | ||
ents.map(ent => { | ||
const newEnt = { | ||
@@ -29,3 +27,2 @@ id: ent.id, | ||
}) | ||
} | ||
@@ -121,44 +118,45 @@ exports.sourceNodes = async ( | ||
const blue = await Promise.all( | ||
users.map((user, i) => { | ||
return new Promise(resolve => { | ||
const userStr = JSON.stringify(user) | ||
users.map( | ||
(user, i) => | ||
new Promise(resolve => { | ||
const userStr = JSON.stringify(user) | ||
const gatsbyUser = { | ||
...user, | ||
children: [], | ||
parent: `__SOURCE__`, | ||
internal: { | ||
type: makeTypeName(user.internal.type), | ||
content: userStr, | ||
mediaType: `application/json`, | ||
}, | ||
} | ||
const gatsbyUser = { | ||
...user, | ||
children: [], | ||
parent: `__SOURCE__`, | ||
internal: { | ||
type: makeTypeName(user.internal.type), | ||
content: userStr, | ||
mediaType: `application/json`, | ||
}, | ||
} | ||
if (gatsbyUser.uid === 1) { | ||
return resolve() | ||
} | ||
if (gatsbyUser.uid === 1) { | ||
return resolve() | ||
} | ||
axios | ||
.get( | ||
userResult.data.data[i].relationships.user_picture.links.related, | ||
{ timeout: 20000 } | ||
) | ||
.catch(() => console.log(`fail fetch`, gatsbyUser)) | ||
.then(pictureResult => { | ||
gatsbyUser.picture = `http://dev-gatsbyjs-d8.pantheonsite.io${pictureResult.data.data.attributes.url}` | ||
axios | ||
.get( | ||
userResult.data.data[i].relationships.user_picture.links.related, | ||
{ timeout: 20000 } | ||
) | ||
.catch(() => console.log(`fail fetch`, gatsbyUser)) | ||
.then(pictureResult => { | ||
gatsbyUser.picture = `http://dev-gatsbyjs-d8.pantheonsite.io${pictureResult.data.data.attributes.url}` | ||
// Get content digest of node. | ||
const contentDigest = crypto | ||
.createHash(`md5`) | ||
.update(JSON.stringify(gatsbyUser)) | ||
.digest(`hex`) | ||
// Get content digest of node. | ||
const contentDigest = crypto | ||
.createHash(`md5`) | ||
.update(JSON.stringify(gatsbyUser)) | ||
.digest(`hex`) | ||
gatsbyUser.internal.contentDigest = contentDigest | ||
gatsbyUser.internal.contentDigest = contentDigest | ||
createNode(gatsbyUser) | ||
createNode(gatsbyUser) | ||
resolve() | ||
}) | ||
}) | ||
}) | ||
resolve() | ||
}) | ||
}) | ||
) | ||
) | ||
@@ -165,0 +163,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7124
7
144