aws-lambda-haskell-runtime 4.1.2 → 4.2.2
raw patch · 6 files changed
+21/−31 lines, 6 filesdep +safe-exceptionsdep −safe-exceptions-checkedPVP ok
version bump matches the API change (PVP)
Dependencies added: safe-exceptions
Dependencies removed: safe-exceptions-checked
API changes (from Hackage documentation)
- Aws.Lambda: initialize :: Throws Parsing => Throws EnvironmentVariableNotSet => IORef context -> IO (Context context)
+ Aws.Lambda: initialize :: IORef context -> IO (Context context)
Files
- aws-lambda-haskell-runtime.cabal +3/−3
- src/Aws/Lambda/Runtime.hs +4/−9
- src/Aws/Lambda/Runtime/ApiInfo.hs +3/−4
- src/Aws/Lambda/Runtime/Context.hs +0/−4
- src/Aws/Lambda/Runtime/Environment.hs +10/−10
- src/Aws/Lambda/Runtime/Error.hs +1/−1
aws-lambda-haskell-runtime.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.1.+-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack name: aws-lambda-haskell-runtime-version: 4.1.2+version: 4.2.2 synopsis: Haskell runtime for AWS Lambda description: Please see the README on GitHub at <https://github.com/theam/aws-lambda-haskell-runtime#readme> category: AWS@@ -69,7 +69,7 @@ , mtl , path >0.7 , path-io- , safe-exceptions-checked+ , safe-exceptions , template-haskell , text , unordered-containers
src/Aws/Lambda/Runtime.hs view
@@ -19,8 +19,7 @@ import qualified Aws.Lambda.Runtime.Publish as Publish import Aws.Lambda.Runtime.StandaloneLambda.Types (StandaloneLambdaResponseBody (..)) import qualified Control.Exception as Unchecked-import Control.Exception.Safe.Checked (Throws, catch, throw)-import qualified Control.Exception.Safe.Checked as Checked+import Control.Exception.Safe import Control.Monad (forever) import Data.Aeson (encode) import Data.IORef (newIORef)@@ -44,11 +43,11 @@ context <- Context.setEventData context event ( ( ( invokeAndRun callback manager lambdaApi event context- `Checked.catch` \err -> Publish.parsingError err lambdaApi context manager+ `catch` \err -> Publish.parsingError err lambdaApi context manager )- `Checked.catch` \err -> Publish.invocationError err lambdaApi context manager+ `catch` \err -> Publish.invocationError err lambdaApi context manager )- `Checked.catch` \(err :: Error.EnvironmentVariableNotSet) -> Publish.runtimeInitError err lambdaApi context manager+ `catch` \(err :: Error.EnvironmentVariableNotSet) -> Publish.runtimeInitError err lambdaApi context manager ) `Unchecked.catch` \err -> Publish.invocationError err lambdaApi context manager @@ -60,8 +59,6 @@ } invokeAndRun ::- Throws Error.Invocation =>- Throws Error.EnvironmentVariableNotSet => Runtime.RunCallback handlerType context -> Http.Manager -> Text ->@@ -75,8 +72,6 @@ `catch` \err -> Publish.invocationError err lambdaApi context manager invokeWithCallback ::- Throws Error.Invocation =>- Throws Error.EnvironmentVariableNotSet => Runtime.RunCallback handlerType context -> ApiInfo.Event -> Context.Context context ->
src/Aws/Lambda/Runtime/ApiInfo.hs view
@@ -6,8 +6,7 @@ import qualified Aws.Lambda.Runtime.API.Endpoints as Endpoints import qualified Aws.Lambda.Runtime.Error as Error-import Control.Exception (IOException)-import Control.Exception.Safe.Checked+import Control.Exception.Safe import qualified Control.Monad as Monad import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as ByteString@@ -29,7 +28,7 @@ deriving (Show) -- | Performs a GET to the endpoint that provides the next event-fetchEvent :: Throws Error.Parsing => Http.Manager -> Text -> IO Event+fetchEvent :: Http.Manager -> Text -> IO Event fetchEvent manager lambdaApi = do response <- fetchApiData manager lambdaApi let body = Http.responseBody response@@ -42,7 +41,7 @@ request <- Http.parseRequest . Text.unpack $ endpoint keepRetrying $ Http.httpLbs request manager -reduceEvent :: Throws Error.Parsing => Event -> (Http.HeaderName, ByteString) -> IO Event+reduceEvent :: Event -> (Http.HeaderName, ByteString) -> IO Event reduceEvent event header = case header of ("Lambda-Runtime-Deadline-Ms", value) ->
src/Aws/Lambda/Runtime/Context.hs view
@@ -7,8 +7,6 @@ import qualified Aws.Lambda.Runtime.ApiInfo as ApiInfo import qualified Aws.Lambda.Runtime.Environment as Environment-import qualified Aws.Lambda.Runtime.Error as Error-import Control.Exception.Safe.Checked (Throws) import Data.IORef (IORef) import Data.Text (Text) @@ -28,8 +26,6 @@ -- | Initializes the context out of the environment initialize ::- Throws Error.Parsing =>- Throws Error.EnvironmentVariableNotSet => IORef context -> IO (Context context) initialize customContextRef = do
src/Aws/Lambda/Runtime/Environment.hs view
@@ -14,43 +14,43 @@ where import qualified Aws.Lambda.Runtime.Error as Error-import Control.Exception.Safe.Checked (Throws, throw)+import Control.Exception.Safe (throw) import Data.Text (Text, pack, unpack) import qualified System.Environment as Environment import qualified Text.Read as Read -logGroupName :: Throws Error.EnvironmentVariableNotSet => IO Text+logGroupName :: IO Text logGroupName = readEnvironmentVariable "AWS_LAMBDA_LOG_GROUP_NAME" -logStreamName :: Throws Error.EnvironmentVariableNotSet => IO Text+logStreamName :: IO Text logStreamName = readEnvironmentVariable "AWS_LAMBDA_LOG_STREAM_NAME" -functionVersion :: Throws Error.EnvironmentVariableNotSet => IO Text+functionVersion :: IO Text functionVersion = readEnvironmentVariable "AWS_LAMBDA_FUNCTION_VERSION" -functionName :: Throws Error.EnvironmentVariableNotSet => IO Text+functionName :: IO Text functionName = readEnvironmentVariable "AWS_LAMBDA_FUNCTION_NAME" setXRayTrace :: Text -> IO () setXRayTrace = Environment.setEnv "_X_AMZN_TRACE_ID" . unpack -taskRoot :: Throws Error.EnvironmentVariableNotSet => IO Text+taskRoot :: IO Text taskRoot = readEnvironmentVariable "LAMBDA_TASK_ROOT" -handlerName :: Throws Error.EnvironmentVariableNotSet => IO Text+handlerName :: IO Text handlerName = readEnvironmentVariable "_HANDLER" -apiEndpoint :: Throws Error.EnvironmentVariableNotSet => IO Text+apiEndpoint :: IO Text apiEndpoint = readEnvironmentVariable "AWS_LAMBDA_RUNTIME_API" -functionMemory :: Throws Error.Parsing => Throws Error.EnvironmentVariableNotSet => IO Int+functionMemory :: IO Int functionMemory = do let envVar = "AWS_LAMBDA_FUNCTION_MEMORY_SIZE" memoryValue <- readEnvironmentVariable envVar@@ -58,7 +58,7 @@ Just value -> pure value Nothing -> throw (Error.Parsing envVar memoryValue envVar) -readEnvironmentVariable :: Throws Error.EnvironmentVariableNotSet => Text -> IO Text+readEnvironmentVariable :: Text -> IO Text readEnvironmentVariable envVar = do v <- Environment.lookupEnv (unpack envVar) case v of
src/Aws/Lambda/Runtime/Error.hs view
@@ -6,7 +6,7 @@ ) where -import Control.Exception.Safe.Checked (Exception)+import Control.Exception.Safe import Data.Aeson (ToJSON (..), object, (.=)) import qualified Data.ByteString.Lazy as LBS import Data.Text (Text)