Skip to content

Commit

Permalink
fix(graph): fix graph:pull and codegen bugs (#4878)
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro authored Jul 29, 2022
1 parent 6f99bdc commit 90e8c3e
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 82 deletions.
14 changes: 7 additions & 7 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
"multiparty": "^4.2.1",
"netlify": "^12.0.0",
"netlify-headers-parser": "^6.0.2",
"netlify-onegraph-internal": "0.3.9",
"netlify-onegraph-internal": "0.3.10",
"netlify-redirect-parser": "^13.0.5",
"netlify-redirector": "^0.2.1",
"node-fetch": "^2.6.0",
Expand Down
10 changes: 8 additions & 2 deletions src/commands/graph/graph-pull.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,15 @@ const graphPull = async (options, command) => {

const { jwt } = await OneGraphCliClient.getGraphJwtForSite({ siteId, nfToken: netlifyToken })

await refetchAndGenerateFromOneGraph({ logger: log, netlifyGraphConfig, jwt, state, siteId })

const oneGraphSessionId = loadCLISession(state)
await refetchAndGenerateFromOneGraph({
logger: log,
netlifyGraphConfig,
jwt,
state,
siteId,
sessionId: oneGraphSessionId,
})

if (!oneGraphSessionId) {
warn(
Expand Down
144 changes: 72 additions & 72 deletions tests/integration/snapshots/530.graph-codegen.test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -2664,24 +2664,24 @@ Generated by [AVA](https://avajs.dev).
method: 'POST',␊
headers: headers,␊
timeout: timeoutMs,␊
body: reqBody␊
body: reqBody,
};␊
const url = 'https://graph.netlify.com/graphql?app_id=' + siteId;␊
return fetch(url, reqOptions).then(r => {␊
body.text().then(bodyString => {␊
return fetch(url, reqOptions).then((body) => {␊
return body.text().then((bodyString) => {␊
const headers = {};␊
r.headers.forEach((k,v) => x[k] = v);␊
body.headers.forEach((k, v) => (headers[k] = v));␊
return {␊
body: bodyString,␊
headers: headers,␊
status: r.status␊
}␊
})␊
status: body.status,
};
});
});␊
}␊
};
const fetchNetlifyGraph = function fetchNetlifyGraph(input) {␊
const query = input.query;␊
Expand Down Expand Up @@ -7541,24 +7541,24 @@ Generated by [AVA](https://avajs.dev).
method: 'POST',␊
headers: headers,␊
timeout: timeoutMs,␊
body: reqBody␊
body: reqBody,
};␊
const url = 'https://graph.netlify.com/graphql?app_id=' + siteId;␊
return fetch(url, reqOptions).then(r => {␊
body.text().then(bodyString => {␊
return fetch(url, reqOptions).then((body) => {␊
return body.text().then((bodyString) => {␊
const headers = {};␊
r.headers.forEach((k,v) => x[k] = v);␊
body.headers.forEach((k, v) => (headers[k] = v));␊
return {␊
body: bodyString,␊
headers: headers,␊
status: r.status␊
}␊
})␊
status: body.status,
};
});
});␊
}␊
};
const fetchNetlifyGraph = function fetchNetlifyGraph(input) {␊
const query = input.query;␊
Expand Down Expand Up @@ -12418,24 +12418,24 @@ Generated by [AVA](https://avajs.dev).
method: 'POST',␊
headers: headers,␊
timeout: timeoutMs,␊
body: reqBody␊
body: reqBody,
};␊
const url = 'https://graph.netlify.com/graphql?app_id=' + siteId;␊
return fetch(url, reqOptions).then(r => {␊
body.text().then(bodyString => {␊
return fetch(url, reqOptions).then((body) => {␊
return body.text().then((bodyString) => {␊
const headers = {};␊
r.headers.forEach((k,v) => x[k] = v);␊
body.headers.forEach((k, v) => (headers[k] = v));␊
return {␊
body: bodyString,␊
headers: headers,␊
status: r.status␊
}␊
})␊
status: body.status,
};
});
});␊
}␊
};
const fetchNetlifyGraph = function fetchNetlifyGraph(input) {␊
const query = input.query;␊
Expand Down Expand Up @@ -17295,24 +17295,24 @@ Generated by [AVA](https://avajs.dev).
method: 'POST',␊
headers: headers,␊
timeout: timeoutMs,␊
body: reqBody␊
body: reqBody,
};␊
const url = 'https://graph.netlify.com/graphql?app_id=' + siteId;␊
return fetch(url, reqOptions).then(r => {␊
body.text().then(bodyString => {␊
return fetch(url, reqOptions).then((body) => {␊
return body.text().then((bodyString) => {␊
const headers = {};␊
r.headers.forEach((k,v) => x[k] = v);␊
body.headers.forEach((k, v) => (headers[k] = v));␊
return {␊
body: bodyString,␊
headers: headers,␊
status: r.status␊
}␊
})␊
status: body.status,
};
});
});␊
}␊
};
const fetchNetlifyGraph = function fetchNetlifyGraph(input) {␊
const query = input.query;␊
Expand Down Expand Up @@ -22172,24 +22172,24 @@ Generated by [AVA](https://avajs.dev).
method: 'POST',␊
headers: headers,␊
timeout: timeoutMs,␊
body: reqBody␊
body: reqBody,
};␊
const url = 'https://graph.netlify.com/graphql?app_id=' + siteId;␊
return fetch(url, reqOptions).then(r => {␊
body.text().then(bodyString => {␊
return fetch(url, reqOptions).then((body) => {␊
return body.text().then((bodyString) => {␊
const headers = {};␊
r.headers.forEach((k,v) => x[k] = v);␊
body.headers.forEach((k, v) => (headers[k] = v));␊
return {␊
body: bodyString,␊
headers: headers,␊
status: r.status␊
}␊
})␊
status: body.status,
};
});
});␊
}␊
};
const fetchNetlifyGraph = function fetchNetlifyGraph(input) {␊
const query = input.query;␊
Expand Down Expand Up @@ -27049,24 +27049,24 @@ Generated by [AVA](https://avajs.dev).
method: 'POST',␊
headers: headers,␊
timeout: timeoutMs,␊
body: reqBody␊
body: reqBody,
};␊
const url = 'https://graph.netlify.com/graphql?app_id=' + siteId;␊
return fetch(url, reqOptions).then(r => {␊
body.text().then(bodyString => {␊
return fetch(url, reqOptions).then((body) => {␊
return body.text().then((bodyString) => {␊
const headers = {};␊
r.headers.forEach((k,v) => x[k] = v);␊
body.headers.forEach((k, v) => (headers[k] = v));␊
return {␊
body: bodyString,␊
headers: headers,␊
status: r.status␊
}␊
})␊
status: body.status,
};
});
});␊
}␊
};
const fetchNetlifyGraph = function fetchNetlifyGraph(input) {␊
const query = input.query;␊
Expand Down Expand Up @@ -31926,24 +31926,24 @@ Generated by [AVA](https://avajs.dev).
method: 'POST',␊
headers: headers,␊
timeout: timeoutMs,␊
body: reqBody␊
body: reqBody,
};␊
const url = 'https://graph.netlify.com/graphql?app_id=' + siteId;␊
return fetch(url, reqOptions).then(r => {␊
body.text().then(bodyString => {␊
return fetch(url, reqOptions).then((body) => {␊
return body.text().then((bodyString) => {␊
const headers = {};␊
r.headers.forEach((k,v) => x[k] = v);␊
body.headers.forEach((k, v) => (headers[k] = v));␊
return {␊
body: bodyString,␊
headers: headers,␊
status: r.status␊
}␊
})␊
status: body.status,
};
});
});␊
}␊
};
const fetchNetlifyGraph = function fetchNetlifyGraph(input) {␊
const query = input.query;␊
Expand Down Expand Up @@ -36803,24 +36803,24 @@ Generated by [AVA](https://avajs.dev).
method: 'POST',␊
headers: headers,␊
timeout: timeoutMs,␊
body: reqBody␊
body: reqBody,
};␊
const url = 'https://graph.netlify.com/graphql?app_id=' + siteId;␊
return fetch(url, reqOptions).then(r => {␊
body.text().then(bodyString => {␊
return fetch(url, reqOptions).then((body) => {␊
return body.text().then((bodyString) => {␊
const headers = {};␊
r.headers.forEach((k,v) => x[k] = v);␊
body.headers.forEach((k, v) => (headers[k] = v));␊
return {␊
body: bodyString,␊
headers: headers,␊
status: r.status␊
}␊
})␊
status: body.status,
};
});
});␊
}␊
};
const fetchNetlifyGraph = function fetchNetlifyGraph(input) {␊
const query = input.query;␊
Expand Down
Binary file modified tests/integration/snapshots/530.graph-codegen.test.js.snap
Binary file not shown.

1 comment on commit 90e8c3e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

Package size: 224 MB

Please sign in to comment.