Skip to content

remove Example dir #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .swift-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"version" : 1,
"indentation" : {
"spaces" : 4
},
"tabWidth" : 4,
"fileScopedDeclarationPrivacy" : {
"accessLevel" : "private"
},
"spacesAroundRangeFormationOperators" : false,
"indentConditionalCompilationBlocks" : false,
"indentSwitchCaseLabels" : false,
"lineBreakAroundMultilineExpressionChainComponents" : false,
"lineBreakBeforeControlFlowKeywords" : false,
"lineBreakBeforeEachArgument" : true,
"lineBreakBeforeEachGenericRequirement" : true,
"lineLength" : 120,
"maximumBlankLines" : 1,
"respectsExistingLineBreaks" : true,
"prioritizeKeepingFunctionOutputTogether" : true,
"rules" : {
"AllPublicDeclarationsHaveDocumentation" : false,
"AlwaysUseLiteralForEmptyCollectionInit" : false,
"AlwaysUseLowerCamelCase" : false,
"AmbiguousTrailingClosureOverload" : true,
"BeginDocumentationCommentWithOneLineSummary" : false,
"DoNotUseSemicolons" : true,
"DontRepeatTypeInStaticProperties" : true,
"FileScopedDeclarationPrivacy" : true,
"FullyIndirectEnum" : true,
"GroupNumericLiterals" : true,
"IdentifiersMustBeASCII" : true,
"NeverForceUnwrap" : false,
"NeverUseForceTry" : false,
"NeverUseImplicitlyUnwrappedOptionals" : false,
"NoAccessLevelOnExtensionDeclaration" : true,
"NoAssignmentInExpressions" : true,
"NoBlockComments" : true,
"NoCasesWithOnlyFallthrough" : true,
"NoEmptyTrailingClosureParentheses" : true,
"NoLabelsInCasePatterns" : true,
"NoLeadingUnderscores" : false,
"NoParensAroundConditions" : true,
"NoVoidReturnOnFunctionSignature" : true,
"OmitExplicitReturns" : true,
"OneCasePerLine" : true,
"OneVariableDeclarationPerLine" : true,
"OnlyOneTrailingClosureArgument" : true,
"OrderedImports" : true,
"ReplaceForEachWithForLoop" : true,
"ReturnVoidInsteadOfEmptyTuple" : true,
"UseEarlyExits" : false,
"UseExplicitNilCheckInConditions" : false,
"UseLetInEveryBoundCaseVariable" : false,
"UseShorthandTypeNames" : true,
"UseSingleLinePropertyGetter" : false,
"UseSynthesizedInitializer" : false,
"UseTripleSlashForDocumentationComments" : true,
"UseWhereClausesInForLoops" : false,
"ValidateDocumentationComments" : false
}
}
19 changes: 0 additions & 19 deletions .swiftformat

This file was deleted.

1 change: 0 additions & 1 deletion Examples/Simple/.dockerignore

This file was deleted.

32 changes: 0 additions & 32 deletions Examples/Simple/Package.swift

This file was deleted.

33 changes: 0 additions & 33 deletions Examples/Simple/Sources/APIGateway/APIGatewayProxyLambda.swift

This file was deleted.

15 changes: 0 additions & 15 deletions Examples/Simple/Tests/LinuxMain.swift

This file was deleted.

8 changes: 4 additions & 4 deletions Sources/AWSLambdaEvents/Utils/Base64.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ extension Base64 {
) throws -> [UInt8] where Buffer.Element == UInt8 {
let alphabet =
options.contains(.base64UrlAlphabet)
? Base64.decodeBase64Url
: Base64.decodeBase64
? Base64.decodeDataUrl
: Base64.decodeData

// In Base64 4 encoded bytes, become 3 decoded bytes. We pad to the
// nearest multiple of three.
Expand Down Expand Up @@ -112,7 +112,7 @@ extension Base64 {
// MARK: Internal

@usableFromInline
static let decodeBase64: [UInt8] = [
static let decodeData: [UInt8] = [
// 0 1 2 3 4 5 6 7 8 9
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 0
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 1
Expand Down Expand Up @@ -143,7 +143,7 @@ extension Base64 {
]

@usableFromInline
static let decodeBase64Url: [UInt8] = [
static let decodeDataUrl: [UInt8] = [
// 0 1 2 3 4 5 6 7 8 9
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 0
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 1
Expand Down
2 changes: 1 addition & 1 deletion Tests/AWSLambdaEventsTests/DynamoDBTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class DynamoDBTests: XCTestCase {
func testAttributeValueEmptyDecoding() {
let json = "{\"haha\": 1}"
XCTAssertThrowsError(
_ = try JSONDecoder().decode(DynamoDBEvent.AttributeValue.self, from: json.data(using: .utf8)!)
try JSONDecoder().decode(DynamoDBEvent.AttributeValue.self, from: json.data(using: .utf8)!)
) { error in
guard case DecodingError.dataCorrupted = error else {
XCTFail("Unexpected error: \(String(describing: error))")
Expand Down
4 changes: 2 additions & 2 deletions Tests/AWSLambdaEventsTests/Utils/Base64Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ class Base64Tests: XCTestCase {
}

func testBase64DecodingWithPoop() {
XCTAssertThrowsError(_ = try "💩".base64decoded()) { error in
XCTAssertThrowsError(try "💩".base64decoded()) { error in
XCTAssertEqual(error as? Base64.DecodingError, .invalidCharacter(240))
}
}

func testBase64DecodingWithInvalidLength() {
XCTAssertThrowsError(_ = try "AAAAA".base64decoded()) { error in
XCTAssertThrowsError(try "AAAAA".base64decoded()) { error in
XCTAssertEqual(error as? Base64.DecodingError, .invalidLength)
}
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/AWSLambdaEventsTests/Utils/DateWrapperTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class DateWrapperTests: XCTestCase {

let date = "2020-03-26T16:53:05" // missing Z at end
let json = #"{"date":"\#(date)"}"#
XCTAssertThrowsError(_ = try JSONDecoder().decode(TestEvent.self, from: json.data(using: .utf8)!)) { error in
XCTAssertThrowsError(try JSONDecoder().decode(TestEvent.self, from: json.data(using: .utf8)!)) { error in
guard case DecodingError.dataCorrupted(let context) = error else {
XCTFail("Unexpected error: \(error)")
return
Expand Down Expand Up @@ -74,7 +74,7 @@ class DateWrapperTests: XCTestCase {

let date = "2020-03-26T16:53:05Z" // missing fractional seconds
let json = #"{"date":"\#(date)"}"#
XCTAssertThrowsError(_ = try JSONDecoder().decode(TestEvent.self, from: json.data(using: .utf8)!)) { error in
XCTAssertThrowsError(try JSONDecoder().decode(TestEvent.self, from: json.data(using: .utf8)!)) { error in
guard case DecodingError.dataCorrupted(let context) = error else {
XCTFail("Unexpected error: \(error)")
return
Expand Down Expand Up @@ -149,7 +149,7 @@ class DateWrapperTests: XCTestCase {

let date = "Thu, 5 Apr 2012 23:47 +0200" // missing seconds
let json = #"{"date":"\#(date)"}"#
XCTAssertThrowsError(_ = try JSONDecoder().decode(TestEvent.self, from: json.data(using: .utf8)!)) { error in
XCTAssertThrowsError(try JSONDecoder().decode(TestEvent.self, from: json.data(using: .utf8)!)) { error in
guard case DecodingError.dataCorrupted(let context) = error else {
XCTFail("Unexpected error: \(error)")
return
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ AWS Lambda functions can be invoked directly from the AWS Lambda console UI, AWS

## Getting started

If you have never used AWS Lambda or Docker before, check out this [getting started guide](https://fabianfett.dev/getting-started-with-swift-aws-lambda-runtime) which helps you with every step from zero to a running Lambda.
If you have never used AWS Lambda or Docker before, check out this [getting started guide](https://swiftpackageindex.com/swift-server/swift-aws-lambda-runtime/1.0.0-alpha.3/tutorials/table-of-content) which helps you with every step from zero to a running Lambda.

Swift AWS Lambda Events is a supporting library for the [Swift AWS Lambda Runtime](http://github.com/swift-server/swift-aws-lambda-runtime) library, where you can find further documentation and examples.

Expand Down