Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add support for automatic GraphQL unpagination
GraphQL was designed around the idea that you should be able to "ask
for what you need and get exactly that".  Unfortunately this does not
cover the "look, if I persist, then you are going to hand me over all
the data anyway, so just caught it up already", which is what Forge
needs.

`ghub--graphql-vacuum' provides a way to unpaginate all cursors in the
returned data without having to write a lot of boilerplate.  Callers
have to provide the query as an s-expression that corresponds to the
root request.  The queries needed to follow cursors in arbitrary
locations within the returned data, are automatically derived from
that query.

`ghub-fetch-repository' fetches information about a repository.
If also serves as an example for how to use `ghub--graphql-vacuum'.

The initial queries used by `ghub-fetch-issue' and
`ghub-fetch-pullreq' are pre-narrowed variants of the initial query of
`ghub-fetch-repository'.  Pre-narrowing is somewhat similar to the use
of fragments, but unlike that, it doesn't result in lots of duplicated
boilerplate and/or lots of variables.

There is very little documentation and everything is still very much
subject to change
  • Loading branch information
tarsius committed Sep 11, 2018
1 parent 4d7a092 commit 3705935
Show file tree
Hide file tree
Showing 6 changed files with 626 additions and 9 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Expand Up @@ -4,17 +4,18 @@ env:
global:
- CURL="curl -fsSkL --retry 9 --retry-delay 9"
- EMACS_BASE=https://github.com/npostavs/emacs-travis/releases/download/bins
- GHRAW="https://raw.githubusercontent.com"
matrix:
- EMACS_VERSION=24.4
- EMACS_VERSION=24.5
- EMACS_VERSION=25.1
- EMACS_VERSION=25.3
- EMACS_VERSION=26
- EMACS_VERSION=master
allow_failures:
- env: EMACS_VERSION=master
install:
- $CURL -o let-alist.el https://elpa.gnu.org/packages/let-alist-1.0.5.el
- $CURL -O ${GHRAW}/magnars/dash.el/master/dash.el
- $CURL -O ${GHRAW}/vermiculus/graphql.el/master/graphql.el
- $CURL -O ${GHRAW}/volrath/treepy.el/master/treepy.el
- $CURL -O ${EMACS_BASE}/emacs-bin-${EMACS_VERSION}.tar.gz
- tar -xaf emacs-bin-${EMACS_VERSION}.tar.gz -C /
- export EMACS=/tmp/emacs/bin/emacs
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Expand Up @@ -10,7 +10,9 @@ ELS += gogs.el
ELS += buck.el
ELCS = $(ELS:.el=.elc)

DEPS =
DEPS = dash
DEPS += graphql
DEPS += treepy

VERSION ?= $(shell test -e $(TOP).git && git describe --tags --abbrev=0 | cut -c2-)

Expand Down

0 comments on commit 3705935

Please sign in to comment.