Releases: swift-cloud/Compute
Releases · swift-cloud/Compute
3.1.0
3.0.0
- Built for Swift 6. There are no outstanding concurrency warnings or issues.
- Adds a new
Fastly.Device
api to get data about the client making the current request
v2.19.0
Upgrade Swift Crypto to 3.0.0
v2.18.0 - Cache
This release adds support for Fastly's Cache API allowing you to cache and retrieve arbitrary data during a request:
let data = try await Cache.getOrSet("my-page") {
let res = try await expensivePageRender()
return (res, .ttl(60))
}
try await res
.status(200)
.header(.contentLength, "\(data.contentLength)")
.send(data.body)
v2.17.0 - KVStore
- Rename
ObjectStore
toKVStore
following Fastly name change
v2.16.0 - Support Xcode 14.3
- Add support for Xcode 14.3
v2.15.0 - Forwarded For
- Set
x-forwarded-for
header when proxying a fetch request
v2.14.0 - Swift Crypto
- Compute now relies directly on apple/swift-crypto making it more compatible with other Swift server libraries
v2.13.0 - Crypto Additions
- Adds additional crypto signatures for ease of use
v2.12.0 - Fanout
- Integrates Fanout into request and response handling
- Adds a new
FanoutClient
for publishing messages to Fanout channels - Switches underlying crypto lib to apple/swift-crypto
- Adds support for creating and verifying ECDSA style JWTs (ex. ES256)
// Clients connect here
router.get("/stream") { req, res in
guard req.isUpgradeWebsocketRequest() else {
return try await res.status(400).send("Invalid websocket request")
}
try req.upgradeWebsocket(to: .fanout, hostname: "localhost")
}
// Fanout relays messages here
router.post("/stream") { req, res in
let message = try await req.fanoutMessage()
if message.event == .open {
return try await res.send(fanout: .open, .subscribe(to: "test"))
}
try await res.send(fanout: .ack)
}
// Authenticated publish endpoint here
router.post("/message") { req, res in
let token = try ConfigStore(name: "env")["fanout_token"]!
let client = FanoutClient(token: token)
let content = try await req.body.text()
let data = try await client.publish(content, to: "test")
try await res.proxy(data)
}