@@ -20,7 +20,7 @@ import NIOCore
2020/// Background work can also be executed after returning the response. After closing the response stream by calling
2121/// ``LambdaResponseStreamWriter/finish()`` or ``LambdaResponseStreamWriter/writeAndFinish(_:)``,
2222/// the ``handle(_:responseWriter:context:)`` function is free to execute any background work.
23- package protocol StreamingLambdaHandler {
23+ public protocol StreamingLambdaHandler {
2424 /// The handler function -- implement the business logic of the Lambda function here.
2525 /// - Parameters:
2626 /// - event: The invocation's input data.
@@ -45,7 +45,7 @@ package protocol StreamingLambdaHandler {
4545
4646/// A writer object to write the Lambda response stream into. The HTTP response is started lazily.
4747/// before the first call to ``write(_:)`` or ``writeAndFinish(_:)``.
48- package protocol LambdaResponseStreamWriter {
48+ public protocol LambdaResponseStreamWriter {
4949 /// Write a response part into the stream. Bytes written are streamed continually.
5050 /// - Parameter buffer: The buffer to write.
5151 func write( _ buffer: ByteBuffer ) async throws
@@ -64,7 +64,7 @@ package protocol LambdaResponseStreamWriter {
6464///
6565/// - note: This handler protocol does not support response streaming because the output has to be encoded prior to it being sent, e.g. it is not possible to encode a partial/incomplete JSON string.
6666/// This protocol also does not support the execution of background work after the response has been returned -- the ``LambdaWithBackgroundProcessingHandler`` protocol caters for such use-cases.
67- package protocol LambdaHandler {
67+ public protocol LambdaHandler {
6868 /// Generic input type.
6969 /// The body of the request sent to Lambda will be decoded into this type for the handler to consume.
7070 associatedtype Event : Decodable
@@ -85,7 +85,7 @@ package protocol LambdaHandler {
8585/// This is achieved by not having a return type in the `handle` function. The output is instead written into a
8686/// ``LambdaResponseWriter``that is passed in as an argument, meaning that the ``handle(_:)`` function is then free to implement
8787/// any background work after the result has been sent to the AWS Lambda control plane.
88- package protocol LambdaWithBackgroundProcessingHandler {
88+ public protocol LambdaWithBackgroundProcessingHandler {
8989 /// Generic input type.
9090 /// The body of the request sent to Lambda will be decoded into this type for the handler to consume.
9191 associatedtype Event : Decodable
@@ -109,7 +109,7 @@ package protocol LambdaWithBackgroundProcessingHandler {
109109/// Used with ``LambdaWithBackgroundProcessingHandler``.
110110/// A mechanism to "return" an output from ``LambdaWithBackgroundProcessingHandler/handle(_:outputWriter:context:)`` without the function needing to
111111/// have a return type and exit at that point. This allows for background work to be executed _after_ a response has been sent to the AWS Lambda response endpoint.
112- package protocol LambdaResponseWriter < Output> {
112+ public protocol LambdaResponseWriter < Output> {
113113 associatedtype Output
114114 /// Sends the generic ``Output`` object (representing the computed result of the handler)
115115 /// to the AWS Lambda response endpoint.
@@ -120,12 +120,12 @@ package protocol LambdaResponseWriter<Output> {
120120
121121/// A ``StreamingLambdaHandler`` conforming handler object that can be constructed with a closure.
122122/// Allows for a handler to be defined in a clean manner, leveraging Swift's trailing closure syntax.
123- package struct StreamingClosureHandler : StreamingLambdaHandler {
123+ public struct StreamingClosureHandler : StreamingLambdaHandler {
124124 let body : @Sendable ( ByteBuffer, LambdaResponseStreamWriter, LambdaContext) async throws -> Void
125125
126126 /// Initialize an instance from a handler function in the form of a closure.
127127 /// - Parameter body: The handler function written as a closure.
128- package init (
128+ public init (
129129 body: @Sendable @escaping ( ByteBuffer, LambdaResponseStreamWriter, LambdaContext) async throws -> Void
130130 ) {
131131 self . body = body
@@ -137,7 +137,7 @@ package struct StreamingClosureHandler: StreamingLambdaHandler {
137137 /// - responseWriter: A ``LambdaResponseStreamWriter`` to write the invocation's response to.
138138 /// If no response or error is written to `responseWriter` an error will be reported to the invoker.
139139 /// - context: The ``LambdaContext`` containing the invocation's metadata.
140- package func handle(
140+ public func handle(
141141 _ request: ByteBuffer ,
142142 responseWriter: some LambdaResponseStreamWriter ,
143143 context: LambdaContext
@@ -148,34 +148,34 @@ package struct StreamingClosureHandler: StreamingLambdaHandler {
148148
149149/// A ``LambdaHandler`` conforming handler object that can be constructed with a closure.
150150/// Allows for a handler to be defined in a clean manner, leveraging Swift's trailing closure syntax.
151- package struct ClosureHandler < Event: Decodable , Output> : LambdaHandler {
151+ public struct ClosureHandler < Event: Decodable , Output> : LambdaHandler {
152152 let body : ( Event , LambdaContext ) async throws -> Output
153153
154154 /// Initialize with a closure handler over generic `Input` and `Output` types.
155155 /// - Parameter body: The handler function written as a closure.
156- package init ( body: @escaping ( Event , LambdaContext ) async throws -> Output ) where Output: Encodable {
156+ public init ( body: @escaping ( Event , LambdaContext ) async throws -> Output ) where Output: Encodable {
157157 self . body = body
158158 }
159159
160160 /// Initialize with a closure handler over a generic `Input` type, and a `Void` `Output`.
161161 /// - Parameter body: The handler function written as a closure.
162- package init ( body: @escaping ( Event , LambdaContext ) async throws -> Void ) where Output == Void {
162+ public init ( body: @escaping ( Event , LambdaContext ) async throws -> Void ) where Output == Void {
163163 self . body = body
164164 }
165165
166166 /// Calls the provided `self.body` closure with the generic ``Event`` object representing the incoming event, and the ``LambdaContext``
167167 /// - Parameters:
168168 /// - event: The generic ``Event`` object representing the invocation's input data.
169169 /// - context: The ``LambdaContext`` containing the invocation's metadata.
170- package func handle( _ event: Event , context: LambdaContext ) async throws -> Output {
170+ public func handle( _ event: Event , context: LambdaContext ) async throws -> Output {
171171 try await self . body ( event, context)
172172 }
173173}
174174
175175extension LambdaRuntime {
176176 /// Initialize an instance with a ``StreamingLambdaHandler`` in the form of a closure.
177177 /// - Parameter body: The handler in the form of a closure.
178- package convenience init (
178+ public convenience init (
179179 body: @Sendable @escaping ( ByteBuffer, LambdaResponseStreamWriter, LambdaContext) async throws -> Void
180180 ) where Handler == StreamingClosureHandler {
181181 self . init ( handler: StreamingClosureHandler ( body: body) )
@@ -185,7 +185,7 @@ extension LambdaRuntime {
185185 /// - Parameter body: The handler in the form of a closure.
186186 /// - Parameter encoder: The encoder object that will be used to encode the generic ``Output`` into a ``ByteBuffer``.
187187 /// - Parameter decoder: The decoder object that will be used to decode the incoming ``ByteBuffer`` event into the generic ``Event`` type.
188- package convenience init <
188+ public convenience init <
189189 Event: Decodable ,
190190 Output: Encodable ,
191191 Encoder: LambdaOutputEncoder ,
@@ -217,7 +217,7 @@ extension LambdaRuntime {
217217 /// - Parameter body: The handler in the form of a closure.
218218 /// - Parameter encoder: The encoder object that will be used to encode the generic ``Output`` into a ``ByteBuffer``.
219219 /// - Parameter decoder: The decoder object that will be used to decode the incoming ``ByteBuffer`` event into the generic ``Event`` type.
220- package convenience init < Event: Decodable , Decoder: LambdaEventDecoder > (
220+ public convenience init < Event: Decodable , Decoder: LambdaEventDecoder > (
221221 decoder: Decoder ,
222222 body: @escaping ( Event , LambdaContext ) async throws -> Void
223223 )
0 commit comments