Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-teamtailor-users

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-teamtailor-users - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

yarn.lock

55

gatsby-node.js

@@ -1,16 +0,37 @@

const fetch = require('node-fetch');
const crypto = require('crypto')
const fetch = require("node-fetch");
const crypto = require("crypto");
exports.sourceNodes = async ({ boundActionCreators, createNodeId }, configOptions) => {
const { createNode } = boundActionCreators;
delete configOptions.plugins
const { data: users } = await fetch("https://api.teamtailor.com/v1/users", {
const getTeamtailorUsers = async ({ token, url }) => {
const { data, links } = await fetch(url, {
headers: {
"Authorization": `Token token=${configOptions.token}`,
Authorization: `Token token=${token}`,
"X-Api-Version": "20161108"
}
}).then(response => response.json())
})
.then(response => response.json())
.catch(() => {
throw new Error("Failed to fetch teamtailor users");
});
if (links.next) {
const nextData = await getTeamtailorUsers({ token, url: links.next });
return [...data, ...nextData];
}
return data;
};
exports.sourceNodes = async (
{ boundActionCreators, createNodeId },
configOptions
) => {
const { createNode } = boundActionCreators;
delete configOptions.plugins;
const users = await getTeamtailorUsers({
token: configOptions.token,
url: "https://api.teamtailor.com/v1/users"
});
const transformedUsers = users.map(({ id, attributes }) => ({

@@ -22,5 +43,9 @@ teamtailorId: id,

standard: attributes.picture ? attributes.picture.standard : null,
large: attributes.picture ? attributes.picture.standard.replace("h_160", "h_1024").replace("w_160", "w_1024") : null
large: attributes.picture
? attributes.picture.standard
.replace("h_160", "h_1024")
.replace("w_160", "w_1024")
: null
}
}))
}));

@@ -35,5 +60,5 @@ return transformedUsers.map(user =>

contentDigest: crypto
.createHash('md5')
.createHash("md5")
.update(JSON.stringify(user))
.digest('hex'),
.digest("hex"),
content: JSON.stringify(user),

@@ -43,3 +68,3 @@ type: "TeamtailorUser"

})
);;
);
};
{
"name": "gatsby-teamtailor-users",
"version": "1.1.0",
"version": "1.2.0",
"description": "A plugin for getting teamtailor users in gatsby",

@@ -5,0 +5,0 @@ "main": "gatsby-node.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc