Commit Graph
35 Commits
Author SHA1 Message Date
Tobias 25eb6e16de Explicitly only use FoundationEssentials where possible (#436)
We want that the runtime only depends on `FoundationEssentials` where
available (ie. on linux) to ensure small binary size.

### Motivation:

Smaller binary size is good for lambda deployment and cold-start times.
The runtime should only depend on `FoundationEssentials`.

### Modifications:

- replace `import Foundation` with `import FoundationEssentials` if
`FoundationEssentials` is available.
- I also applied the same treatment to tests to ensure that catch error
where tests run on linux and we use API that is only available in
`Foundation` which easily happens when you develop on macOS (where
always full `Foundation` is available).

### Result:

This should allow builds without linking full `Foundation`.
2024-12-20 15:21:33 +01:00
Sébastien Stormacq ca82709a9b Add an example and README for background tasks (#418)
* add an example for background tasks

* swift-format

* add CI

* add background task section in the main readme

* minor formatting changes
2024-11-07 11:33:34 +01:00
Sébastien StormacqandTim Condon 1f80164eb2 add summary + link to API design doc in the readme (#414)
* add summary + link to API design doc in the readme

* typo

Co-authored-by: Tim Condon <0xTim@users.noreply.github.com>

* typo

Co-authored-by: Tim Condon <0xTim@users.noreply.github.com>

---------

Co-authored-by: Tim Condon <0xTim@users.noreply.github.com>
2024-11-07 10:06:30 +01:00
Sébastien Stormacq 053de483f8 Misc small changes to fix CI (#395)
* fix typo

* fix license header

* swift format
2024-10-08 20:29:11 +02:00
Fabian FettandSébastien Stormacq 6d886aa21d Ensure AWSLambdaRuntime only links FoundationEssentials
Co-authored-by: Sébastien Stormacq <sebastien.stormacq@gmail.com>
2024-10-08 19:52:01 +02:00
Fabian Fett 4295e51bbb Opt into Swift 6 language mode for most targets (#356)
* Opt into Swift 6 language mode for most targets

* fix parameter order to allow trailing closure syntax
2024-10-08 19:40:12 +02:00
Fabian Fett d2bd7f1aae Fix docs CI (#392) 2024-10-08 17:46:53 +02:00
aryan-25 435033e6a4 Make v2 API functions and types public (#358) 2024-09-05 18:44:01 +02:00
aryan-25 2abd9b5d33 Remove "New" prefix from v2 additions (#357) 2024-09-05 16:00:19 +02:00
aryan-25 85b938e99e Add new LambdaRuntime (#353) 2024-09-05 15:36:30 +02:00
Fabian Fett ddb703946c Remove old API (#355) 2024-09-04 18:28:53 +02:00
aryan-25 4b45451dc1 Add new handler protocols + Codable support (#351) 2024-09-04 13:46:00 +02:00
ab8166a39d [CI] Add GHA CI and release flow (#340)
Co-authored-by: Fabian Fett <fabianfett@apple.com>
Co-authored-by: Sébastien Stormacq <sebastien.stormacq@gmail.com>
Co-authored-by: Mahdi Bahrami <github@mahdibm.com>
2024-08-26 16:36:07 +02:00
c915322eca API Refactoring (#273)
motivation: define stable API in preperation 1.0 release

changes:
* require swift 5.7, remove redundant backwards compatibility code
* make LambdaHandler, EventLoopLambdaHandler, and ByteBufferLambdaHandler disjointed protocols to reduce API surface area
* create coding wrappers for LambdaHandler and EventLoopLambdaHandler to provide bridge to ByteBufferLambdaHandler
* reuse output ByteBuffer to reduce allocations
* add new SimpleLambdaHandler with no-op initializer for simple lambda use cases
* update callsites and tests
* update examples

Co-authored-by: Yim Lee <yim_lee@apple.com>
Co-authored-by: Fabian Fett <fabianfett@apple.com>
2022-11-09 10:08:36 -08:00
Yim Lee 98a23b64bb DocC setup (#270) 2022-08-21 20:29:08 -07:00
tomer doron d35e827121 Remove extension for JSONEncoder and JSONDecoder (#257)
motivation: we should not publicly extend types we do not own

change: remove extensions which are largely API sugar that is not directly related to Lambda
2022-04-15 13:05:49 +02:00
Fabian Fett 011e8ddc4b Rename Lambda.Context to LambdaContext (#233) 2021-09-30 01:56:58 +02:00
Fabian Fett e5aa488a26 [RFC] Drop event label from handle methods in LambdaHandlers (#225)
* Drop event label from handle method in LambdaHandlers
* Rename `In` to `Event` and `Out` to `Output` in `EventLoopLambdaHandler`
2021-09-22 16:59:07 +02:00
Fabian Fett 454fe2e037 Drop sync and closure APIs (#222)
motivation: with async/await, no need in closure based APIs

changes:
* Drop closure APIs
* Rename AsyncLambdaHandler -> LambdaHandler
* Removed unnecassary public acls from tests
2021-08-24 14:20:13 -07:00
Fabian Fett f01a9b607b Use explicit NIO imports (#220)
- Use explicit NIO modules `NIOCore`, `NIOPosix` and `NIOEmbedded` introduced with SwiftNIO 2.32.0
2021-08-19 09:42:23 +02:00
Fabian Fettandtomer doron 19fc295aa0 async/await support (#186)
- Add an `AsyncLambdaHandler`. Will be renamed to `LambdaHandler` as soon as we drop the current callback based `LambdaHandler`.
- The default way to use an `AsyncLambdaHandler` is to use `@main` to execute it. Don't use `Lambda.run` for it. We wan't to remove `Lambda.run` for 1.0.

Co-authored-by: tomer doron <tomerd@apple.com>
2021-04-27 22:47:11 +02:00
Fabian Fett 19a9f92538 Inline default LambdaHandler implementations (#201)
Add `@inlinable` to default LambdaHandler implementations. This ensures that those implementations can be inlined into user code and can be specialized for their input and output types.
2021-04-14 22:59:42 +02:00
Fabian Fett a49a87341a Update swiftformat (#196)
changes: 
* Update swiftformat from 0.44 to 0.47
* Adjust rules
2021-03-26 10:34:34 -07:00
Fabian FettandKonrad `ktoso` Malawski 2067f4aea1 JSONEncoder/JSONDecoder and String convenience methods (#144)
Co-authored-by: Konrad `ktoso` Malawski <konrad.malawski@project13.pl>
2020-08-03 21:04:13 +02:00
Fabian Fett 0008e59bab Rename payload to event (#115) 2020-06-07 07:47:05 -07:00
Fabian Fett 1d9637279a Moved Foundation to AWSLambdaRuntime; AWSLambdaRuntime renamed to AWSLambdaRuntimeCore (#41)
motivation: enable non-foundation module for performance sensitive use cases

changes: 
* rename AWSLambdaRuntime to AWSLambdaRuntimeCore 
* create AWSLambdaRuntime for Foundation dependent functionality 
* have (new) AWSLambdaRuntime export AWSLambdaRuntimeCore
* adjust tests
2020-05-07 09:37:28 -07:00
Fabian Fett 9df8a1a468 Rename RequestWork to GetNextInvocation (#74) 2020-05-07 08:37:07 -07:00
tomer doron 2324074c33 improve type aliases and API docs (#64)
motivation: better documentation, happier users

changes: 
* add more information on public APIs
* move and simplify type aliases
2020-04-28 14:31:43 -07:00
Fabian Fett 2297929bfd LambdaCodableEncoder should be less Foundation biased (#66) 2020-04-27 10:32:17 -07:00
Fabian Fett 378adf844d Allow integration with API Frameworks: Public Lifecycle (#58)
motivation: easy integration of web frameworks frameworks like vapor and smoke

changes: expose `Lifecycle` as a public API to allow easy integration with higher level frameworks
2020-04-22 16:10:38 -07:00
Fabian Fett 6f7103251a Reusable JSONCoders (#50)
motivation: beter performance

changes: 
* abstract JSONCoders and have a default static instance
* make encoding/decoding DRYer across String and Codable
2020-03-27 09:21:42 -07:00
Fabian Fett ac290985fa Reuse DispatchQueue for multiple Invocations (#49)
should fix #39
2020-03-26 13:58:28 -07:00
Fabian Fett 87121ec394 Capitalized HttpClient to HTTPClient filename (#47) 2020-03-25 10:52:22 -07:00
Fabian Fett 2cd6bce4d3 Remove use of JSONEncoder for Error Reporting (#42)
motivation: better performance for error response encoding 

changes: use string builder instead of Codable -> String with JSONEncoder
2020-03-18 20:23:53 -07:00
tomer doron b61aab012e rename project to SwiftAWSLambdaRuntime (#38)
motivation: unique, accurate name

changes:
* rename project to SwiftAWSLambdaRuntime
* rename main module to AWSLambdaRuntime
* rename / simplify sample module names
* adjust readme and scripts
2020-03-13 14:48:25 -07:00