From b4cf278522e7eaf298a668b8e9a90594b6d22a37 Mon Sep 17 00:00:00 2001 From: Vincent Date: Thu, 29 Dec 2022 17:37:34 +1300 Subject: [PATCH 1/6] fix: Ran swiftformat to format code --- Package.swift | 17 ++-- .../OrderedDictionary+Dictionary.swift | 6 +- Sources/Pioneer/Extensions/Expression.swift | 2 +- .../Extensions/Futures/Actor+Task.swift | 5 +- .../Extensions/Int/UInt64+Nanoseconds.swift | 5 +- .../Pioneer/Extensions/Map/Map+Decoder.swift | 4 +- .../Pioneer/Extensions/Pioneer+Graphiti.swift | 2 +- .../Extensions/Results/Data+Json.swift | 2 +- Sources/Pioneer/GraphQL/BuiltinTypes.swift | 25 +++-- .../GraphQL/Extensions/Field+AsyncAwait.swift | 17 ++-- .../Extensions/GraphQL+Execution.swift | 5 +- .../Extensions/GraphQLError+Error.swift | 6 +- Sources/Pioneer/GraphQL/GraphQLMessage.swift | 8 +- Sources/Pioneer/GraphQL/GraphQLRequest.swift | 21 ++-- Sources/Pioneer/Http/HTTPGraphQL.swift | 22 ++--- Sources/Pioneer/Http/HttpStrategy.swift | 8 +- Sources/Pioneer/Http/IDE.swift | 43 ++++---- Sources/Pioneer/Pioneer.swift | 59 ++++++----- .../Pioneer/Streaming/AsyncEventStream.swift | 5 +- Sources/Pioneer/Streaming/AsyncPubSub.swift | 27 +++-- Sources/Pioneer/Streaming/Broadcast.swift | 23 +++-- ...syncEventStream+Future+GraphQLResult.swift | 14 +-- .../Extension/AsyncSequence+EventStream.swift | 22 ++--- .../Extension/AsyncStream+Statics.swift | 16 +-- .../Extension/EventStream+Static.swift | 2 +- Sources/Pioneer/Streaming/PubSub.swift | 6 +- Sources/Pioneer/Utils/Interval.swift | 2 +- Sources/Pioneer/Utils/Timeout.swift | 4 +- Sources/Pioneer/Utils/Validation.swift | 16 +-- .../CORS/CORSMIddleware+BananaCakePop.swift | 8 +- .../CORS/CORSMiddleware+ApolloSandbox.swift | 8 +- .../EnvironmentVariables.swift | 6 +- .../GraphQLJSONEncoder+ContentEncoder.swift | 6 +- .../Request/Request+GraphQLRequest.swift | 23 ++--- .../Request/Request+PathComponent.swift | 28 +++--- .../Request/Request+WebSocket.swift | 6 +- .../Request/Request+WebsocketContext.swift | 27 +++-- .../Response/Response+GraphQLError.swift | 8 +- .../WebSocket/WebSocket+WebSocketable.swift | 2 +- Sources/Pioneer/Vapor/Http/Pioneer+Http.swift | 19 ++-- Sources/Pioneer/Vapor/Http/Pioneer+IDE.swift | 24 ++--- .../Pioneer/Vapor/Pioneer+Standalone.swift | 99 +++++++++---------- .../Pioneer/Vapor/Pioneer+Vapor+Void.swift | 20 ++-- Sources/Pioneer/Vapor/Pioneer+Vapor.swift | 69 +++++++------ .../Vapor/WebSocket/Pioneer+WebSocket.swift | 32 +++--- .../Pioneer/WebSocket/Common/Payload.swift | 2 +- .../Common/Pioneer+WebSocketable.swift | 2 +- .../WebSocket/Common/WebSocketClient.swift | 12 +-- .../WebSocket/Common/WebSocketable.swift | 6 +- .../Pioneer/WebSocket/Probe/Drone/Drone.swift | 42 ++++---- Sources/Pioneer/WebSocket/Probe/Probe.swift | 45 +++++---- .../WebSocket/Protocol/GraphQLWs.swift | 6 +- .../WebSocket/Protocol/SubProtocol.swift | 4 +- .../Protocol/SubscriptionsTransportWs.swift | 8 +- .../PioneerTests/ActorTests/DroneTests.swift | 22 ++--- .../PioneerTests/ActorTests/ProbeTests.swift | 20 ++-- .../DataStructureTests/AsyncPubSubTests.swift | 32 +++--- .../BuiltInTypesTests.swift | 24 +++-- .../WebSocketProtocolTests.swift | 9 +- .../GraphitiAsyncEventStreamTests.swift | 26 ++--- .../GraphQLTests/GraphitiExtensionTests.swift | 5 +- .../GraphQLTests/PioneerStatelessTests.swift | 19 ++-- .../OtherTests/ExtensionsTests.swift | 70 +++++++------ .../OtherTests/SecurityTest.swift | 24 ++--- Tests/PioneerTests/Utils/TestConsumer.swift | 5 +- .../VaporTests/ContextTests.swift | 20 ++-- .../VaporTests/HTTPQueryTests.swift | 61 ++++++------ .../VaporTests/HTTPStrategyTests.swift | 89 ++++++++--------- 68 files changed, 649 insertions(+), 683 deletions(-) diff --git a/Package.swift b/Package.swift index 1e4ba26..4897f3e 100644 --- a/Package.swift +++ b/Package.swift @@ -6,20 +6,21 @@ import PackageDescription let package = Package( name: "Pioneer", platforms: [ - .macOS(.v12) + .macOS(.v12), ], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. .library( name: "Pioneer", - targets: ["Pioneer"]), + targets: ["Pioneer"] + ), ], dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), .package(url: "https://github.com/GraphQLSwift/GraphQL.git", from: "2.4.0"), .package(url: "https://github.com/GraphQLSwift/Graphiti.git", from: "1.2.1"), - .package(url: "https://github.com/vapor/vapor.git", from: "4.67.1") + .package(url: "https://github.com/vapor/vapor.git", from: "4.67.1"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. @@ -28,13 +29,15 @@ let package = Package( name: "Pioneer", dependencies: [ "GraphQL", "Graphiti", - .product(name: "Vapor", package: "vapor") - ]), + .product(name: "Vapor", package: "vapor"), + ] + ), .testTarget( name: "PioneerTests", dependencies: [ "Pioneer", - .product(name: "XCTVapor", package: "vapor") - ]), + .product(name: "XCTVapor", package: "vapor"), + ] + ), ] ) diff --git a/Sources/Pioneer/Extensions/Collections/OrderedDictionary+Dictionary.swift b/Sources/Pioneer/Extensions/Collections/OrderedDictionary+Dictionary.swift index 0c36674..f317133 100644 --- a/Sources/Pioneer/Extensions/Collections/OrderedDictionary+Dictionary.swift +++ b/Sources/Pioneer/Extensions/Collections/OrderedDictionary+Dictionary.swift @@ -7,11 +7,11 @@ import struct OrderedCollections.OrderedDictionary -extension OrderedDictionary { +public extension OrderedDictionary { /// Turning OrderedDictionary into a regular one as both aren't API compatible. - public func unordered() -> [Key: Value] { + func unordered() -> [Key: Value] { var res = [Key: Value]() - forEach { (key, val) in + forEach { key, val in res[key] = val } return res diff --git a/Sources/Pioneer/Extensions/Expression.swift b/Sources/Pioneer/Extensions/Expression.swift index 1e20b49..29287d3 100644 --- a/Sources/Pioneer/Extensions/Expression.swift +++ b/Sources/Pioneer/Extensions/Expression.swift @@ -15,4 +15,4 @@ public func expression(_ fn: () throws -> ReturnType) rethrows -> Re /// - Returns: The returned value of this closure public func expression(_ fn: () async throws -> ReturnType) async rethrows -> ReturnType { try await fn() -} \ No newline at end of file +} diff --git a/Sources/Pioneer/Extensions/Futures/Actor+Task.swift b/Sources/Pioneer/Extensions/Futures/Actor+Task.swift index 1c72e6e..b79602f 100644 --- a/Sources/Pioneer/Extensions/Futures/Actor+Task.swift +++ b/Sources/Pioneer/Extensions/Futures/Actor+Task.swift @@ -5,14 +5,13 @@ // Created by d-exclaimation on 11:41 PM. // - -extension Actor { +public extension Actor { /// Method for handling NIO EventLoopFuture with an Actor using the pipe pattern /// /// - Parameters: /// - future: EventLoopFuture value being awaited /// - to: Transforming callback to for the result from the Future. - public func pipeToSelf(future: Task, to callback: @Sendable @escaping (Self, Result) async -> Void) { + func pipeToSelf(future: Task, to callback: @Sendable @escaping (Self, Result) async -> Void) { Task { do { let res = try await future.value diff --git a/Sources/Pioneer/Extensions/Int/UInt64+Nanoseconds.swift b/Sources/Pioneer/Extensions/Int/UInt64+Nanoseconds.swift index 8ff73ad..46487f3 100644 --- a/Sources/Pioneer/Extensions/Int/UInt64+Nanoseconds.swift +++ b/Sources/Pioneer/Extensions/Int/UInt64+Nanoseconds.swift @@ -20,11 +20,10 @@ public extension Optional where WrappedType == UInt64 { s * 1_000_000 } - /// Convert the given value in microseconds into nanoseconds /// - Parameter s: The value in microseconds /// - Returns: The nanoseconds result static func microseconds(_ s: UInt64) -> UInt64 { - s * 1_000 + s * 1000 } -} \ No newline at end of file +} diff --git a/Sources/Pioneer/Extensions/Map/Map+Decoder.swift b/Sources/Pioneer/Extensions/Map/Map+Decoder.swift index 0c152c9..e687dbc 100644 --- a/Sources/Pioneer/Extensions/Map/Map+Decoder.swift +++ b/Sources/Pioneer/Extensions/Map/Map+Decoder.swift @@ -5,8 +5,8 @@ // Created by d-exclaimation on 22:20. // -import class Foundation.JSONEncoder import class Foundation.JSONDecoder +import class Foundation.JSONEncoder import enum GraphQL.Map public extension Map { @@ -27,4 +27,4 @@ public extension Payload { let data = try JSONEncoder().encode(self) return try JSONDecoder().decode(dataType, from: data) } -} \ No newline at end of file +} diff --git a/Sources/Pioneer/Extensions/Pioneer+Graphiti.swift b/Sources/Pioneer/Extensions/Pioneer+Graphiti.swift index 06d6c01..f375f1b 100644 --- a/Sources/Pioneer/Extensions/Pioneer+Graphiti.swift +++ b/Sources/Pioneer/Extensions/Pioneer+Graphiti.swift @@ -42,7 +42,7 @@ public extension Pioneer { timeout: timeout ) } - + /// - Parameters: /// - schema: GraphQL schema used to execute operations /// - resolver: Resolver used by the GraphQL schema diff --git a/Sources/Pioneer/Extensions/Results/Data+Json.swift b/Sources/Pioneer/Extensions/Results/Data+Json.swift index a0463c7..378962b 100644 --- a/Sources/Pioneer/Extensions/Results/Data+Json.swift +++ b/Sources/Pioneer/Extensions/Results/Data+Json.swift @@ -10,7 +10,7 @@ import class Foundation.JSONDecoder extension Data { /// Parse data into any Decodable type if possible, otherwise return nil - func to(_ type: T.Type) -> T? { + func to(_: T.Type) -> T? { let decoder = JSONDecoder() decoder.dateDecodingStrategy = .iso8601 return try? decoder.decode(T.self, from: self) diff --git a/Sources/Pioneer/GraphQL/BuiltinTypes.swift b/Sources/Pioneer/GraphQL/BuiltinTypes.swift index b1e776d..feabba3 100644 --- a/Sources/Pioneer/GraphQL/BuiltinTypes.swift +++ b/Sources/Pioneer/GraphQL/BuiltinTypes.swift @@ -6,15 +6,15 @@ // import Foundation -import GraphQL import Graphiti +import GraphQL public typealias NoArgs = NoArguments /// The ID scalar type represents a unique identifier, often used to refetch an object or as the key for a cache. /// /// The ID type is serialized in the same way as a String; however, defining it as an ID signifies that it is not intended to be human‐readable. -public struct ID : Codable, ExpressibleByStringLiteral, CustomStringConvertible, Hashable, Sendable { +public struct ID: Codable, ExpressibleByStringLiteral, CustomStringConvertible, Hashable, Sendable { /// Inner string properties private var id: String @@ -23,7 +23,7 @@ public struct ID : Codable, ExpressibleByStringLiteral, CustomStringConvertible, } public init(uuid: UUID) { - self.id = uuid.uuidString + id = uuid.uuidString } public init(stringLiteral value: String) { @@ -56,7 +56,7 @@ public struct ID : Codable, ExpressibleByStringLiteral, CustomStringConvertible, /// Create a new ID from random letter public static func random(length: Int = 10) -> Self { let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" - let random = (0.. UUID { - guard let uuid = self.uuid else { + guard let uuid = uuid else { throw ConversionError(id: id, reason: "Cannot convert this ID that is not in UUID string format to UUID") } return uuid @@ -103,13 +103,12 @@ public struct ID : Codable, ExpressibleByStringLiteral, CustomStringConvertible, } } - public extension String { /// ID from this string var id: ID { .init(self) } - + /// ID from this string func toID() -> ID { .init(self) @@ -117,13 +116,13 @@ public extension String { } public extension UUID { - /// ID from this string + /// ID from this string var id: ID { - .init(self.uuidString) + .init(uuidString) } - + /// ID from this string func toID() -> ID { - .init(self.uuidString) + .init(uuidString) } -} \ No newline at end of file +} diff --git a/Sources/Pioneer/GraphQL/Extensions/Field+AsyncAwait.swift b/Sources/Pioneer/GraphQL/Extensions/Field+AsyncAwait.swift index ee372a4..0752b2a 100644 --- a/Sources/Pioneer/GraphQL/Extensions/Field+AsyncAwait.swift +++ b/Sources/Pioneer/GraphQL/Extensions/Field+AsyncAwait.swift @@ -6,8 +6,8 @@ // import Graphiti -import protocol NIO.EventLoopGroup import GraphQL +import protocol NIO.EventLoopGroup /// Async-await non-throwing GraphQL resolver function public typealias AsyncAwaitResolveWithEventLoop = (ObjectType) -> (Context, Arguments, EventLoopGroup) async -> FieldType @@ -15,7 +15,7 @@ public typealias AsyncAwaitResolveWithEventLoop = (ObjectType) -> (Context, Arguments, EventLoopGroup) async throws -> FieldType -public extension Graphiti.Field where FieldType : Encodable { +public extension Graphiti.Field where FieldType: Encodable { // -- (context, args, eventLoop) async -> result convenience init( @@ -44,7 +44,7 @@ public extension Graphiti.Field where FieldType : Encodable { } } } - self.init(name, at: resolve, {}) + self.init(name, at: resolve) {} } // -- (context, args, eventLoop) async throws -> result @@ -75,12 +75,10 @@ public extension Graphiti.Field where FieldType : Encodable { } } } - self.init(name, at: resolve, {}) + self.init(name, at: resolve) {} } - } - public extension Graphiti.Field { // -- (context, args, eventLoop) async -> result @@ -112,7 +110,7 @@ public extension Graphiti.Field { } } } - self.init(name, at: resolve, as: `as`, {}) + self.init(name, at: resolve, as: `as`) {} } // -- (context, args, eventLoop) async throws -> result @@ -132,7 +130,7 @@ public extension Graphiti.Field { } self.init(name, at: resolve, as: `as`, argument) } - + convenience init( _ name: String, at function: @escaping AsyncAwaitThrowingResolveWithEventLoop, @@ -145,7 +143,6 @@ public extension Graphiti.Field { } } } - self.init(name, at: resolve, as: `as`, {}) + self.init(name, at: resolve, as: `as`) {} } - } diff --git a/Sources/Pioneer/GraphQL/Extensions/GraphQL+Execution.swift b/Sources/Pioneer/GraphQL/Extensions/GraphQL+Execution.swift index db2f07f..ba8229e 100644 --- a/Sources/Pioneer/GraphQL/Extensions/GraphQL+Execution.swift +++ b/Sources/Pioneer/GraphQL/Extensions/GraphQL+Execution.swift @@ -5,13 +5,11 @@ // Created by d-exclaimation on 9:46 PM. // - import GraphQL import protocol NIO.EventLoopGroup - /// Execute request-response based GraphQL Operation -/// +/// /// - Parameters: /// - schema: GraphQL Schema used to execute request /// - request: Query request string @@ -42,7 +40,6 @@ public func executeGraphQL( ).get() } - /// Execute streaming based GraphQL Operation /// /// - Parameters: diff --git a/Sources/Pioneer/GraphQL/Extensions/GraphQLError+Error.swift b/Sources/Pioneer/GraphQL/Extensions/GraphQLError+Error.swift index 873b400..cc693f8 100644 --- a/Sources/Pioneer/GraphQL/Extensions/GraphQLError+Error.swift +++ b/Sources/Pioneer/GraphQL/Extensions/GraphQLError+Error.swift @@ -7,9 +7,9 @@ import struct GraphQL.GraphQLError -extension Error { +public extension Error { /// Get the GraphQLError version of this error - public var graphql: GraphQLError { + var graphql: GraphQLError { self as? GraphQLError ?? .init(self) } -} \ No newline at end of file +} diff --git a/Sources/Pioneer/GraphQL/GraphQLMessage.swift b/Sources/Pioneer/GraphQL/GraphQLMessage.swift index 2ca8d4e..40e8ee1 100644 --- a/Sources/Pioneer/GraphQL/GraphQLMessage.swift +++ b/Sources/Pioneer/GraphQL/GraphQLMessage.swift @@ -27,11 +27,11 @@ public struct GraphQLMessage: Codable { static func from(type: String, id: String? = nil, _ gql: GraphQL.GraphQLResult) -> GraphQLMessage { let errors = parseError(gql.errors) switch (gql.data, errors) { - case (.some(let data), .some(let errors)): + case let (.some(data), .some(errors)): return .init(id: id, type: type, payload: ["data": data, "errors": errors]) - case (.some(let data), .none): + case let (.some(data), .none): return .init(id: id, type: type, payload: ["data": data]) - case (.none, .some(let errors)): + case let (.none, .some(errors)): return .init(id: id, type: type, payload: ["errors": errors]) case (.none, .none): return .init(id: id, type: type) @@ -76,6 +76,6 @@ extension Encodable { /// Any encodable into JSON String otherwise null is returned var jsonString: String { - json.flatMap { String(data: $0, encoding: .utf8)} ?? "null" + json.flatMap { String(data: $0, encoding: .utf8) } ?? "null" } } diff --git a/Sources/Pioneer/GraphQL/GraphQLRequest.swift b/Sources/Pioneer/GraphQL/GraphQLRequest.swift index d6eff5b..57bc440 100644 --- a/Sources/Pioneer/GraphQL/GraphQLRequest.swift +++ b/Sources/Pioneer/GraphQL/GraphQLRequest.swift @@ -42,27 +42,26 @@ public struct GraphQLRequest: Codable { let variables = try container.decodeIfPresent([String: Map]?.self, forKey: .variables) let extensions = try container.decodeIfPresent([String: Map]?.self, forKey: .extensions) self.init( - query: query, - operationName: operationName ?? nil, - variables: variables ?? nil, + query: query, + operationName: operationName ?? nil, + variables: variables ?? nil, extensions: extensions ?? nil ) } catch { throw ParsingIssue.invalidForm } } - public init( - query: String, - operationName: String? = nil, + query: String, + operationName: String? = nil, variables: [String: Map]? = nil, - extensions: [String: Map]? = nil + extensions _: [String: Map]? = nil ) { self.query = query self.operationName = operationName self.variables = variables - self.ast = try? parse(source: .init(body: query)) + ast = try? parse(source: .init(body: query)) } public func encode(to encoder: Encoder) throws { @@ -71,7 +70,7 @@ public struct GraphQLRequest: Codable { try container.encodeIfPresent(operationName, forKey: .operationName) try container.encodeIfPresent(variables, forKey: .variables) try container.encodeIfPresent(extensions, forKey: .extensions) - } + } /// Getting parsed operationType public var operationType: OperationType? { @@ -80,11 +79,11 @@ public struct GraphQLRequest: Codable { .compactMap { def -> OperationDefinition? in def as? OperationDefinition } - + guard let operationName = operationName else { return operations.first?.operation } - + return operations .first { guard let name = $0.name?.value else { return false } diff --git a/Sources/Pioneer/Http/HTTPGraphQL.swift b/Sources/Pioneer/Http/HTTPGraphQL.swift index 826c9fe..4f65bb2 100644 --- a/Sources/Pioneer/Http/HTTPGraphQL.swift +++ b/Sources/Pioneer/Http/HTTPGraphQL.swift @@ -5,16 +5,16 @@ // Created by d-exclaimation on 22:16. // -import enum NIOHTTP1.HTTPResponseStatus -import enum NIOHTTP1.HTTPMethod +import struct GraphQL.GraphQLError +import struct GraphQL.GraphQLResult import enum GraphQL.Map import struct NIOHTTP1.HTTPHeaders -import struct GraphQL.GraphQLResult -import struct GraphQL.GraphQLError +import enum NIOHTTP1.HTTPMethod +import enum NIOHTTP1.HTTPResponseStatus -extension Pioneer { +public extension Pioneer { /// HTTP-based GraphQL Response - public struct HTTPGraphQLResponse { + struct HTTPGraphQLResponse { /// GraphQL Result for this response public var result: GraphQLResult @@ -33,11 +33,11 @@ extension Pioneer { } /// HTTP-based GraphQL request - public struct HTTPGraphQLRequest { + struct HTTPGraphQLRequest { /// GraphQL Request for this request public var request: GraphQLRequest - /// HTTP headers given in this request + /// HTTP headers given in this request public var headers: HTTPHeaders /// HTTP method for this request @@ -53,12 +53,12 @@ extension Pioneer { query: String, operationName: String? = nil, variables: [String: Map]? = nil, - headers: HTTPHeaders, - method: HTTPMethod + headers: HTTPHeaders, + method: HTTPMethod ) { self.request = .init(query: query, operationName: operationName, variables: variables) self.headers = headers self.method = method } } -} \ No newline at end of file +} diff --git a/Sources/Pioneer/Http/HttpStrategy.swift b/Sources/Pioneer/Http/HttpStrategy.swift index d8b7b92..2aecdad 100644 --- a/Sources/Pioneer/Http/HttpStrategy.swift +++ b/Sources/Pioneer/Http/HttpStrategy.swift @@ -5,12 +5,12 @@ // Created by d-exclaimation on 4:30 PM. // -import enum NIOHTTP1.HTTPMethod import enum GraphQL.OperationType +import enum NIOHTTP1.HTTPMethod -extension Pioneer { +public extension Pioneer { /// HTTP Operation and routing strategy for GraphQL - public enum HTTPStrategy { + enum HTTPStrategy { /// Only allow `POST` GraphQL Request, most common choice case onlyPost /// Only allow `GET` GraphQL Request, not recommended for most @@ -25,7 +25,7 @@ extension Pioneer { case csrfPrevention /// Allow all operation through `GET` and `POST`. case both - + /// Get the allowed operation for aa type of HTTPMethod /// - Parameter method: The HTTP Method this operation is executed /// - Returns: A list of allowed GraphQL Operation Type diff --git a/Sources/Pioneer/Http/IDE.swift b/Sources/Pioneer/Http/IDE.swift index 1ace49b..cd7b881 100644 --- a/Sources/Pioneer/Http/IDE.swift +++ b/Sources/Pioneer/Http/IDE.swift @@ -5,46 +5,45 @@ // Created by d-exclaimation on 14:17. // -extension Pioneer { +public extension Pioneer { /// GraphQL Hosted IDE - public enum IDE: Equatable { + enum IDE: Equatable { @available(*, deprecated, message: "Use `GraphiQL or Apollo Sandbox instead`") case playground - + /// GraphiQL Browser IDE case graphiql - + /// Embedded Apollo Sandbox case sandbox - + /// Redirect to a cloud based IDE case redirect(to: Cloud) - + /// Disabled any IDEs case disable - + public enum Cloud { /// Cloud version of Apollo Sandbox case apolloSandbox - + /// Cloud version of Banana Cake Pop case bananaCakePop /// URL for Cloud-based IDE public var url: String { - switch (self) { - case .apolloSandbox: - return "https://studio.apollographql.com/sandbox/explorer" - case .bananaCakePop: - return "https://eat.bananacakepop.com" + switch self { + case .apolloSandbox: + return "https://studio.apollographql.com/sandbox/explorer" + case .bananaCakePop: + return "https://eat.bananacakepop.com" } } } - } - + /// GraphQL Playground HTML - public var playgroundHtml: String { + var playgroundHtml: String { let graphqlPlayground = """ @@ -115,7 +114,7 @@ extension Pioneer { } /// GraphiQL HTML - public var graphiqlHtml: String { + var graphiqlHtml: String { let fetcher: String = expression { switch websocketProtocol { case .subscriptionsTransportWs: @@ -124,9 +123,9 @@ extension Pioneer {