packages feed

launchdarkly-server-sdk 4.0.1 → 4.0.2

raw patch · 7 files changed

+29/−21 lines, 7 filesdep −vectorPVP ok

version bump matches the API change (PVP)

Dependencies removed: vector

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -2,6 +2,17 @@  All notable changes to the LaunchDarkly Haskell Server-side SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org). +## [4.0.2](https://github.com/launchdarkly/haskell-server-sdk/compare/4.0.1...4.0.2) (2024-02-01)+++### Bug Fixes++* **deps:** Drop explicit dependency on vector ([#69](https://github.com/launchdarkly/haskell-server-sdk/issues/69)) ([3bb826d](https://github.com/launchdarkly/haskell-server-sdk/commit/3bb826da77f34983abebe84612dfa9d7f8c346c9))++## [4.0.1] - 2023-10-26+### Removed:+- Eliminated unnecessary and noisy log message+ ## [4.0.0] - 2023-02-21 The latest version of this SDK supports LaunchDarkly's new custom contexts feature. Contexts are an evolution of a previously-existing concept, "users." Contexts let you create targeting rules for feature flags based on a variety of different information, including attributes pertaining to users, organizations, devices, and more. You can even combine contexts to create "multi-contexts." 
README.md view
@@ -1,6 +1,6 @@ # LaunchDarkly Server-side SDK for Haskell -[![CircleCI](https://circleci.com/gh/launchdarkly/haskell-server-sdk.svg?style=svg)](https://circleci.com/gh/launchdarkly/haskell-server-sdk)+[![Run CI](https://github.com/launchdarkly/haskell-server-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/launchdarkly/haskell-server-sdk/actions/workflows/ci.yml)  The LaunchDarkly Server-side SDK for Haskell is designed primarily for use in multi-user systems such as web servers and applications. It follows the server-side LaunchDarkly model for multi-user contexts. It is not intended for use in desktop and embedded systems applications. 
launchdarkly-server-sdk.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           launchdarkly-server-sdk-version:        4.0.1+version:        4.0.2 synopsis:       Server-side SDK for integrating with LaunchDarkly description:    Please see the README on GitHub at <https://github.com/launchdarkly/haskell-server-sdk#readme> category:       Web@@ -124,7 +124,6 @@     , time >=1.9.3 && <1.13     , unordered-containers >=0.2.10.0 && <0.3     , uuid >=1.3.13 && <1.4-    , vector >=0.12.1.2 && <0.13     , yaml >=0.11.5.0 && <0.12   default-language: Haskell2010 @@ -235,6 +234,5 @@     , time >=1.9.3 && <1.13     , unordered-containers >=0.2.10.0 && <0.3     , uuid >=1.3.13 && <1.4-    , vector >=0.12.1.2 && <0.13     , yaml >=0.11.5.0 && <0.12   default-language: Haskell2010
src/LaunchDarkly/Server/Client/Internal.hs view
@@ -21,7 +21,7 @@  -- | The version string for this library. clientVersion :: Text-clientVersion = "4.0.1"+clientVersion = "4.0.2" -- x-release-please-version  -- | -- Client is the LaunchDarkly client. Client instances are thread-safe.
src/LaunchDarkly/Server/Context/Internal.hs view
@@ -45,7 +45,7 @@ import Data.Set (Set) import qualified Data.Set as S import Data.Text (Text, intercalate, replace, unpack)-import qualified Data.Vector as V+import qualified GHC.Exts as Exts (fromList) import GHC.Generics (Generic) import LaunchDarkly.AesonCompat (KeyMap, deleteKey, emptyObject, foldrWithKey, fromList, insertKey, keyMapUnion, lookupKey, mapValues, objectKeys, singleton, toList) import LaunchDarkly.Server.Config (Config)@@ -339,7 +339,7 @@             ( "_meta"             , case privateAttributes of                 Nothing -> Null-                Just attrs -> toJSON $ singleton "privateAttributes" (Array $ V.fromList $ map toJSON $ S.elems attrs)+                Just attrs -> toJSON $ singleton "privateAttributes" (Array $ Exts.fromList $ map toJSON $ S.elems attrs)             )         ] @@ -413,7 +413,7 @@ redactSingleContext :: Bool -> SingleContext -> Set Reference -> Value redactSingleContext includeKind context privateAttributes =     let State {context = redactedContext, redacted} = foldr applyRedaction State {context = fromList $ getMapOfRedactableProperties context, redacted = []} privateAttributes-        redactedValues = Array $ V.fromList $ map String redacted+        redactedValues = Array $ Exts.fromList $ map String redacted         required = fromList $ getMapOfRequiredProperties includeKind context      in case redacted of             [] -> Object $ keyMapUnion redactedContext required
src/LaunchDarkly/Server/Evaluate.hs view
@@ -22,7 +22,6 @@ import Data.Text (Text) import qualified Data.Text as T import Data.Text.Encoding (encodeUtf8)-import qualified Data.Vector as V import Data.Word (Word8) import GHC.Natural (Natural) @@ -334,7 +333,7 @@         Nothing -> Right False         Just ctx -> case getValueForReference (getField @"attribute" clause) ctx of             Null -> Right False-            Array a -> Right $ maybeNegate clause $ V.any (matchAnyClauseValue clause) a+            Array a -> Right $ maybeNegate clause $ any (matchAnyClauseValue clause) a             x -> Right $ maybeNegate clause $ matchAnyClauseValue clause x  clauseMatchesContext :: (Monad m, LaunchDarklyStoreRead store m) => store -> Clause -> Context -> HS.HashSet Text -> m (Either Text Bool)
test/Spec/Context.hs view
@@ -8,8 +8,8 @@ import Data.Maybe (fromJust) import qualified Data.Set as S import Data.Text (Text)-import qualified Data.Vector as V-import LaunchDarkly.AesonCompat (fromList, lookupKey)+import GHC.Exts (fromList)+import LaunchDarkly.AesonCompat (lookupKey) import LaunchDarkly.Server.Config (configSetAllAttributesPrivate, makeConfig) import LaunchDarkly.Server.Context import LaunchDarkly.Server.Context.Internal (redactContext)@@ -112,7 +112,7 @@                 makeContext "user-key" "user"                     & withName "Example"                     & withAnonymous False-                    & withAttribute "groups" (Array $ V.fromList ["beta_testers"])+                    & withAttribute "groups" (Array $ fromList ["beta_testers"])                     & withAttribute "address" address                     & withAttribute "preferences" preferences                     & withAttribute "complex/and-weird~attribute" "nailed it"@@ -133,7 +133,7 @@                 assertEqual "" (Bool False) $ getValueForReference (R.makeReference "anonymous") user                 assertEqual "" "Chicago" $ getValueForReference (R.makeReference "/address/city") user                 assertEqual "" "baseball" $ getValueForReference (R.makeReference "/preferences/favorites/sport") user-                assertEqual "" (Array $ V.fromList ["beta_testers"]) $ getValueForReference (R.makeReference "/groups") user+                assertEqual "" (Array $ fromList ["beta_testers"]) $ getValueForReference (R.makeReference "/groups") user                 assertEqual "" Null $ getValueForReference (R.makeReference "/groups/0") user                 assertEqual "" "nailed it" $ getValueForReference (R.makeReference "/complex~1and-weird~0attribute") user             )@@ -176,7 +176,7 @@                 setAndVerifyAttribute "anonymous" (Bool False) (Bool False) user                 setAndVerifyAttribute "anonymous" "false" (Bool True) user                 setAndVerifyAttribute "_meta" "anything" Null user-                setAndVerifyAttribute "privateAttributeNames" (Array $ V.fromList ["name"]) Null user+                setAndVerifyAttribute "privateAttributeNames" (Array $ fromList ["name"]) Null user                  setAndVerifyAttribute "kind" "org" "multi" multi                 setAndVerifyAttribute "key" "new-key" Null multi@@ -185,7 +185,7 @@                 setAndVerifyAttribute "anonymous" (Bool False) Null multi                 setAndVerifyAttribute "anonymous" "false" Null multi                 setAndVerifyAttribute "_meta" "anything" Null multi-                setAndVerifyAttribute "privateAttributeNames" (Array $ V.fromList ["name"]) Null multi+                setAndVerifyAttribute "privateAttributeNames" (Array $ fromList ["name"]) Null multi                  setAndVerifyAttribute "kind" "org" Null invalid                 setAndVerifyAttribute "key" "new-key" Null invalid@@ -194,7 +194,7 @@                 setAndVerifyAttribute "anonymous" (Bool False) Null invalid                 setAndVerifyAttribute "anonymous" "false" Null invalid                 setAndVerifyAttribute "_meta" "anything" Null invalid-                setAndVerifyAttribute "privateAttributeNames" (Array $ V.fromList ["name"]) Null invalid+                setAndVerifyAttribute "privateAttributeNames" (Array $ fromList ["name"]) Null invalid             )  canParseFromLegacyUserFormat :: Test@@ -263,7 +263,7 @@     config = makeConfig "sdk-key"      address = Object $ fromList [("city", "Chicago"), ("state", "IL")]-    hobbies = (Array $ V.fromList ["coding", "reading"])+    hobbies = (Array $ fromList ["coding", "reading"])      context =         makeContext "user-key" "user"@@ -278,7 +278,7 @@     decodedAsValue = fromJust $ decode jsonByteString :: Value     decodedIntoMap = case decodedAsValue of (Object o) -> o; _ -> error "expected object"     meta = case lookupKey "_meta" decodedIntoMap of (Just (Object o)) -> o; _ -> error "expected object"-    expectedRedacted = Array $ V.fromList ["/address/city", "name"]+    expectedRedacted = Array $ fromList ["/address/city", "name"]     expectedAddress = Object $ fromList [("state", "IL")]  canRedactAllAttributesCorrectly :: Test@@ -301,13 +301,13 @@             & withAttribute "firstName" "Sandy"             & withAttribute "lastName" "Beaches"             & withAttribute "address" address-            & withAttribute "hobbies" (Array $ V.fromList ["coding", "reading"])+            & withAttribute "hobbies" (Array $ fromList ["coding", "reading"])      jsonByteString = encode $ redactContext config context     decodedAsValue = fromJust $ decode jsonByteString :: Value     decodedIntoMap = case decodedAsValue of (Object o) -> o; _ -> error "expected object"     meta = case lookupKey "_meta" decodedIntoMap of (Just (Object o)) -> o; _ -> error "expected object"-    expectedRedacted = Array $ V.fromList ["address", "firstName", "hobbies", "lastName", "name"]+    expectedRedacted = Array $ fromList ["address", "firstName", "hobbies", "lastName", "name"]     expectedAddress = Object $ fromList [("state", "IL")]  allTests :: Test