Releases: alchemy-swift/alchemy
v0.4.0
What's Changed
- Adds Testing by @joshuawright11 in #75
- Hummingbird by @joshuawright11 in #76
- Add convenience APIs around accessing Content, Files & Attachments by @joshuawright11 in #77
- async / await & testing by @joshuawright11 in #72
- Events & Model Improvements by @joshuawright11 in #82
- Handle null values when converting PostgresCell to SQLValue by @seanmiller802 in #83
- [Redis] Add TLS support by @joshuawright11 in #84
- Add Encryption, Hashing, and expand Filesystem for better S3 support by @joshuawright11 in #85
- Add Type to relationshipWasNil RuneError by @seanmiller802 in #86
New Contributors
- @seanmiller802 made their first contribution in #83
Full Changelog: v0.3.2...v0.4.0
v0.3.2
Fix an issue with package versions. Thanks @ShonFrazier for the report.
v0.3.1
Fixes an issue with a crash when there's no Queue registered to the app.
Also updates the README.
Thanks @adam-fowler for the report.
v0.3.0
Commands
This release adds commands to make it easy to run custom maintenance, cleanup or productivity tasks with your app.
Commands are built on top of Swift Argument Parser which means there is a ton of baked in functionality for custom flags, options, arguments and automatically generated help details. Commands also have access to your application's services meaning your can easily use your configured Databases, Queues, etc inside commands.
To create a command, first conform to the Command
interface and implement func start()
. You may add options, flags and configuration provided by Swift Argument Parser.
final class SyncUserData: Command {
static var configuration = CommandConfiguration(commandName: "sync", discussion: "Sync all data for all users.")
@Option(help: "Sync data for a specific user only.")
var id: Int?
@Flag(help: "Should data be loaded but not saved.")
var dry: Bool = false
func start() -> EventLoopFuture<Void> {
if let userId = id {
// sync only a specific user's data
} else {
// sync all users' data
}
}
}
Next, register your command type.
app.registerCommand(SyncUserData.self)
Now you may run your Alchemy app with your new command.
$ swift run MyApp sync --id 2 --dry
Make Commands
Also new are a suite of commands to increase productivity by generate typical interfaces you might use such as models, controllers, migrations, middleware, jobs, etc. Run $ swift run MyApp help
for a list of all make commands.
For example, the make:model
command makes it easy to generate a model with the given fields. You can event generate a full populated Migration and Controller with CRUD routes by passing the --migration
and --controller
flags.
$ swift run Server make:model Todo id:increments:primary name:string is_done:bool user_id:bigint:references.users.id --migration --controller
🧪 create Sources/App/Models/Todo.swift
🧪 create Sources/App/Migrations/2021_09_24_11_07_02CreateTodos.swift
└─ remember to add migration to a Database.migrations!
🧪 create Sources/App/Controllers/TodoController.swift
Like all commands, you may view the details & arguments of each make command with swift run MyApp help <command>
.
Additional Model CRUD functions
Also new are a few functions to help quickly look up, update, or delete models. Check out Model.find
, Model.delete
, and Model.update
for what's new.
For a more in depth summary, check out the Commands guide.
v0.2.2
This release adds support for running your server over TLS and HTTP/2.
By default, the server runs unencrypted over HTTP/1.1.
Enable TLS
To enable running HTTP/1.1 over TLS, use useHTTPS
.
func boot() throws {
try useHTTPS(key: "/path/to/private-key.pem", cert: "/path/to/cert.pem")
}
Enable HTTP/2
To enable HTTP/2 upgrades (will prefer HTTP/2 but still accept HTTP/1.1 over TLS), use useHTTP2
.
func boot() throws {
try useHTTP2(key: "/path/to/private-key.pem", cert: "/path/to/cert.pem")
}
Note that the HTTP/2 protocol is only supported over TLS, so implies using it. Thus, there's no need to call both useHTTPS and useHTTP2; useHTTP2 sets up both TLS and HTTP/2 support.
v0.2.1
Fix an issue with named services being registered
v0.2.0
Lots of new APIs including...
- Robust job queues
- Redis interfaces
- Powerful, cron-based scheduler
- Advanced Rune relationship configurations
- Service container &
Service
protocol for injecting services - Persisted cache backed by Redis or SQL
@main
support- Tons of convenience, bug fixes & cleanup
Check out the new README & Docs/
for the lowdown on what's new.
v0.1.4
v0.1.3
Adds MySQL support for JSON types
v0.1.2
Fixes some issues around MySQL, also adds support for ON DELETE
, ON UPDATE
, and bigInt
in migrations.