@netlify/config 20.6.0 → 20.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/site_info.js +9 -6
- package/package.json +2 -2
package/lib/api/site_info.js
CHANGED
|
@@ -9,7 +9,8 @@ import { ERROR_CALL_TO_ACTION } from '../log/messages.js';
|
|
|
9
9
|
// Requires knowing the `siteId` and having the access `token`.
|
|
10
10
|
// Silently ignore API errors. For example the network connection might be down,
|
|
11
11
|
// but local builds should still work regardless.
|
|
12
|
-
export const getSiteInfo = async function ({ api, siteId, mode, siteFeatureFlagPrefix, featureFlags = {}, testOpts
|
|
12
|
+
export const getSiteInfo = async function ({ api, siteId, mode, siteFeatureFlagPrefix, featureFlags = {}, testOpts = {}, }) {
|
|
13
|
+
const { env: testEnv = true } = testOpts;
|
|
13
14
|
if (api === undefined || mode === 'buildbot' || !testEnv) {
|
|
14
15
|
const siteInfo = siteId === undefined ? {} : { id: siteId };
|
|
15
16
|
return { siteInfo, accounts: [], addons: [] };
|
|
@@ -17,14 +18,14 @@ export const getSiteInfo = async function ({ api, siteId, mode, siteFeatureFlagP
|
|
|
17
18
|
const fetchIntegrations = featureFlags.buildbot_fetch_integrations;
|
|
18
19
|
const promises = [getSite(api, siteId, siteFeatureFlagPrefix), getAccounts(api), getAddons(api, siteId)];
|
|
19
20
|
if (fetchIntegrations) {
|
|
20
|
-
promises.push(getIntegrations({ api, ownerType: 'site', ownerId: siteId }));
|
|
21
|
+
promises.push(getIntegrations({ api, ownerType: 'site', ownerId: siteId, testOpts }));
|
|
21
22
|
}
|
|
22
23
|
const [siteInfo, accounts, addons, integrations = []] = await Promise.all(promises);
|
|
23
24
|
if (siteInfo.use_envelope) {
|
|
24
25
|
const envelope = await getEnvelope({ api, accountId: siteInfo.account_slug, siteId });
|
|
25
26
|
siteInfo.build_settings.env = envelope;
|
|
26
27
|
}
|
|
27
|
-
return { siteInfo, accounts, addons, integrations: integrations
|
|
28
|
+
return { siteInfo, accounts, addons, integrations: integrations };
|
|
28
29
|
};
|
|
29
30
|
const getSite = async function (api, siteId, siteFeatureFlagPrefix = null) {
|
|
30
31
|
if (siteId === undefined) {
|
|
@@ -59,13 +60,15 @@ const getAddons = async function (api, siteId) {
|
|
|
59
60
|
throwUserError(`Failed retrieving addons for site ${siteId}: ${error.message}. ${ERROR_CALL_TO_ACTION}`);
|
|
60
61
|
}
|
|
61
62
|
};
|
|
62
|
-
const getIntegrations = async function ({ api, ownerType, ownerId }) {
|
|
63
|
+
const getIntegrations = async function ({ api, ownerType, ownerId, testOpts }) {
|
|
63
64
|
if (ownerId === undefined) {
|
|
64
65
|
return [];
|
|
65
66
|
}
|
|
67
|
+
const { host } = testOpts;
|
|
68
|
+
const baseUrl = host ? `http://${host}` : `https://api.netlifysdk.com`;
|
|
66
69
|
try {
|
|
67
|
-
const token = api.accessToken
|
|
68
|
-
const response = await fetch(
|
|
70
|
+
const token = api.accessToken;
|
|
71
|
+
const response = await fetch(`${baseUrl}/${ownerType}/${ownerId}/integrations`, {
|
|
69
72
|
headers: {
|
|
70
73
|
Authorization: `Bearer ${token}`,
|
|
71
74
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/config",
|
|
3
|
-
"version": "20.6.
|
|
3
|
+
"version": "20.6.1",
|
|
4
4
|
"description": "Netlify config module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"engines": {
|
|
95
95
|
"node": "^14.16.0 || >=16.0.0"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "955ef6d9b44d9dd92cef78ba80b15f416044bfc9"
|
|
98
98
|
}
|