Skip to content

Commit

Permalink
moved to deps.edn + minor cleanup and improvements + fixed some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin Waeselynck committed Oct 10, 2018
1 parent 25a2107 commit 6c5bd5f
Show file tree
Hide file tree
Showing 7 changed files with 176 additions and 400 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ pom.xml.asc

*.iml
.idea
.cpcache
14 changes: 14 additions & 0 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{:deps
{org.clojure/clojure {:mvn/version "1.8.0"}
manifold {:mvn/version "0.1.6"}

com.taoensso/tufte {:mvn/version "1.4.0"} ;; FIXME
}
:aliases
{:dev
{:extra-deps
{midje {:mvn/version "1.7.0"}
vvvvalvalval/scope-capture {:mvn/version "0.1.4"}
vvvvalvalval/scope-capture-nrepl {:mvn/version "0.2.0"}
criterium {:mvn/version "0.4.4"}
vvvvalvalval/supdate {:mvn/version "0.2.1"}}}}}
17 changes: 7 additions & 10 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
:url "https://github.com/vvvvalvalval/d2q"
:license {:name "MIT License"
:url "https://opensource.org/licenses/MIT"}
:dependencies [[org.clojure/clojure "1.8.0"]
[manifold "0.1.6"]]
:profiles
{:dev
{:dependencies
[[midje "1.7.0"]
[vvvvalvalval/scope-capture "0.1.4"]
[vvvvalvalval/scope-capture-nrepl "0.2.0"]
[criterium "0.4.4"]
[com.taoensso/tufte "1.4.0"]
[vvvvalvalval/supdate "0.2.1"]]
:repl-options {:nrepl-middleware [sc.nrepl.middleware/wrap-letsc]}}})
{:lein-tools-deps/config {:aliases [:dev]}
:repl-options {:nrepl-middleware [sc.nrepl.middleware/wrap-letsc]}}}

:plugins [[lein-tools-deps "0.4.1"]]
:middleware [lein-tools-deps.plugin/resolve-dependencies-with-deps-edn]
:lein-tools-deps/config {:config-files [:install :user :project]}
)
5 changes: 3 additions & 2 deletions src/d2q/api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
;; 2. √ Subquery preview in resolvers? May require to change the format of resolvers.
;; 3. √ Partial errors => resolvers return a map with {:data :errors} key
;; 4. Maybe skip the normalization of query - should be done by the caller
;; 5. Mutual recursion (requires to change the query format)
;; 5. Mutual recursion (requires to change the query format - but how? specified at the Field Call or the Query ?)
;; 6. Source mapping - keep track of (reversed) query-path and data-path
;; 7. √ Maybe faster processing via records ?
;; 8. √ Early subquery substitution
;; 9. Support union queries ?
;; 9. Support Conditional Queries ? - dispatch based on an attribute, applying queries that will be applied only to a subset of the entities
;; 10. Field meta
;; 11. Post process entities e.g have a function (ent-cell, result-map) -> result-map
;; 12. 'Flattening' / 'merging' for cardinality-one, ref-typed attributes

;; ------------------------------------------------------------------------------
;; Server-side API
Expand Down
22 changes: 12 additions & 10 deletions src/d2q/impl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@
(letfn
[(query* [svr, qctx, query, ent-sel
q-trace]
(let [query-q-trace (cons [:d2q.trace.op/query
;; NOTE elision to get better REPL output
(assoc query :d2q-query-fcalls [:...elided])] q-trace)
(assert (list? q-trace))
(let [query-q-trace (conj q-trace
[:d2q.trace.op/query
;; NOTE elision to get better REPL output
(assoc query :d2q-query-fcalls [:...elided])])
n-ents (count ent-sel)]
(if (zero? n-ents)
(mfd/success-deferred {:d2q-results [] :d2q-errors []})
Expand Down Expand Up @@ -116,7 +118,6 @@
]
(try (tp/field-table-resolver field)
(catch Throwable err
(sc.api/spy )
(throw err)))))
fcalls))]
(->
Expand Down Expand Up @@ -145,10 +146,11 @@
(apply-resolver
[svr qctx t-ent-sel resolver fcalls
q-trace]
(assert (list? q-trace))
(let [resolver-q-trace
(cons
[:d2q.trace.op/resolver {:d2q.resolver/name (tp/tr-name resolver)}]
q-trace)
(conj
q-trace
[:d2q.trace.op/resolver {:d2q.resolver/name (tp/tr-name resolver)}])
fcall-tuples
(p :fcall-tuples
(into []
Expand Down Expand Up @@ -269,12 +271,12 @@
(map (fn [[^ArrayList res-cells, field, fcall]]
(let [fck (:d2q-fcall-key fcall)
subq (:d2q-fcall-subquery fcall)
fc-q-stack (cons
fc-q-stack (conj
resolver-q-trace
[:d2q.trace.op/field-call
;; NOTE elision to get better REPL output (Val, 10 Apr 2018)
(assoc fcall
:d2q-fcall-subquery [:...elided])]
resolver-q-trace)]
:d2q-fcall-subquery [:...elided])])]
(if (tp/field-many? field)
;; to-many case
(let [subsel
Expand Down
Loading

0 comments on commit 6c5bd5f

Please sign in to comment.