Skip to content

Commit

Permalink
Release/0.2.0 (#79)
Browse files Browse the repository at this point in the history
* refactoring packages
* adding table of contents
* Fixed Rocket + Github Integration (#76)
* removing content type from MKDatabase extension
* Updated README file
  • Loading branch information
leogdion committed Dec 2, 2020
1 parent fa19431 commit dc0e559
Show file tree
Hide file tree
Showing 37 changed files with 499 additions and 114 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/macOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- '*'
- 'feature/*'
- 'release/*'
tags: '*'

jobs:
build:
Expand All @@ -32,6 +33,7 @@ jobs:
- name: Build
run: swift build
- name: Lint
if: startsWith(github.ref, 'refs/tags/') != true
run: swift run swiftformat --lint . && swift run swiftlint
- name: Run tests
run: swift test -v --enable-code-coverage
Expand All @@ -42,7 +44,7 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Build Documentation
if: ${{ matrix.xcode == '/Applications/Xcode_12.3.app' }}
if: ${{ matrix.xcode == '/Applications/Xcode_12.3.app' && !startsWith(github.ref, 'refs/tags/') }}
run: |
swift run sourcedocs generate build -cra
git config --local user.email "action@github.com"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,4 @@ Pods
*.lcov
Brewfile.lock.json
Package.resolved
gh-md-toc
28 changes: 28 additions & 0 deletions Documentation/Reference/MistKitNIO/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Reference Documentation

## Structs

- [MKAsyncClient](structs/MKAsyncClient.md)
- [MKAsyncRequest](structs/MKAsyncRequest.md)
- [MKAsyncResponse](structs/MKAsyncResponse.md)

## Classes

- [HTTPHandler](classes/HTTPHandler.md)
- [MKNIOHTTP1TokenClient](classes/MKNIOHTTP1TokenClient.md)

## Enums

- [BindTo](enums/BindTo.md)

## Extensions

- [EventLoopFuture](extensions/EventLoopFuture.md)
- [MKDatabase](extensions/MKDatabase.md)

## Typealiases

- [HTTPHandler.InboundIn](typealiases/HTTPHandler.InboundIn.md)
- [HTTPHandler.OutboundOut](typealiases/HTTPHandler.OutboundOut.md)

This file was generated by [SourceDocs](https://github.com/eneko/SourceDocs)
38 changes: 38 additions & 0 deletions Documentation/Reference/MistKitNIO/classes/HTTPHandler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
**CLASS**

# `HTTPHandler`

```swift
public final class HTTPHandler: ChannelInboundHandler
```

## Methods
### `init(fileIO:htdocsPath:channel:_:)`

```swift
public init(fileIO: NonBlockingFileIO, htdocsPath: String, channel: Channel, _ onToken: @escaping (String) -> Void)
```

### `channelRead(context:data:)`

```swift
public func channelRead(context: ChannelHandlerContext, data: NIOAny)
```

#### Parameters

| Name | Description |
| ---- | ----------- |
| context | The `ChannelHandlerContext` which this `ChannelHandler` belongs to. |
| data | The data read from the remote peer, wrapped in a `NIOAny`. |

### `startServer(htdocs:allowHalfClosure:bindTarget:_:)`

```swift
public static func startServer(
htdocs: String,
allowHalfClosure: Bool,
bindTarget: BindTo,
_ callback: @escaping (EventLoop, String) -> Void
) throws -> Channel
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
**CLASS**

# `MKNIOHTTP1TokenClient`

```swift
public class MKNIOHTTP1TokenClient: MKTokenClient
```

## Methods
### `init(bindTo:onRedirectURL:)`

```swift
public init(bindTo: BindTo, onRedirectURL: ((URL) -> Void)? = nil)
```

### `request(_:_:)`

```swift
public func request(_ request: MKAuthenticationResponse?, _ callback: @escaping ((Result<String, Error>) -> Void))
```
26 changes: 26 additions & 0 deletions Documentation/Reference/MistKitNIO/enums/BindTo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
**ENUM**

# `BindTo`

```swift
public enum BindTo
```

## Cases
### `ipAddress(host:port:)`

```swift
case ipAddress(host: String, port: Int)
```

### `unixDomainSocket(path:)`

```swift
case unixDomainSocket(path: String)
```

### `stdio`

```swift
case stdio
```
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,29 @@ public extension MKDatabase
### `query(_:on:)`

```swift
func query<RecordType: MKContentRecord, EncodedType>(
func query<RecordType>(
_ query: FetchRecordQueryRequest<MKQuery<RecordType>>,
on eventLoop: EventLoop
) -> EventLoopFuture<[RecordType]> where RecordType.ContentType == EncodedType
) -> EventLoopFuture<[RecordType]>
```

### `perform(operations:on:)`

```swift
func perform<RecordType: MKContentRecord, EncodedType>(
func perform<RecordType>(
operations: ModifyRecordQueryRequest<RecordType>,
on eventLoop: EventLoop
)
-> EventLoopFuture<ModifiedRecordQueryResult<RecordType>>
where RecordType.ContentType == EncodedType
```

### `lookup(_:on:)`

```swift
func lookup<RecordType: MKContentRecord, EncodedType>(
func lookup<RecordType>(
_ lookup: LookupRecordQueryRequest<RecordType>,
on eventLoop: EventLoop
) -> EventLoopFuture<[RecordType]> where RecordType.ContentType == EncodedType
) -> EventLoopFuture<[RecordType]>
```

### `perform(request:returnFailedAuthentication:on:)`
Expand Down
27 changes: 27 additions & 0 deletions Documentation/Reference/MistKitNIO/structs/MKAsyncClient.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
**STRUCT**

# `MKAsyncClient`

```swift
public struct MKAsyncClient: MKHttpClient
```

## Properties
### `client`

```swift
public let client: HTTPClient
```

## Methods
### `init(client:)`

```swift
public init(client: HTTPClient)
```

### `request(withURL:data:)`

```swift
public func request(withURL url: URL, data: Data?) -> MKAsyncRequest
```
33 changes: 33 additions & 0 deletions Documentation/Reference/MistKitNIO/structs/MKAsyncRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
**STRUCT**

# `MKAsyncRequest`

```swift
public struct MKAsyncRequest: MKHttpRequest
```

## Properties
### `client`

```swift
public let client: HTTPClient
```

### `url`

```swift
public let url: URL
```

### `data`

```swift
public let data: Data?
```

## Methods
### `execute(_:)`

```swift
public func execute(_ callback: @escaping ((Result<MKHttpResponse, Error>) -> Void))
```
32 changes: 32 additions & 0 deletions Documentation/Reference/MistKitNIO/structs/MKAsyncResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
**STRUCT**

# `MKAsyncResponse`

```swift
public struct MKAsyncResponse: MKHttpResponse
```

## Properties
### `response`

```swift
public let response: HTTPClient.Response
```

### `body`

```swift
public var body: Data?
```

### `status`

```swift
public var status: Int
```

### `webAuthenticationToken`

```swift
public var webAuthenticationToken: String?
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**TYPEALIAS**

# `HTTPHandler.InboundIn`

```swift
public typealias InboundIn = HTTPServerRequestPart
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**TYPEALIAS**

# `HTTPHandler.OutboundOut`

```swift
public typealias OutboundOut = HTTPServerResponsePart
```
5 changes: 0 additions & 5 deletions Documentation/Reference/MistKitVapor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,4 @@
- [MKVaporModelStorage](classes/MKVaporModelStorage.md)
- [MKVaporSessionStorage](classes/MKVaporSessionStorage.md)

## Extensions

- [EventLoopFuture](extensions/EventLoopFuture.md)
- [MKDatabase](extensions/MKDatabase.md)

This file was generated by [SourceDocs](https://github.com/eneko/SourceDocs)
36 changes: 14 additions & 22 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,16 @@ let package = Package(
targets: ["MistKit"]
),
.library(
name: "MistKitNIOHTTP1Token",
targets: ["MistKitNIOHTTP1Token"]
),
.library(
name: "MistKitSwifter",
targets: ["MistKitSwifter"]
name: "MistKitNIO",
targets: ["MistKitNIO"]
),
.library(
name: "MistKitVapor",
targets: ["MistKitVapor"]
),
.library(
name: "MistKitNIOClient",
targets: ["MistKitNIOClient"]
name: "MistKitSwifter",
targets: ["MistKitSwifter"]
),
.executable(name: "mistdemoc", targets: ["mistdemoc"]),
.executable(name: "mistdemod", targets: ["mistdemod"])
Expand All @@ -42,11 +38,11 @@ let package = Package(
.package(url: "https://github.com/vapor/fluent-sqlite-driver.git", from: "4.0.0"),
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.0.0"),
// dev
.package(url: "https://github.com/shibapm/Komondor", from: "1.0.6"),
.package(url: "https://github.com/eneko/SourceDocs", from: "1.2.1"),
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.47.0"),
.package(url: "https://github.com/realm/SwiftLint", from: "0.41.0"),
.package(url: "https://github.com/brightdigit/Rocket", .branch("feature/yams-4.0.0"))
.package(url: "https://github.com/shibapm/Komondor", from: "1.0.6"), // dev
.package(url: "https://github.com/eneko/SourceDocs", from: "1.2.1"), // dev
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.47.0"), // dev
.package(url: "https://github.com/realm/SwiftLint", from: "0.41.0"), // dev
.package(url: "https://github.com/brightdigit/Rocket", .branch("feature/yams-4.0.0")) // dev
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand All @@ -55,11 +51,12 @@ let package = Package(
name: "MistKit",
dependencies: []
),
.target(name: "MistKitNIOHTTP1Token",
.target(name: "MistKitNIO",
dependencies: [
"MistKit",
.product(name: "NIO", package: "swift-nio"),
.product(name: "NIOHTTP1", package: "swift-nio")
.product(name: "NIOHTTP1", package: "swift-nio"),
.product(name: "AsyncHTTPClient", package: "async-http-client")
]),
.target(name: "MistKitSwifter",
dependencies: [
Expand All @@ -69,16 +66,11 @@ let package = Package(
.target(name: "MistKitVapor",
dependencies: [
"MistKit",
"MistKitNIO",
.product(name: "Vapor", package: "vapor"),
.product(name: "Fluent", package: "fluent")
]),

.target(name: "MistKitNIOClient",
dependencies: [
"MistKit",
.product(name: "AsyncHTTPClient", package: "async-http-client")
]),
.target(name: "mistdemoc", dependencies: ["MistKit", "MistKitNIOHTTP1Token", "MistKitDemo",
.target(name: "mistdemoc", dependencies: ["MistKit", "MistKitNIO", "MistKitDemo",
.product(name: "ArgumentParser", package: "swift-argument-parser")]),
.target(name: "mistdemod", dependencies: ["MistKit", "MistKitVapor", "MistKitDemo",
.product(name: "Vapor", package: "vapor"),
Expand Down
Loading

0 comments on commit dc0e559

Please sign in to comment.