Skip to content

Commit

Permalink
Merge pull request #111 from macielti/migrate-from-pumbling-to-medley
Browse files Browse the repository at this point in the history
migration
  • Loading branch information
macielti authored Jul 21, 2024
2 parents c039efa + 279c6e6 commit 5fd9eb6
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 32 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ of [keepachangelog.com](http://keepachangelog.com/).

## [Unreleased]

## [25.51.50] - 2024-07-12

## Changed

- Migrate from [prismatic/plumbing](https://clojars.org/prismatic/plumbing) to [medley](https://clojars.org/medley).

## [25.51.49] - 2024-07-12

## Changed
Expand Down Expand Up @@ -677,7 +683,9 @@ of [keepachangelog.com](http://keepachangelog.com/).

- Add `loose-schema` function.

[Unreleased]: https://github.com/macielti/common-clj/compare/v25.51.49...HEAD
[Unreleased]: https://github.com/macielti/common-clj/compare/v25.51.50...HEAD

[25.51.50]: https://github.com/macielti/common-clj/compare/v25.51.49...v25.51.50

[25.51.49]: https://github.com/macielti/common-clj/compare/v25.51.48...v25.51.49

Expand Down
6 changes: 3 additions & 3 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject net.clojars.macielti/common-clj "25.51.49"
(defproject net.clojars.macielti/common-clj "25.51.50"
:description "Just common Clojure code that I use across projects"
:url "https://github.com/macielti/common-clj"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
Expand Down Expand Up @@ -39,7 +39,6 @@
[com.datomic/datomic-free "0.9.5697"]
[com.stuartsierra/component "1.1.0"]
[siili/humanize "0.1.1"]
[prismatic/plumbing "0.6.0"]
[camel-snake-kebab "0.4.3"]
[prismatic/schema "1.4.1"]
[buddy/buddy-sign "3.5.351"]
Expand All @@ -53,7 +52,8 @@
[clj-commons/iapetos "0.1.14"]
[clojure.java-time "1.4.2"]
[clj-rate-limiter "0.1.6-RC1"]
[com.github.liquidz/antq "RELEASE"]]
[com.github.liquidz/antq "RELEASE"]
[dev.weavejester/medley "1.8.0"]]

:injections [(require 'hashp.core)]

Expand Down
12 changes: 6 additions & 6 deletions src/common_clj/component/kafka/consumer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
[common-clj.traceability.core :as common-traceability]
[io.pedestal.interceptor :as interceptor]
[io.pedestal.interceptor.chain :as chain]
[medley.core :as medley]
[overtone.at-at :as at-at]
[plumbing.core :as plumbing]
[schema.core :as s]
[taoensso.timbre :as timbre])
(:import (java.time Duration)
Expand Down Expand Up @@ -77,10 +77,10 @@
"key.deserializer" StringDeserializer
"bootstrap.servers" (get-in config [:config :bootstrap-server])
"group.id" (get-in config [:config :service-name])}
components (plumbing/assoc-when {}
:producer (:producer producer)
:config (:config config)
:datomic (:datomic datomic))
components (medley/assoc-some {}
:producer (:producer producer)
:config (:config config)
:datomic (:datomic datomic))
topics (get-in config [:config :topics])
context {:consumer-props consumer-props
:topics topics
Expand Down Expand Up @@ -124,7 +124,7 @@
(when-not (:producer producer)
(throw (ex-info "MockKafkaConsumer depends on MockKafkaProducer"
{:error :mock-kafka-producer-component-not-provided})))
(let [components (plumbing/assoc-when {}
(let [components (medley/assoc-some {}
:producer (:producer producer)
:config (:config config)
:datomic (:datomic datomic))
Expand Down
14 changes: 7 additions & 7 deletions src/common_clj/component/rabbitmq/consumer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[langohr.core :as rmq]
[langohr.queue :as lq]
[langohr.consumers :as lc]
[plumbing.core :as plumbing]
[medley.core :as medley]
[schema.core :as s]
[taoensso.timbre :as log]
[common-clj.component.rabbitmq.producer :as component.rabbitmq.producer])
Expand All @@ -23,12 +23,12 @@
uri (-> config-content :rabbitmq-uri)
connection (rmq/connect {:uri uri})
channel (lch/open connection)
components (plumbing/assoc-when {:config (:config config)}
:rabbitmq-producer (:rabbitmq-producer rabbitmq-producer)
:datomic (:datomic datomic)
:datalevin (:datalevin datalevin)
:postgresql (:postgresql postgresql)
:http-client (:http-client http-client))
components (medley/assoc-some {:config (:config config)}
:rabbitmq-producer (:rabbitmq-producer rabbitmq-producer)
:datomic (:datomic datomic)
:datalevin (:datalevin datalevin)
:postgresql (:postgresql postgresql)
:http-client (:http-client http-client))
service-name (:service-name config-content)]

(s/validate Consumers consumers)
Expand Down
22 changes: 11 additions & 11 deletions src/common_clj/component/service.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(:require [com.stuartsierra.component :as component]
[common-clj.io.interceptors :as io.interceptors]
[io.pedestal.http :as http]
[plumbing.core :as plumbing]))
[medley.core :as medley]))

(defrecord Service [routes config datomic datalevin postgresql rabbitmq-producer producer http-client prometheus rate-limiter telegram-producer]
component/Lifecycle
Expand All @@ -14,16 +14,16 @@
::http/port port
::http/type :jetty
::http/join? false}
components (plumbing/assoc-when {:config (:config config)}
:producer (:producer producer)
:rabbitmq-producer (:rabbitmq-producer rabbitmq-producer)
:datomic (:datomic datomic)
:datalevin (:datalevin datalevin)
:postgresql (:postgresql postgresql)
:http-client (:http-client http-client)
:prometheus (:prometheus prometheus)
:rate-limiter (:rate-limiter rate-limiter)
:telegram-producer (:telegram-producer telegram-producer))]
components (medley/assoc-some {:config (:config config)}
:producer (:producer producer)
:rabbitmq-producer (:rabbitmq-producer rabbitmq-producer)
:datomic (:datomic datomic)
:datalevin (:datalevin datalevin)
:postgresql (:postgresql postgresql)
:http-client (:http-client http-client)
:prometheus (:prometheus prometheus)
:rate-limiter (:rate-limiter rate-limiter)
:telegram-producer (:telegram-producer telegram-producer))]
(assoc component :service (http/start (-> service-map
http/default-interceptors
(update ::http/interceptors concat (io.interceptors/common-interceptors
Expand Down
8 changes: 4 additions & 4 deletions src/common_clj/io/interceptors/auth.clj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
(ns common-clj.io.interceptors.auth
(:require [schema.core :as s]
(:require [medley.core :as medley]
[schema.core :as s]
[cheshire.core :as json]
[io.pedestal.interceptor :as pedestal.interceptor]
[common-clj.error.core :as common-error]
[clj-http.client :as client]
[common-clj.schema.core :as common-schema]
[plumbing.core :as plumbing]
[taoensso.timbre :as log]))

(s/defschema GoogleRecaptchaV3ResponseTokenValidationResultWireIn
Expand All @@ -18,8 +18,8 @@

(s/defn wire->google-recaptcha-v3-response-token-validation-result :- GoogleRecaptchaV3ResponseTokenValidationResult
[{:keys [success score]} :- GoogleRecaptchaV3ResponseTokenValidationResultWireIn]
(plumbing/assoc-when {:validation-result/success success}
:validation-result/score score))
(medley/assoc-some {:validation-result/success success}
:validation-result/score score))


(s/defn ^:private validate-recaptcha-v3-token! :- GoogleRecaptchaV3ResponseTokenValidationResult
Expand Down

0 comments on commit 5fd9eb6

Please sign in to comment.