New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@netlify/config

Package Overview
Dependencies
Maintainers
20
Versions
438
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netlify/config - npm Package Compare versions

Comparing version 20.6.4 to 20.7.0

lib/types/api.js

39

lib/api/site_info.js

@@ -5,10 +5,12 @@ import fetch from 'node-fetch';

import { ERROR_CALL_TO_ACTION } from '../log/messages.js';
// Retrieve Netlify Site information, if available.
// Used to retrieve local build environment variables and UI build settings.
// This is not used in production builds since the buildbot passes this
// information instead.
// Requires knowing the `siteId` and having the access `token`.
// Silently ignore API errors. For example the network connection might be down,
// but local builds should still work regardless.
export const getSiteInfo = async function ({ api, siteId, mode, siteFeatureFlagPrefix, featureFlags = {}, testOpts = {}, }) {
/**
* Retrieve Netlify Site information, if available.
* Used to retrieve local build environment variables and UI build settings.
* This is not used in production builds since the buildbot passes this
* information instead.
* Requires knowing the `siteId` and having the access `token`.
* Silently ignore API errors. For example the network connection might be down,
* but local builds should still work regardless.
*/
export const getSiteInfo = async function ({ api, siteId, mode, siteFeatureFlagPrefix, offline = false, featureFlags = {}, testOpts = {}, }) {
const { env: testEnv = false } = testOpts;

@@ -18,7 +20,3 @@ const fetchIntegrations = featureFlags.buildbot_fetch_integrations;

const siteInfo = siteId === undefined ? {} : { id: siteId };
let integrations = [];
if (fetchIntegrations && api !== undefined && !testEnv) {
// we still want to fetch integrations within buildbot
integrations = await getIntegrations({ api, ownerType: 'site', ownerId: siteId, testOpts });
}
const integrations = fetchIntegrations && mode === 'buildbot' && !offline ? await getIntegrations({ siteId, testOpts }) : [];
return { siteInfo, accounts: [], addons: [], integrations };

@@ -28,3 +26,3 @@ }

if (fetchIntegrations) {
promises.push(getIntegrations({ api, ownerType: 'site', ownerId: siteId, testOpts }));
promises.push(getIntegrations({ siteId, testOpts }));
}

@@ -71,15 +69,10 @@ const [siteInfo, accounts, addons, integrations = []] = await Promise.all(promises);

};
const getIntegrations = async function ({ api, ownerType, ownerId, testOpts }) {
if (ownerId === undefined) {
const getIntegrations = async function ({ siteId, testOpts }) {
if (!siteId) {
return [];
}
const { host } = testOpts;
const baseUrl = host ? `http://${host}` : `https://api.netlifysdk.com`;
const baseUrl = new URL(host ? `http://${host}` : `https://api.netlifysdk.com`);
try {
const token = api.accessToken;
const response = await fetch(`${baseUrl}/${ownerType}/${ownerId}/integrations`, {
headers: {
Authorization: `Bearer ${token}`,
},
});
const response = await fetch(`${baseUrl}site/${siteId}/integrations/safe`);
const integrations = await response.json();

@@ -86,0 +79,0 @@ return Array.isArray(integrations) ? integrations : [];

@@ -36,5 +36,6 @@ import { getApiClient } from './api/client.js';

mode,
testOpts,
offline,
siteFeatureFlagPrefix,
featureFlags,
testOpts,
});

@@ -41,0 +42,0 @@ const { defaultConfig: defaultConfigA, baseRelDir: baseRelDirA } = parseDefaultConfig({

{
"name": "@netlify/config",
"version": "20.6.4",
"version": "20.7.0",
"description": "Netlify config module",

@@ -97,3 +97,3 @@ "type": "module",

},
"gitHead": "5e684d0509bb094d0e11ff89559abf7eb2d806fc"
"gitHead": "a20207ec7cdc1101a875d9411355bd48f12733a3"
}
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