{"id":16486175,"url":"https://github.com/xsc/claro","last_synced_at":"2025-04-06T16:11:51.147Z","repository":{"id":57713393,"uuid":"47989287","full_name":"xsc/claro","owner":"xsc","description":"Powerful Data Access for Clojure","archived":false,"fork":false,"pushed_at":"2017-12-30T16:44:59.000Z","size":514,"stargazers_count":140,"open_issues_count":3,"forks_count":7,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-05-23T01:31:55.152Z","etag":null,"topics":["dataloader","datasources","infinite-trees"],"latest_commit_sha":null,"homepage":"http://xsc.github.io/claro/","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xsc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-14T17:05:45.000Z","updated_at":"2024-03-21T09:25:40.000Z","dependencies_parsed_at":"2022-09-06T02:10:59.845Z","dependency_job_id":null,"html_url":"https://github.com/xsc/claro","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsc%2Fclaro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsc%2Fclaro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsc%2Fclaro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsc%2Fclaro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xsc","download_url":"https://codeload.github.com/xsc/claro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247386258,"owners_count":20930618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dataloader","datasources","infinite-trees"],"created_at":"2024-10-11T13:28:34.817Z","updated_at":"2025-04-06T16:11:51.126Z","avatar_url":"https://github.com/xsc.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# claro\n\n__[Documentation](http://xsc.github.io/claro/)__ | __[Guides](doc)__\n\n__claro__ is a library that allows you to streamline your data access, providing\npowerful optimisations and abstractions along the way.\n\n[![Build Status](https://travis-ci.org/xsc/claro.svg?branch=master)](https://travis-ci.org/xsc/claro)\n[![Clojars Artifact](https://img.shields.io/clojars/v/claro.svg)](https://clojars.org/claro)\n[![codecov](https://codecov.io/gh/xsc/claro/branch/master/graph/badge.svg)](https://codecov.io/gh/xsc/claro)\n\nIt is inspired by [muse][muse] and heavily influenced by [GraphQL][graphql].\n\nclaro requires Clojure ≥ 1.7.0.\n\n[muse]: https://github.com/kachayev/muse\n[graphql]: http://graphql.org/\n\n## Features\n\nclaro is designed to be flexible and extensible. It'll make your data access\nmore elegant, efficient and testable, providing things like:\n\n- __batched resolution__ of similar entities,\n- automatic __caching__ of already known resolution results,\n- __engine middlewares__ to hook into the resolution logic, allowing e.g.\n  generic cache or circuit breaker implementations,\n- pluggable __resolution strategies__ in the form of `Resolvable` selectors,\n- an exchangeable __deferred implementation__, defaulting to\n  [manifold][manifold],\n- and pre-built middlewares for __data source mocking__, introspection and\n  result transformation.\n\n[manifold]: https://github.com/ztellman/manifold\n\n## Quickstart\n\nData access is defined within records implementing the `Resolvable` interface.\nNote that they can always produce more resolvables:\n\n```clojure\n(require '[claro.data :as data]\n         '[manifold.deferred :as d])\n\n(defrecord Person [id]\n  data/Resolvable\n  (resolve! [_ env]\n    (d/future\n      (fetch-person! (:db env) id)))\n  data/Transform\n  (transform [_ {:keys [friend-ids] :as person}]\n    (assoc person :friends (map #(Person. %) friend-ids))))\n```\n\nBlindly resolving an infinite tree like this is usually not a good idea – but\nclaro offers _tree projections_ you can use to describe abstract transformations\nof infinite structures:\n\n```clojure\n(require '[claro.projection :as projection])\n\n(def person-with-friend-names\n  {:id      projection/leaf\n   :name    projection/leaf\n   :friends [(projection/extract :name)]})\n```\n\nAnd here we go:\n\n```clojure\n(require '[claro.engine :as engine])\n\n(engine/run!!\n  (-\u003e (-\u003ePerson 1)\n      (projection/apply person-with-friend-names)))\n;; =\u003e {:id 1, :name \"Sherlock Holmes\", :friends [\"Dr. Watson\", \"Ms. Hudson\"]}\n```\n\n## Related Projects\n\n| Library | Description |\n|:------- |:----------- |\n|[alumbra][alumbra]|GraphQL implementation on top of claro|\n|[claro.circuit-breaker][claro-cb]|Circuit-breaker middleware based on [resilience4j][r4j]|\n\nFeel free to open a pull request to add your project to this table.\n\n[alumbra]: https://github.com/alumbra/alumbra\n[claro-cb]:https://github.com/xsc/claro.circuit-breaker\n[r4j]: https://github.com/resilience4j/resilience4j\n\n## Documentation\n\n1. [Basic Resolution](doc/00-basics.md)\n2. [Projections](doc/01-projection.md)\n3. [Advanced Projections](doc/02-advanced-projection.md)\n4. [Engine](doc/03-engine.md)\n5. [Testing \u0026 Debugging](doc/04-testing-and-debugging.md)\n6. [Implementation Notes](doc/99-notes.md)\n\nAll these topics are also available in claro's [auto-generated\ndocumentation][codox].\n\n[codox]: http://xsc.github.io/claro/\n\n## Contributing\n\nContributions are always welcome. Please take a look at the [Contribution\nGuidelines](CONTRIBUTING.md) for a quick overview of how your changes can best\nmake it to master.\n\n## License\n\n```\nMIT License\n\nCopyright (c) 2015-2017 Yannick Scherer\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxsc%2Fclaro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxsc%2Fclaro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxsc%2Fclaro/lists"}