Helix GraphQL
An experimental GraphQL representation of the GitHub Content Repository for Project helix
Status
This thing is a very experimental proof of concept. Be surprised if it runs. Be more surprised if it doesn't burn down your house.
Usage (Local)
$ npm install
$ npx autographql dev -c autographql.json
You can then run GraphQL queries against http://localhost:8080
. For example:
query {
repo(owner: "trieloff", repo: "helix-demo") {
owner,
name,
contents(ref: "master", path: "", match: "*.md") {
path,
name,
document {
description,
title,
images
}
}
}
}
will yield:
{
"errors": [
{
"message": "invalid json response body at https://adobeioruntime.net/api/v1/web/helix-pages/dynamic%40v1/idx_json?owner=trieloff&repo=helix-demo&ref=master&path=foo.md reason: Unexpected end of JSON input",
"locations": [
{
"line": 8,
"column": 7
}
],
"path": [
"repo",
"contents",
0,
"document"
]
}
],
"data": {
"repo": {
"owner": "trieloff",
"name": "helix-demo",
"contents": [
{
"path": "foo.md",
"name": "foo.md",
"document": null
},
{
"path": "index.md",
"name": "index.md",
"document": {
"description": null,
"title": "Helix - demo",
"images": [
"/content/dam/udp/language-masters/en/home_callout01.jpg.img.jpg",
"htdocs/big-image.jpg"
]
}
},
{
"path": "more.md",
"name": "more.md",
"document": {
"description": null,
"title": "More?",
"images": []
}
},
{
"path": "schwupp.md",
"name": "schwupp.md",
"document": {
"description": null,
"title": null,
"images": []
}
}
]
}
}
}
What Happens Here?
The Helix GraphQL service combines the results of two API calls:
- the GitHub REST API to retrieve files in a folder of a GitHub repo (at a particular
ref
) - the Helix Pages Index API to extract some metadata
Improvements Wanted/Needed
- deploy to Adobe I/O Runtime
- use local caching for Index API
- use Fastly caching for Index API
- use
helix-resolve-git-ref
instead of named refs - expose Sections in schema and response
- enable recursive file listing
- enable authenticated requests
- provide better filters
- Use
delegateToSchema
and wrap the GitHub GraphQL API