{"id":16573887,"url":"https://github.com/leobenkel/laeta","last_synced_at":"2026-02-26T22:03:27.045Z","repository":{"id":41874125,"uuid":"267697459","full_name":"leobenkel/Laeta","owner":"leobenkel","description":"Agnostic service registry with fully typed retrieval","archived":false,"fork":false,"pushed_at":"2024-08-12T23:00:56.000Z","size":89,"stargazers_count":0,"open_issues_count":8,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-21T21:15:40.892Z","etag":null,"topics":["functional-programming","registry","scala","services","typed"],"latest_commit_sha":null,"homepage":"https://github.com/leobenkel/laeta","language":"Scala","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/leobenkel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":"leobenkel","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-05-28T21:10:38.000Z","updated_at":"2023-01-31T18:14:02.000Z","dependencies_parsed_at":"2024-11-15T16:06:28.509Z","dependency_job_id":"3216d3af-9f8e-461c-9046-fb14ed7e6c83","html_url":"https://github.com/leobenkel/Laeta","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leobenkel%2FLaeta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leobenkel%2FLaeta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leobenkel%2FLaeta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leobenkel%2FLaeta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leobenkel","download_url":"https://codeload.github.com/leobenkel/Laeta/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253177959,"owners_count":21866424,"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":["functional-programming","registry","scala","services","typed"],"created_at":"2024-10-11T21:43:19.869Z","updated_at":"2026-02-26T22:03:26.990Z","avatar_url":"https://github.com/leobenkel.png","language":"Scala","funding_links":["https://patreon.com/leobenkel","https://www.patreon.com/leobenkel"],"categories":[],"sub_categories":[],"readme":"[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Gitter](https://badges.gitter.im/laeta/community.svg)](https://gitter.im/laeta/community?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n[![release-badge][]][release]\n[![maven-central-badge][]][maven-search]\n[![CI-CD](https://github.com/leobenkel/Laeta/actions/workflows/ci_cd.yml/badge.svg)](https://github.com/leobenkel/Laeta/actions/workflows/ci_cd.yml)\n[![BCH compliance](https://bettercodehub.com/edge/badge/leobenkel/Laeta?branch=master)](https://bettercodehub.com/)\n[![Coverage Status](https://coveralls.io/repos/github/leobenkel/Laeta/badge.svg?branch=master)](https://coveralls.io/github/leobenkel/laeta?branch=master)\n[![Mutation testing badge](https://badge.stryker-mutator.io/github.com/leobenkel/Laeta/master)](https://stryker-mutator.github.io)\n\n[release]:              https://github.com/leobenkel/laeta/releases\n[release-badge]:        https://img.shields.io/github/tag/leobenkel/laeta.svg?label=version\u0026color=blue\n[maven-search]:         https://search.maven.org/search?q=g:com.leobenkel%20a:laeta*\n[leobenkel-github-badge]:     https://img.shields.io/badge/-Github-yellowgreen.svg?style=social\u0026logo=GitHub\u0026logoColor=black\n[leobenkel-github-link]:      https://github.com/leobenkel\n[leobenkel-linkedin-badge]:     https://img.shields.io/badge/-Linkedin-yellowgreen.svg?style=social\u0026logo=LinkedIn\u0026logoColor=black\n[leobenkel-linkedin-link]:      https://linkedin.com/in/leobenkel\n[leobenkel-personal-badge]:     https://img.shields.io/badge/-Website-yellowgreen.svg?style=social\u0026logo=data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzMwMHB4JyB3aWR0aD0nMzAwcHgnICBmaWxsPSIjMDAwMDAwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNjQgNjQiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDY0IDY0IiB4bWw6c3BhY2U9InByZXNlcnZlIj48Zz48Zz48cGF0aCBkPSJNNDEuNiwyNy4yYy04LjMsMC0xNSw2LjctMTUsMTVzNi43LDE1LDE1LDE1YzguMywwLDE1LTYuNywxNS0xNVM0OS45LDI3LjIsNDEuNiwyNy4yeiBNNTEuNSwzNmgtMy4zICAgIGMtMC42LTEuNy0xLjQtMy4zLTIuNC00LjZDNDguMiwzMi4yLDUwLjIsMzMuOSw1MS41LDM2eiBNNDEuNiwzMS41YzEuMywxLjIsMi4zLDIuNywzLDQuNGgtNkMzOS4zLDM0LjIsNDAuNCwzMi43LDQxLjYsMzEuNXogICAgIE0zNy40LDMxLjNjLTEsMS40LTEuOCwyLjktMi40LDQuNmgtMy4zQzMzLjEsMzMuOSwzNS4xLDMyLjIsMzcuNCwzMS4zeiBNMzAuMyw0NWMtMC4yLTAuOS0wLjQtMS44LTAuNC0yL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DguOCwyMyw4Ljh6Ij48L3BhdGg+PC9nPjwvZz48L3N2Zz4=\u0026logoColor=black\n[leobenkel-personal-link]:      https://leobenkel.com\n[leobenkel-patreon-link]:            https://www.patreon.com/leobenkel\n[leobenkel-patreon-badge]: https://img.shields.io/badge/-Patreon-yellowgreen.svg?style=social\u0026logo=Patreon\u0026logoColor=black\n[maven-central-link]:           https://maven-badges.herokuapp.com/maven-central/com.leobenkel/laeta_2.11\n[maven-central-badge]:          https://maven-badges.herokuapp.com/maven-central/com.leobenkel/laeta_2.11/badge.svg\n\n\n# Laeta\n\nSmall library to handle registery of services.\n\nHandle collection of Services of arbitrary type and retrieve them fully typed.\n\n[Laeta (wikipedia)](https://en.wikipedia.org/wiki/Laetitia_(goddess))\n\n## Table of Contents\n\n* [How to use?](#how-to-use)\n  * [Add to build.sbt](#add-to-buildsbt)\n  * [Setup](#setup)\n  * [To use](#to-use)\n  * [Notes](#notes)\n\nCreated by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)\n\n## How to use?\n\n### Add to build.sbt\n\nFirst include the library in your project:\n\n```sbt\nlibraryDependencies += \"com.leobenkel\" %% \"laeta\" % \"[VERSION]\"\n```\nWith version being: [![maven-central-badge][]][maven-search]\n\n### Setup\n\nLive example: [Scastie-0P5GodpCSSmL5Pd8igL0tA](https://scastie.scala-lang.org/0P5GodpCSSmL5Pd8igL0tA) or take a look at the [test example](https://github.com/leobenkel/Laeta/blob/master/Library/src/test/scala/foo/bar/consumer/ServiceTest.scala)\n\nYou need two pieces for the compiler to start guiding you:\n\nA service:\n```scala\nimport com.leobenkel.laeta.Service\n\ncase class MyService(override val input: INPUT) extends Service[INPUT, MyService] {\n ???\n}\n```\n\nAnd a factory:\n\n```scala\nimport com.leobenkel.laeta.ServiceFactory\n\ncase class MyFactory(override val getInput: Int) extends ServiceFactory[INPUT, MyService] {\n    lazy override protected val getObject: ServiceConstructor[INPUT, MyService] = MyConstructor\n    lazy override protected val getType:   ServiceType[MyService] = MyGeyKey\n}\n```\n\nThis will force you to create:\n\nA constructor:\n\n```scala\nobject MyConstructor extends ServiceConstructor[INPUT, MyService]\n```\n\nYour `MyConstructor` should probably have the same name as `case class MyService` so you don't have to implement the `apply` method.\n\nand a Type:\n\n```scala\ncase object MyGeyKey extends ServiceType[MyService] {}\n```\n\n### To use\n\nAnd to use is very simple, you first register all the factories:\n\n```scala\nval registryBuilder: RegistryFactories = RegistryFactories()\n    .register(MyFactory(input))\n```\n\nand then you seal the registry:\n\n```scala\nval registryReady: ServiceCollection = registryBuilder.create\n```\n\nyou can now access any service, anywhere, **typed** !\n\n```scala\nval myService = registryReady.getService(MyGeyKey)\n```\n\n### Notes\n\nIt is possible to merge the `ServiceConstructor[INPUT, MyService]` and the `ServiceType[MyService]` for shorter code.\n\nThis mean you can replace all the places where we used `MyGeyKey` by `MyConstructor`. \n\nExample on [Scastie-716dNpMORwuJqO9RWED93A](https://scastie.scala-lang.org/716dNpMORwuJqO9RWED93A).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleobenkel%2Flaeta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleobenkel%2Flaeta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleobenkel%2Flaeta/lists"}