33 Commits

Author SHA1 Message Date
Sébastien Stormacq 8676c8933a apply swiftformat (#342)
* apply swiftformat

* update dep on Swift Docc to v1.3.0

* force usage of swift docc plugin 1.3.0
2024-08-26 12:25:41 +02:00
Camden Fullmer 35e0919ed2 Add support for resources when packaging using the SwiftPM plugin (#333)
* Add support for resources when packaging using the SwiftPM plugin.

* Copy the resources directory to the working directory instead of recreating the directroy structure.

* Add resource packaging example.

* Use the bundle's url function to locate the file url.

* Fix year for soundness check.

---------

Co-authored-by: Sébastien Stormacq <sebastien.stormacq@gmail.com>
2024-08-05 17:51:21 +02:00
tomer doron 3b72f6a6cf improve examples (#292)
motivation: examples can be confusing since they use relative path to the library for CI purposes

changes:
* update examples to use the library URL, expect when env variable is set for CI purposes
* rename docker compose job to test-examples since it is more accurate
2023-03-12 11:23:41 -07:00
tomer doron 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
Bill 20978cc462 Add special Deployment instructions for the Mac M1 (#263) 2022-05-09 10:19:30 -07:00
tomer doron e5b44962bd Prefix data structures with Lambda instead of namespacing them (#256)
motivation: consisten naming convention

changes:
* Lambda.InitializationContext -> LambdaInitializationContext
* Lambda.Runner -> LambdaRunner
* Lambda.Configuration -> LambdaConfiguration
* Lambda.RuntimeError -> LambdaRuntimeError
* adjust call sites, tests, and examples
2022-04-15 13:33:54 +02:00
Fabian Fett d06d22c0e0 Lambda factory as a protocol requirement. (#244) 2022-01-13 19:10:20 +01:00
YR Chen 4317c5334f Adopt concurrency adoption guidelines (#230)
Adopt Swift Concurrency adoption guidelines for Swift Server Libraries (swift-server/guides#70).

- Use #if compiler(>=5.5) && canImport(_Concurrency) to judge if Concurrency is available
- Some clean up
2021-12-06 20:52:35 +01:00
YR Chen 39b34a159b Modernize app example (#231)
Since we already required Swift 5.5 for Concurrency (Xcode 13), it's natural to update the demo app to reflect latest SwiftUI changes, which makes the code neater and more expressive.
2021-12-06 11:30:50 +01:00
Fabian Fett 011e8ddc4b Rename Lambda.Context to LambdaContext (#233) 2021-09-30 01:56:58 +02:00
tomer doron b757de0241 Update and add examples to new APIs (#228)
* take advantage of @main where possible
* move the top level Sample code to the examples subdirectory
* extract a few examples form the "LambdaFunctions" directory (which is really a deployment demo) and move them to the top level Examples directory
*  rename "LambdaFunctions" examples as "Deployments" to make their intent clearer
* add a sample that demonstrates how to test a lambda now that SwiftPM can test executables directly
* update the test-sample docker setup to build & test th new samples
* fix a few typos and In/Out typealias left overs
* remove LinuxMain since its no longer required
2021-09-25 10:30:04 +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 dbd675df6f Reorder Event and Context. (#224)
motivation: follow API design guidelines

changes: Reorder `event` and `context` n public APIs
2021-08-24 15:26:39 -07: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 3511a92241 Update examples for Swift 5.5 (#223)
- Lambda examples use async/await
- SwiftUI example uses async/await
- Handlers are marked with `@main`
- Executables are defined as `.executableTarget`
- Examples require Swift 5.5
2021-08-19 20:07:54 +02:00
tomer doron 8525b6334e split events into spearate package (#216)
motivation:
the runtime library has a stable API while the events are still moving target. In order to provide a 1.0 stable version we separate them out

changes:
* remove Events module
* update readme
* update Samples
* remove gateway example

Co-authored-by: Fabian Fett <fabianfett@apple.com>
2021-08-19 09:36:01 +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
tomer doron b8834b21c2 improve LocalDebugging readme (#137)
motivation: clearer guidelines for using the example

changes: fix a few typos, fix incorrect scheme name and add a bit more prose
2020-07-02 11:18:23 -07:00
tomer doron b9224e2fb6 examples deployment scripts refresh (#133)
motivation: make sure examples are up tp date

changes:
* use swift:5.2 images instead of nighlies
* compute dependencies to make zipfile as small as possible
* make scripts more consistent
2020-06-25 13:38:25 -07:00
Andrea Scuderi 0535cb72eb Fix SAM Examples after directory change (#124) 2020-06-17 13:37:51 -07:00
Andrea Scuderi c683b41545 Add example scripts and docs for Serverless Framework (#113)
* Add example scripts and docs for Serverless Framework
* Refactor Examples folder and scripts
- Add a common config.sh script
- Move SAM templates to scripts/SAM
- Add Serverless templates to scripts/serverless
- Update the scripts to work with new folder structure and config.sh
2020-06-12 12:14:37 -07:00
Fabian Fett 0008e59bab Rename payload to event (#115) 2020-06-07 07:47:05 -07:00
Eneko Alonso 71587eab10 Document configuration variables in deploy.sh (#97) 2020-06-06 18:21:35 -07:00
Brendan Kirchner 5e546a1a9e Added jq requirement to examples readme (#106)
* Added jq requirement to readme
2020-06-03 10:44:28 -07:00
tomer doron e2ac820289 add an option to start the local debugging server based on an env variable (#87)
motivation: make using the local debugging server easier to turn off/on without the need to change code when oyu are preparing to deploy

changes:
* add code to lambda so that in debug mode only, if the LOCAL_LAMBDA_SERVER_ENABLED env variable is set the local debugging server is started
* make withLocalServer internal
* update example code
2020-06-01 12:38:06 -07:00
pmarrufo f1ce84f70b Fix typo in ErrorHandling Example (#93)
* Fix typo
2020-05-29 13:42:44 -07:00
tomer doron 75d05ca954 docs cleanup (#91)
motivation: cleanup docs for oss

changes:
* add useful information in readme, with pointers to examples
* update ci setup and example to use latest tools
* update contributors list

Co-authored-by: Yim Lee <yim_lee@apple.com>
2020-05-28 12:19:19 -07:00
tomer doron 3cb9330832 fix example correctness (#90)
motivation: make example more correct

changes: update response in DispatchQueue.main
2020-05-28 09:59:56 -07:00
tomer doron 8c24cffd97 fix context members to follow swift APi guidelines (#88)
motivation: nicer API

changes:
* requestID -> requestID
* traceId -> traceID
* invokedFunctionArn -> invokedFunctionARN
* adjust examples
2020-05-27 11:46:31 -07:00
tomer doron d956b89dbc improve debugging example (#84)
motivation: clearer examples as we prepare to open source

changes:
* rename debugging example to make the name more accurate
* add more information in the local debugging example
* add a Shared module to show how to share code between client and server
* make example more useful - use JSON for registration like flow
* add docker-compose task to test examples

Co-authored-by: Yim Lee <yim_lee@apple.com>
2020-05-21 09:07:38 -07:00
Fabian Fett d3b75176dd Update APIGateway example to use AWSLambdaEvents (#76)
motivation: example of how to use the API Gateway model

changes: Update APIGateway example to use AWSLambdaEvents
2020-05-12 12:41:01 -07:00
tom doron b5f18dad4b move examples into a subdirectory
motivation: easier to find and reason about

changes: move exmaples from a seperate repo into a subdirectory
2020-05-07 08:56:31 -07:00
tom doron d5368bbe25 moving examples into a subdirectory 2020-05-06 12:19:03 -07:00