Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add vapor 3 api shims * fix trailing whitespace * deprecate expectation alias * deprecate expectation alias
- Loading branch information
1 parent
5adcd2e
commit dc2aa1e
Showing
8 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@available(*, unavailable, message: "Use `Application` instead.") | ||
public typealias Config = Void |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@_exported import _NIO1APIShims |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import Vapor | ||
|
||
@available(*, deprecated, renamed: "EventLoopFuture") | ||
public typealias Future = EventLoopFuture | ||
|
||
extension EventLoopFuture { | ||
@available(*, deprecated, renamed: "Value") | ||
public typealias Expectation = Value | ||
|
||
@available(*, deprecated, message: "The `to` parameter has been removed and this method can no longer throw.") | ||
public func map<T>(to type: T.Type, _ callback: @escaping (Value) throws -> T) -> EventLoopFuture<T> { | ||
return self.flatMapThrowing(callback) | ||
} | ||
|
||
|
||
@available(*, deprecated, message: "The `to` parameter has been removed and this method can no longer throw.") | ||
public func flatMap<T>(to type: T.Type, _ callback: @escaping (Value) throws -> EventLoopFuture<T>) -> EventLoopFuture<T> { | ||
return self.flatMap { input in | ||
do { | ||
return try callback(input) | ||
} catch { | ||
return self.eventLoop.makeFailedFuture(error) | ||
} | ||
} | ||
} | ||
|
||
@available(*, deprecated, renamed: "flatMapErrorThrowing") | ||
public func catchMap(_ callback: @escaping (Error) throws -> (Value)) -> EventLoopFuture<Value> { | ||
return self.flatMapErrorThrowing(callback) | ||
} | ||
|
||
|
||
@available(*, deprecated, message: "Use `flatMapError` with internal do / catch that returns a failed future.") | ||
public func catchFlatMap(_ callback: @escaping (Error) throws -> (EventLoopFuture<Value>)) -> EventLoopFuture<Value> { | ||
return self.flatMapError { inputError in | ||
do { | ||
return try callback(inputError) | ||
} catch { | ||
return self.eventLoop.makeFailedFuture(error) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@available(*, unavailable, message: "Use `app.http.server.configuration` instead.") | ||
public typealias NIOServerConfig = Void |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import Vapor | ||
|
||
@available(*, deprecated, renamed: "EventLoopPromise") | ||
public typealias Promise = EventLoopPromise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@available(*, unavailable, message: "Use `Application` instead.") | ||
public typealias Services = Void |