@@ -26,7 +26,7 @@ package protocol StreamingLambdaHandler {
26
26
/// - event: The invocation's input data.
27
27
/// - responseWriter: A ``LambdaResponseStreamWriter`` to write the invocation's response to.
28
28
/// If no response or error is written to `responseWriter` an error will be reported to the invoker.
29
- /// - context: The ``NewLambdaContext `` containing the invocation's metadata.
29
+ /// - context: The ``LambdaContext `` containing the invocation's metadata.
30
30
/// - Throws:
31
31
/// How the thrown error will be handled by the runtime:
32
32
/// - An invocation error will be reported if the error is thrown before the first call to
@@ -39,7 +39,7 @@ package protocol StreamingLambdaHandler {
39
39
mutating func handle(
40
40
_ event: ByteBuffer ,
41
41
responseWriter: some LambdaResponseStreamWriter ,
42
- context: NewLambdaContext
42
+ context: LambdaContext
43
43
) async throws
44
44
}
45
45
@@ -64,7 +64,7 @@ package protocol LambdaResponseStreamWriter {
64
64
///
65
65
/// - 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.
66
66
/// 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 NewLambdaHandler {
67
+ package protocol LambdaHandler {
68
68
/// Generic input type.
69
69
/// The body of the request sent to Lambda will be decoded into this type for the handler to consume.
70
70
associatedtype Event : Decodable
@@ -75,12 +75,12 @@ package protocol NewLambdaHandler {
75
75
/// Implement the business logic of the Lambda function here.
76
76
/// - Parameters:
77
77
/// - event: The generic ``Event`` object representing the invocation's input data.
78
- /// - context: The ``NewLambdaContext `` containing the invocation's metadata.
78
+ /// - context: The ``LambdaContext `` containing the invocation's metadata.
79
79
/// - Returns: A generic ``Output`` object representing the computed result.
80
- func handle( _ event: Event , context: NewLambdaContext ) async throws -> Output
80
+ func handle( _ event: Event , context: LambdaContext ) async throws -> Output
81
81
}
82
82
83
- /// This protocol is exactly like ``NewLambdaHandler ``, with the only difference being the added support for executing background
83
+ /// This protocol is exactly like ``LambdaHandler ``, with the only difference being the added support for executing background
84
84
/// work after the result has been sent to the AWS Lambda control plane.
85
85
/// This is achieved by not having a return type in the `handle` function. The output is instead written into a
86
86
/// ``LambdaResponseWriter``that is passed in as an argument, meaning that the ``handle(_:)`` function is then free to implement
@@ -98,11 +98,11 @@ package protocol LambdaWithBackgroundProcessingHandler {
98
98
/// - event: The generic ``Event`` object representing the invocation's input data.
99
99
/// - outputWriter: The writer to send the computed response to. A call to `outputWriter.write(_:)` will return the response to the AWS Lambda response endpoint.
100
100
/// Any background work can then be executed before returning.
101
- /// - context: The ``NewLambdaContext `` containing the invocation's metadata.
101
+ /// - context: The ``LambdaContext `` containing the invocation's metadata.
102
102
func handle(
103
103
_ event: Event ,
104
104
outputWriter: some LambdaResponseWriter < Output > ,
105
- context: NewLambdaContext
105
+ context: LambdaContext
106
106
) async throws
107
107
}
108
108
@@ -121,67 +121,67 @@ package protocol LambdaResponseWriter<Output> {
121
121
/// A ``StreamingLambdaHandler`` conforming handler object that can be constructed with a closure.
122
122
/// Allows for a handler to be defined in a clean manner, leveraging Swift's trailing closure syntax.
123
123
package struct StreamingClosureHandler : StreamingLambdaHandler {
124
- let body : @Sendable ( ByteBuffer, LambdaResponseStreamWriter, NewLambdaContext ) async throws -> Void
124
+ let body : @Sendable ( ByteBuffer, LambdaResponseStreamWriter, LambdaContext ) async throws -> Void
125
125
126
126
/// Initialize an instance from a handler function in the form of a closure.
127
127
/// - Parameter body: The handler function written as a closure.
128
128
package init (
129
- body: @Sendable @escaping ( ByteBuffer, LambdaResponseStreamWriter, NewLambdaContext ) async throws -> Void
129
+ body: @Sendable @escaping ( ByteBuffer, LambdaResponseStreamWriter, LambdaContext ) async throws -> Void
130
130
) {
131
131
self . body = body
132
132
}
133
133
134
- /// Calls the provided `self.body` closure with the ``ByteBuffer`` invocation event, the ``LambdaResponseStreamWriter``, and the ``NewLambdaContext ``
134
+ /// Calls the provided `self.body` closure with the ``ByteBuffer`` invocation event, the ``LambdaResponseStreamWriter``, and the ``LambdaContext ``
135
135
/// - Parameters:
136
136
/// - event: The invocation's input data.
137
137
/// - responseWriter: A ``LambdaResponseStreamWriter`` to write the invocation's response to.
138
138
/// If no response or error is written to `responseWriter` an error will be reported to the invoker.
139
- /// - context: The ``NewLambdaContext `` containing the invocation's metadata.
139
+ /// - context: The ``LambdaContext `` containing the invocation's metadata.
140
140
package func handle(
141
141
_ request: ByteBuffer ,
142
142
responseWriter: some LambdaResponseStreamWriter ,
143
- context: NewLambdaContext
143
+ context: LambdaContext
144
144
) async throws {
145
145
try await self . body ( request, responseWriter, context)
146
146
}
147
147
}
148
148
149
- /// A ``NewLambdaHandler `` conforming handler object that can be constructed with a closure.
149
+ /// A ``LambdaHandler `` conforming handler object that can be constructed with a closure.
150
150
/// Allows for a handler to be defined in a clean manner, leveraging Swift's trailing closure syntax.
151
- package struct ClosureHandler < Event: Decodable , Output> : NewLambdaHandler {
152
- let body : ( Event , NewLambdaContext ) async throws -> Output
151
+ package struct ClosureHandler < Event: Decodable , Output> : LambdaHandler {
152
+ let body : ( Event , LambdaContext ) async throws -> Output
153
153
154
154
/// Initialize with a closure handler over generic `Input` and `Output` types.
155
155
/// - Parameter body: The handler function written as a closure.
156
- package init ( body: @escaping ( Event , NewLambdaContext ) async throws -> Output ) where Output: Encodable {
156
+ package init ( body: @escaping ( Event , LambdaContext ) async throws -> Output ) where Output: Encodable {
157
157
self . body = body
158
158
}
159
159
160
160
/// Initialize with a closure handler over a generic `Input` type, and a `Void` `Output`.
161
161
/// - Parameter body: The handler function written as a closure.
162
- package init ( body: @escaping ( Event , NewLambdaContext ) async throws -> Void ) where Output == Void {
162
+ package init ( body: @escaping ( Event , LambdaContext ) async throws -> Void ) where Output == Void {
163
163
self . body = body
164
164
}
165
165
166
- /// Calls the provided `self.body` closure with the generic ``Event`` object representing the incoming event, and the ``NewLambdaContext ``
166
+ /// Calls the provided `self.body` closure with the generic ``Event`` object representing the incoming event, and the ``LambdaContext ``
167
167
/// - Parameters:
168
168
/// - event: The generic ``Event`` object representing the invocation's input data.
169
- /// - context: The ``NewLambdaContext `` containing the invocation's metadata.
170
- package func handle( _ event: Event , context: NewLambdaContext ) async throws -> Output {
169
+ /// - context: The ``LambdaContext `` containing the invocation's metadata.
170
+ package func handle( _ event: Event , context: LambdaContext ) async throws -> Output {
171
171
try await self . body ( event, context)
172
172
}
173
173
}
174
174
175
- extension NewLambdaRuntime {
175
+ extension LambdaRuntime {
176
176
/// Initialize an instance with a ``StreamingLambdaHandler`` in the form of a closure.
177
177
/// - Parameter body: The handler in the form of a closure.
178
178
package convenience init (
179
- body: @Sendable @escaping ( ByteBuffer, LambdaResponseStreamWriter, NewLambdaContext ) async throws -> Void
179
+ body: @Sendable @escaping ( ByteBuffer, LambdaResponseStreamWriter, LambdaContext ) async throws -> Void
180
180
) where Handler == StreamingClosureHandler {
181
181
self . init ( handler: StreamingClosureHandler ( body: body) )
182
182
}
183
183
184
- /// Initialize an instance with a ``NewLambdaHandler `` defined in the form of a closure **with a non-`Void` return type**, an encoder, and a decoder.
184
+ /// Initialize an instance with a ``LambdaHandler `` defined in the form of a closure **with a non-`Void` return type**, an encoder, and a decoder.
185
185
/// - Parameter body: The handler in the form of a closure.
186
186
/// - Parameter encoder: The encoder object that will be used to encode the generic ``Output`` into a ``ByteBuffer``.
187
187
/// - Parameter decoder: The decoder object that will be used to decode the incoming ``ByteBuffer`` event into the generic ``Event`` type.
@@ -193,7 +193,7 @@ extension NewLambdaRuntime {
193
193
> (
194
194
encoder: Encoder ,
195
195
decoder: Decoder ,
196
- body: @escaping ( Event , NewLambdaContext ) async throws -> Output
196
+ body: @escaping ( Event , LambdaContext ) async throws -> Output
197
197
)
198
198
where
199
199
Handler == LambdaCodableAdapter <
@@ -213,13 +213,13 @@ extension NewLambdaRuntime {
213
213
self . init ( handler: handler)
214
214
}
215
215
216
- /// Initialize an instance with a ``NewLambdaHandler `` defined in the form of a closure **with a `Void` return type**, an encoder, and a decoder.
216
+ /// Initialize an instance with a ``LambdaHandler `` defined in the form of a closure **with a `Void` return type**, an encoder, and a decoder.
217
217
/// - Parameter body: The handler in the form of a closure.
218
218
/// - Parameter encoder: The encoder object that will be used to encode the generic ``Output`` into a ``ByteBuffer``.
219
219
/// - Parameter decoder: The decoder object that will be used to decode the incoming ``ByteBuffer`` event into the generic ``Event`` type.
220
220
package convenience init < Event: Decodable , Decoder: LambdaEventDecoder > (
221
221
decoder: Decoder ,
222
- body: @escaping ( Event , NewLambdaContext ) async throws -> Void
222
+ body: @escaping ( Event , LambdaContext ) async throws -> Void
223
223
)
224
224
where
225
225
Handler == LambdaCodableAdapter <
0 commit comments