Skip to content

Commit

Permalink
Merge branch 'main' into update/cats-effect-3.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
averymcnab authored Mar 28, 2024
2 parents 9a43015 + 98ec8b2 commit 64086e2
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.7.17
version = 3.8.0

style = default

Expand Down
14 changes: 0 additions & 14 deletions CODE_OF_CONDUCT.md

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ A thin wrapper for the [Launch Darkly Java server SDK](https://github.com/launch
_ <- IO.println(s"Double Variation: ${double}")

// JSON Variant
json <- client.jsonVariation("JSON-FLAG", new LDContext("context-name"), defaultValue = LDValue.of("{}"))
json <- client.jsonValueVariation("JSON-FLAG", new LDContext("context-name"), defaultValue = LDValue.of("{}"))
_ <- IO.println(s"JSON Variation: ${json}")
} yield ()
}
Expand Down
8 changes: 4 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// https://typelevel.org/sbt-typelevel/faq.html#what-is-a-base-version-anyway
ThisBuild / tlBaseVersion := "0.4" // your current series x.y
ThisBuild / tlBaseVersion := "0.5" // your current series x.y

ThisBuild / organization := "org.typelevel"
ThisBuild / organizationName := "Typelevel"
Expand All @@ -18,7 +18,7 @@ ThisBuild / tlSonatypeUseLegacyHost := false
ThisBuild / tlSitePublishBranch := Some("main")

val Scala213 = "2.13.12"
ThisBuild / crossScalaVersions := Seq(Scala213, "3.3.1")
ThisBuild / crossScalaVersions := Seq(Scala213, "3.3.3")
ThisBuild / scalaVersion := Scala213 // the default Scala

lazy val root = tlCrossRootProject.aggregate(core, testkit)
Expand All @@ -29,7 +29,7 @@ lazy val testkit = crossProject(JVMPlatform)
.settings(
name := "catapult-testkit",
libraryDependencies ++= Seq(
"com.disneystreaming" %% "weaver-cats" % "0.8.3" % Test
"com.disneystreaming" %% "weaver-cats" % "0.8.4" % Test
),
testFrameworks += new TestFramework("weaver.framework.CatsEffect"),
tlVersionIntroduced := List("2.13", "3").map(_ -> "0.1.0").toMap,
Expand All @@ -44,7 +44,7 @@ lazy val core = crossProject(JVMPlatform)
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % "2.10.0",
"org.typelevel" %%% "cats-effect" % "3.5.4",
"co.fs2" %%% "fs2-core" % "3.9.2",
"co.fs2" %%% "fs2-core" % "3.9.4",
"com.launchdarkly" % "launchdarkly-java-server-sdk" % "7.1.1",
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,35 @@ trait LaunchDarklyClient[F[_]] {
* @return the flag value, suspended in the `F` effect. If evaluation fails for any reason, returns the default value.
* @see [[https://javadoc.io/doc/com.launchdarkly/launchdarkly-java-server-sdk/latest/com/launchdarkly/sdk/server/interfaces/LDClientInterface.html#jsonValueVariation(java.lang.String,com.launchdarkly.sdk.LDContext,com.launchdarkly.sdk.LDValue) LDClientInterface#jsonValueVariation]]
*/
def jsonVariation[Ctx: ContextEncoder](
def jsonValueVariation[Ctx: ContextEncoder](
featureKey: String,
context: Ctx,
defaultValue: LDValue,
): F[LDValue]

@deprecated("use jsonValueVariation", "0.5.0")
final def jsonVariation[Ctx: ContextEncoder](
featureKey: String,
context: Ctx,
defaultValue: LDValue,
): F[LDValue] = jsonValueVariation(featureKey, context, defaultValue)

/** @param featureKey the key of the flag to be evaluated
* @param context the context against which the flag is being evaluated
* @tparam Ctx the type representing the context; this can be [[https://javadoc.io/doc/com.launchdarkly/launchdarkly-java-server-sdk/latest/com/launchdarkly/sdk/LDContext.html LDContext]], [[https://javadoc.io/doc/com.launchdarkly/launchdarkly-java-server-sdk/latest/com/launchdarkly/sdk/LDUser.html LDUser]], or any type with a [[ContextEncoder]] instance in scope.
* @return A `Stream` of [[https://javadoc.io/doc/com.launchdarkly/launchdarkly-java-server-sdk/latest/com/launchdarkly/sdk/server/interfaces/FlagValueChangeEvent.html FlagValueChangeEvent]] instances representing changes to the value of the flag in the provided context. Note: if the flag value changes multiple times in quick succession, some intermediate values may be missed; for example, a change from 1` to `2` to `3` may be represented only as a change from `1` to `3`
* @see [[https://javadoc.io/doc/com.launchdarkly/launchdarkly-java-server-sdk/latest/com/launchdarkly/sdk/server/interfaces/FlagTracker.html FlagTracker]]
*/
def listen[Ctx: ContextEncoder](featureKey: String, context: Ctx): Stream[F, FlagValueChangeEvent]
def trackFlagValueChanges[Ctx: ContextEncoder](
featureKey: String,
context: Ctx,
): Stream[F, FlagValueChangeEvent]

@deprecated("use trackFlagValueChanges", "0.5.0")
final def listen[Ctx: ContextEncoder](
featureKey: String,
context: Ctx,
): Stream[F, FlagValueChangeEvent] = trackFlagValueChanges(featureKey, context)

/** @see [[https://javadoc.io/doc/com.launchdarkly/launchdarkly-java-server-sdk/latest/com/launchdarkly/sdk/server/interfaces/LDClientInterface.html#flush() LDClientInterface#flush]]
*/
Expand Down Expand Up @@ -131,7 +147,7 @@ object LaunchDarklyClient {
override def unsafeWithJavaClient[A](f: LDClient => A): F[A] =
F.blocking(f(ldClient))

override def listen[Ctx](
override def trackFlagValueChanges[Ctx](
featureKey: String,
context: Ctx,
)(implicit ctxEncoder: ContextEncoder[Ctx]): Stream[F, FlagValueChangeEvent] =
Expand Down Expand Up @@ -188,7 +204,7 @@ object LaunchDarklyClient {
)(implicit ctxEncoder: ContextEncoder[Ctx]): F[Double] =
unsafeWithJavaClient(_.doubleVariation(featureKey, ctxEncoder.encode(context), default))

override def jsonVariation[Ctx](
override def jsonValueVariation[Ctx](
featureKey: String,
context: Ctx,
default: LDValue,
Expand All @@ -202,10 +218,10 @@ object LaunchDarklyClient {
self.unsafeWithJavaClient(f)
)

override def listen[Ctx](featureKey: String, context: Ctx)(implicit
override def trackFlagValueChanges[Ctx](featureKey: String, context: Ctx)(implicit
ctxEncoder: ContextEncoder[Ctx]
): Stream[G, FlagValueChangeEvent] =
self.listen(featureKey, context).translate(fk)
self.trackFlagValueChanges(featureKey, context).translate(fk)

override def flush: G[Unit] = fk(self.flush)
}
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.8
sbt.version=1.9.9
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.6.4")
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.6.4")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.15.0")
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ object VariationTests extends SimpleIOSuite {
received <- IO.ref[Chain[FlagValueChangeEvent]](Chain.empty)
_ <- sup.supervise(
client
.listen("foo", LDContext.create("testContext"))
.trackFlagValueChanges("foo", LDContext.create("testContext"))
.evalTap(event => received.update(_.append(event)))
.compile
.drain
Expand Down

0 comments on commit 64086e2

Please sign in to comment.