Skip to content

Commit 26afac8

Browse files
authored
Merge branch 'main' into sebsto/new-plugin-proposal
2 parents 8db3148 + 41c5eda commit 26afac8

File tree

14 files changed

+118
-63
lines changed

14 files changed

+118
-63
lines changed

.github/workflows/scripts/check-archive-plugin.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,14 @@ unzip -l "${ZIP_FILE}" | grep --silent bootstrap
4040

4141
# if EXAMPLE is ResourcesPackaging, check if the ZIP file contains hello.txt
4242
if [ "$EXAMPLE" == "ResourcesPackaging" ]; then
43+
echo "Checking if resource was added to the ZIP file"
4344
unzip -l "${ZIP_FILE}" | grep --silent hello.txt
45+
SUCCESS=$?
46+
if [ "$SUCCESS" -eq 1 ]; then
47+
log "❌ Resource not found." && exit 1
48+
else
49+
log "✅ Resource found."
50+
fi
4451
fi
4552

4653
echo "✅ The archive plugin is OK with example ${EXAMPLE}"

Examples/CDK/infra/package-lock.json

Lines changed: 55 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Examples/CDK/infra/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
},
1212
"devDependencies": {
1313
"@types/jest": "^29.5.14",
14-
"@types/node": "22.7.9",
15-
"aws-cdk": "2.173.1",
14+
"@types/node": "22.13.10",
15+
"aws-cdk": "2.1003.0",
1616
"ts-node": "^10.9.2",
17-
"typescript": "~5.6.3"
17+
"typescript": "~5.8.2"
1818
},
1919
"dependencies": {
20-
"aws-cdk-lib": "^2.173.1",
20+
"aws-cdk-lib": "^2.189.1",
2121
"constructs": "^10.4.2"
2222
}
2323
}

Plugins/AWSLambdaPackager/Plugin.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,11 @@ struct AWSLambdaPackager: CommandPlugin {
250250
let relocatedResourcesDirectory = workingDirectory.appending(path: resourcesDirectoryName)
251251
if FileManager.default.fileExists(atPath: artifactURL.path()) {
252252
do {
253+
arguments.append(resourcesDirectoryName)
253254
try FileManager.default.copyItem(
254255
atPath: artifactURL.path(),
255256
toPath: relocatedResourcesDirectory.path()
256257
)
257-
arguments.append(resourcesDirectoryName)
258258
} catch let error as CocoaError {
259259

260260
// On Linux, when the build has been done with Docker,

Sources/AWSLambdaRuntime/ControlPlaneRequest.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,19 @@ enum ControlPlaneResponse: Hashable {
2828
case error(ErrorResponse)
2929
}
3030

31-
package struct InvocationMetadata: Hashable {
31+
@usableFromInline
32+
package struct InvocationMetadata: Hashable, Sendable {
33+
@usableFromInline
3234
package let requestID: String
35+
@usableFromInline
3336
package let deadlineInMillisSinceEpoch: Int64
37+
@usableFromInline
3438
package let invokedFunctionARN: String
39+
@usableFromInline
3540
package let traceID: String
41+
@usableFromInline
3642
package let clientContext: String?
43+
@usableFromInline
3744
package let cognitoIdentity: String?
3845

3946
package init(headers: HTTPHeaders) throws(LambdaRuntimeError) {

Sources/AWSLambdaRuntime/Lambda+LocalServer.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ extension Lambda {
4545
/// - body: Code to run within the context of the mock server. Typically this would be a Lambda.run function call.
4646
///
4747
/// - note: This API is designed strictly for local testing and is behind a DEBUG flag
48+
@usableFromInline
4849
static func withLocalServer(
4950
invocationEndpoint: String? = nil,
5051
_ body: sending @escaping () async throws -> Void
@@ -237,7 +238,7 @@ private struct LambdaHTTPServer {
237238
requestHead = head
238239

239240
case .body(let body):
240-
requestBody = body
241+
requestBody.setOrWriteImmutableBuffer(body)
241242

242243
case .end:
243244
precondition(requestHead != nil, "Received .end without .head")

Sources/AWSLambdaRuntime/Lambda.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import ucrt
3030
#endif
3131

3232
public enum Lambda {
33+
@inlinable
3334
package static func runLoop<RuntimeClient: LambdaRuntimeClientProtocol, Handler>(
3435
runtimeClient: RuntimeClient,
3536
handler: Handler,

Sources/AWSLambdaRuntime/LambdaContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public struct LambdaContext: CustomDebugStringConvertible, Sendable {
8888
self.storage.logger
8989
}
9090

91-
init(
91+
public init(
9292
requestID: String,
9393
traceID: String,
9494
invokedFunctionARN: String,

Sources/AWSLambdaRuntime/LambdaRuntime.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ import Foundation
2727
// sadly crashes the compiler today.
2828
public final class LambdaRuntime<Handler>: @unchecked Sendable where Handler: StreamingLambdaHandler {
2929
// TODO: We want to change this to Mutex as soon as this doesn't crash the Swift compiler on Linux anymore
30+
@usableFromInline
3031
let handlerMutex: NIOLockedValueBox<Handler?>
32+
@usableFromInline
3133
let logger: Logger
34+
@usableFromInline
3235
let eventLoop: EventLoop
3336

3437
public init(
@@ -48,6 +51,7 @@ public final class LambdaRuntime<Handler>: @unchecked Sendable where Handler: St
4851
self.logger.debug("LambdaRuntime initialized")
4952
}
5053

54+
@inlinable
5155
public func run() async throws {
5256
let handler = self.handlerMutex.withLockedValue { handler in
5357
let result = handler

0 commit comments

Comments
 (0)