Skip to content

Commit 64086e2

Browse files
authored
Merge branch 'main' into update/cats-effect-3.5.4
2 parents 9a43015 + 98ec8b2 commit 64086e2

File tree

8 files changed

+31
-29
lines changed

8 files changed

+31
-29
lines changed

.scalafmt.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = 3.7.17
1+
version = 3.8.0
22

33
style = default
44

CODE_OF_CONDUCT.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ A thin wrapper for the [Launch Darkly Java server SDK](https://github.com/launch
3535
_ <- IO.println(s"Double Variation: ${double}")
3636

3737
// JSON Variant
38-
json <- client.jsonVariation("JSON-FLAG", new LDContext("context-name"), defaultValue = LDValue.of("{}"))
38+
json <- client.jsonValueVariation("JSON-FLAG", new LDContext("context-name"), defaultValue = LDValue.of("{}"))
3939
_ <- IO.println(s"JSON Variation: ${json}")
4040
} yield ()
4141
}

build.sbt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// https://typelevel.org/sbt-typelevel/faq.html#what-is-a-base-version-anyway
2-
ThisBuild / tlBaseVersion := "0.4" // your current series x.y
2+
ThisBuild / tlBaseVersion := "0.5" // your current series x.y
33

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

2020
val Scala213 = "2.13.12"
21-
ThisBuild / crossScalaVersions := Seq(Scala213, "3.3.1")
21+
ThisBuild / crossScalaVersions := Seq(Scala213, "3.3.3")
2222
ThisBuild / scalaVersion := Scala213 // the default Scala
2323

2424
lazy val root = tlCrossRootProject.aggregate(core, testkit)
@@ -29,7 +29,7 @@ lazy val testkit = crossProject(JVMPlatform)
2929
.settings(
3030
name := "catapult-testkit",
3131
libraryDependencies ++= Seq(
32-
"com.disneystreaming" %% "weaver-cats" % "0.8.3" % Test
32+
"com.disneystreaming" %% "weaver-cats" % "0.8.4" % Test
3333
),
3434
testFrameworks += new TestFramework("weaver.framework.CatsEffect"),
3535
tlVersionIntroduced := List("2.13", "3").map(_ -> "0.1.0").toMap,
@@ -44,7 +44,7 @@ lazy val core = crossProject(JVMPlatform)
4444
libraryDependencies ++= Seq(
4545
"org.typelevel" %%% "cats-core" % "2.10.0",
4646
"org.typelevel" %%% "cats-effect" % "3.5.4",
47-
"co.fs2" %%% "fs2-core" % "3.9.2",
47+
"co.fs2" %%% "fs2-core" % "3.9.4",
4848
"com.launchdarkly" % "launchdarkly-java-server-sdk" % "7.1.1",
4949
),
5050
)

core/src/main/scala/org.typelevel/catapult/LaunchDarklyClient.scala

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,35 @@ trait LaunchDarklyClient[F[_]] {
8181
* @return the flag value, suspended in the `F` effect. If evaluation fails for any reason, returns the default value.
8282
* @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]]
8383
*/
84-
def jsonVariation[Ctx: ContextEncoder](
84+
def jsonValueVariation[Ctx: ContextEncoder](
8585
featureKey: String,
8686
context: Ctx,
8787
defaultValue: LDValue,
8888
): F[LDValue]
8989

90+
@deprecated("use jsonValueVariation", "0.5.0")
91+
final def jsonVariation[Ctx: ContextEncoder](
92+
featureKey: String,
93+
context: Ctx,
94+
defaultValue: LDValue,
95+
): F[LDValue] = jsonValueVariation(featureKey, context, defaultValue)
96+
9097
/** @param featureKey the key of the flag to be evaluated
9198
* @param context the context against which the flag is being evaluated
9299
* @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.
93100
* @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`
94101
* @see [[https://javadoc.io/doc/com.launchdarkly/launchdarkly-java-server-sdk/latest/com/launchdarkly/sdk/server/interfaces/FlagTracker.html FlagTracker]]
95102
*/
96-
def listen[Ctx: ContextEncoder](featureKey: String, context: Ctx): Stream[F, FlagValueChangeEvent]
103+
def trackFlagValueChanges[Ctx: ContextEncoder](
104+
featureKey: String,
105+
context: Ctx,
106+
): Stream[F, FlagValueChangeEvent]
107+
108+
@deprecated("use trackFlagValueChanges", "0.5.0")
109+
final def listen[Ctx: ContextEncoder](
110+
featureKey: String,
111+
context: Ctx,
112+
): Stream[F, FlagValueChangeEvent] = trackFlagValueChanges(featureKey, context)
97113

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

134-
override def listen[Ctx](
150+
override def trackFlagValueChanges[Ctx](
135151
featureKey: String,
136152
context: Ctx,
137153
)(implicit ctxEncoder: ContextEncoder[Ctx]): Stream[F, FlagValueChangeEvent] =
@@ -188,7 +204,7 @@ object LaunchDarklyClient {
188204
)(implicit ctxEncoder: ContextEncoder[Ctx]): F[Double] =
189205
unsafeWithJavaClient(_.doubleVariation(featureKey, ctxEncoder.encode(context), default))
190206

191-
override def jsonVariation[Ctx](
207+
override def jsonValueVariation[Ctx](
192208
featureKey: String,
193209
context: Ctx,
194210
default: LDValue,
@@ -202,10 +218,10 @@ object LaunchDarklyClient {
202218
self.unsafeWithJavaClient(f)
203219
)
204220

205-
override def listen[Ctx](featureKey: String, context: Ctx)(implicit
221+
override def trackFlagValueChanges[Ctx](featureKey: String, context: Ctx)(implicit
206222
ctxEncoder: ContextEncoder[Ctx]
207223
): Stream[G, FlagValueChangeEvent] =
208-
self.listen(featureKey, context).translate(fk)
224+
self.trackFlagValueChanges(featureKey, context).translate(fk)
209225

210226
override def flush: G[Unit] = fk(self.flush)
211227
}

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.9.8
1+
sbt.version=1.9.9

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.6.4")
22
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.6.4")
3-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0")
3+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.15.0")

testkit/src/test/scala/org/typelevel/catapult/VariationTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ object VariationTests extends SimpleIOSuite {
5252
received <- IO.ref[Chain[FlagValueChangeEvent]](Chain.empty)
5353
_ <- sup.supervise(
5454
client
55-
.listen("foo", LDContext.create("testContext"))
55+
.trackFlagValueChanges("foo", LDContext.create("testContext"))
5656
.evalTap(event => received.update(_.append(event)))
5757
.compile
5858
.drain

0 commit comments

Comments
 (0)