Function: ghub--graphql-prepare-query
ghub--graphql-prepare-query is a byte-compiled function defined in
ghub-graphql.el.
Signature
(ghub--graphql-prepare-query QUERY &optional LINEAGE CURSOR PAGINATE)
Source Code
;; Defined in ~/.emacs.d/elpa/ghub-20260401.1239/ghub-graphql.el
(defun ghub--graphql-prepare-query (query &optional lineage cursor paginate)
(when lineage
(setq query (ghub--graphql-narrow-query query lineage cursor)))
(let ((loc (ghub--alist-zip query))
variables)
(catch :done
(while t
(let ((node (treepy-node loc)))
(when (and (vectorp node)
(listp (aref node 0)))
(let ((alist (append node ()))
(vars nil))
(when-let ((edges (cadr (assq :edges alist))))
(push (list 'first
(apply
#'min
(delq nil (list (and (numberp edges) edges)
paginate
ghub-graphql-items-per-request))))
vars)
(setq loc (treepy-up loc))
(setq node (treepy-node loc))
(setq loc (treepy-replace
loc `(,(car node)
,(cadr node)
(pageInfo endCursor hasNextPage)
(edges (node ,@(cddr node))))))
(setq loc (treepy-down loc))
(setq loc (treepy-next loc)))
(dolist (elt alist)
(cond ((keywordp (car elt)))
((length= elt 3)
(push (list (nth 0 elt) (nth 1 elt)) vars)
(push (list (nth 1 elt) (nth 2 elt)) variables))
((length= elt 2)
(push elt vars))))
(setq loc (treepy-replace loc (vconcat (nreverse vars)))))))
(if (treepy-end-p loc)
(let ((node (copy-sequence (treepy-node loc))))
(when variables
(push (vconcat (nreverse variables))
(cdr node)))
(throw :done node))
(setq loc (treepy-next loc)))))))