From 2e32b3a145f15e16fdc8571f43579ba7e0576acf Mon Sep 17 00:00:00 2001 From: Calvin Cestari Date: Mon, 28 Feb 2022 13:28:17 -0800 Subject: [PATCH] Release 0.51.0 (#2086) * Update version number * Update changelog * Update SourceDocsLib dependecy * Update generated documentation * Update changelog with cache key caveat * Update changelog for merging of #2147 * Update changelog for #2177 and #2168 * Update documentation --- CHANGELOG.md | 6 ++ Configuration/Shared/Project-Version.xcconfig | 2 +- SwiftScripts/Package.resolved | 26 ++------- SwiftScripts/Package.swift | 6 +- docs/source/api/Apollo/enums/CachePolicy.md | 9 +++ .../api/Apollo/extensions/NetworkTransport.md | 32 ++++++++++ .../api/Apollo/protocols/GraphQLFragment.md | 13 +++++ .../Apollo/protocols/GraphQLSelectionSet.md | 6 ++ docs/source/api/Apollo/structs/GraphQLFile.md | 8 +++ .../source/api/ApolloAPI/enums/GraphQLEnum.md | 9 +++ .../ApolloAPI/protocols/AnySelectionSet.md | 7 +++ .../ApolloAPI/protocols/SchemaObjectType.md | 6 ++ .../api/ApolloAPI/protocols/SelectionSet.md | 11 ++++ .../classes/JavaScriptError.md | 4 +- ...olloCodegenOptions.CodeGenerationEngine.md | 9 +++ .../structs/ApolloCodegenOptions.md | 2 +- .../ApolloCodegenLib/structs/CodegenLogger.md | 10 ++++ docs/source/api/ApolloSQLite/README.md | 1 + .../ApolloSQLite/extensions/SQLiteDatabase.md | 31 ++++++++++ .../extensions/ApolloCompatible.md | 6 ++ .../ApolloUtils/protocols/ApolloCompatible.md | 8 +++ docs/source/api/ApolloWebSocket/README.md | 1 + .../api/ApolloWebSocket/classes/WebSocket.md | 58 ++++++++++++++++--- .../enums/WebSocket.WSProtocol.md | 35 +++++++++++ 24 files changed, 270 insertions(+), 36 deletions(-) create mode 100644 docs/source/api/ApolloSQLite/extensions/SQLiteDatabase.md create mode 100644 docs/source/api/ApolloWebSocket/enums/WebSocket.WSProtocol.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 79a31277e0..034dfbd70b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change log +## v0.51.0 +- **Allow periods in arguments to be ignored when parsing cacheKeys**: If your query arguments include periods they will no longer cause broken cache keys. This means the cached data for those queries can be correctly found and returned. The caveat with this change though is that if you use a persisted cache, after the upgrade you could see cache misses and the data would be refetched. [#2057](https://github.com/apollographql/apollo-ios/pull/2057) - _Thanks to [Hesham Salman](https://github.com/Iron-Ham) for the contribution._ +- **Fixed - [`Sendable` class `JavaScriptError` cannot inherit from another class other than `NSObject`](https://github.com/apollographql/apollo-ios/issues/2146):** Xcode 13.3 introduced some additional requirements for `Error` types and `JavaScriptError` did not conform causing compile errors in `ApolloCodegenLib`. This change disables `Sendable` type checking for `JavaScriptError` while maintaining type-safety across concurrency boundaries. [#2147](https://github.com/apollographql/apollo-ios/pull/2147) - _Thank you to [Tiziano Coroneo](https://github.com/TizianoCoroneo) for the contribution._ +- **Fixed - [Watcher using a policy that shouldn't hit the network, can still hit the network](https://github.com/apollographql/apollo-ios/issues/2170):** If the cache policy given to the `watch(query:cachePolicy:)` method of `ApolloClient` was `.returnCacheDataDontFetch` it could still trigger a remote fetch of the query. - _Thank you to [Peter Potrebic](https://github.com/potrebic) for raising the issue._ +- **BREAKING CHANGE - [`graphql-ws` Protocol Support](https://github.com/apollographql/apollo-ios/issues/1622):** We've added official support for the [graphql-ws](https://github.com/enisdenjo/graphql-ws) library and its [`graphql-transport-ws`](https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md) protocol. This is a breaking change because the `WebSocket` initializers now require you to specify which protocol to use. + ## v0.50.0 - **Dropped SPM support for Swift 5.2**: The minimum version of the Swift tools and language compatibilty required to process the SPM manifest is Swift 5.3. This means a minimum of Xcode version 12 is required for Swift Package Manager support. [#1992](https://github.com/apollographql/apollo-ios/pull/1992) - **Removed unnecessary assertion failure**: The completion handler on `returnResultAsyncIfNeeded` is defined as optional but if not included would cause debug builds to crash with an `assertionFailure` in the case of a `failure` of the `Result`. [#2005](https://github.com/apollographql/apollo-ios/pull/2005) - _Thank you to [Richard Topchii](https://github.com/richardtop) for raising this issue!_ diff --git a/Configuration/Shared/Project-Version.xcconfig b/Configuration/Shared/Project-Version.xcconfig index dbbea639e9..8de5d2383b 100644 --- a/Configuration/Shared/Project-Version.xcconfig +++ b/Configuration/Shared/Project-Version.xcconfig @@ -1 +1 @@ -CURRENT_PROJECT_VERSION = 0.50.0 +CURRENT_PROJECT_VERSION = 0.51.0 diff --git a/SwiftScripts/Package.resolved b/SwiftScripts/Package.resolved index ddb01ec969..446d6343af 100644 --- a/SwiftScripts/Package.resolved +++ b/SwiftScripts/Package.resolved @@ -60,8 +60,8 @@ "repositoryURL": "https://github.com/eneko/SourceDocs.git", "state": { "branch": null, - "revision": "6c6443434ef04328dc18ac71c73e7a2ec0d531d1", - "version": "1.2.1" + "revision": "3a38adfe18ca73dfc2136b4b8c49407d1a812d50", + "version": "2.0.0" } }, { @@ -87,26 +87,8 @@ "repositoryURL": "https://github.com/apple/swift-argument-parser.git", "state": { "branch": null, - "revision": "92646c0cdbaca076c8d3d0207891785b3379cbff", - "version": "0.3.1" - } - }, - { - "package": "llbuild", - "repositoryURL": "https://github.com/apple/swift-llbuild.git", - "state": { - "branch": null, - "revision": "f1c9ad9a253cdf1aa89a7f5c99c30b4513b06ddb", - "version": "0.1.1" - } - }, - { - "package": "SwiftPM", - "repositoryURL": "https://github.com/apple/swift-package-manager", - "state": { - "branch": null, - "revision": "8656a25cb906c1896339f950ac960ee1b4fe8034", - "version": "0.4.0" + "revision": "e1465042f195f374b94f915ba8ca49de24300a0d", + "version": "1.0.2" } }, { diff --git a/SwiftScripts/Package.swift b/SwiftScripts/Package.swift index 1adc36751d..6762e45fde 100644 --- a/SwiftScripts/Package.swift +++ b/SwiftScripts/Package.swift @@ -6,12 +6,12 @@ import PackageDescription let package = Package( name: "Codegen", platforms: [ - .macOS(.v10_14) + .macOS(.v10_15) ], dependencies: [ .package(name: "Apollo", path: ".."), - .package(url: "https://github.com/apple/swift-argument-parser.git", from: "0.3.0"), - .package(url: "https://github.com/eneko/SourceDocs.git", .upToNextMinor(from: "1.2.0")) + .package(url: "https://github.com/apple/swift-argument-parser.git", .upToNextMinor(from: "1.0.2")), + .package(url: "https://github.com/eneko/SourceDocs.git", .upToNextMinor(from: "2.0.0")) ], targets: [ .target(name: "Codegen", diff --git a/docs/source/api/Apollo/enums/CachePolicy.md b/docs/source/api/Apollo/enums/CachePolicy.md index 63b72d3c04..059a6458ff 100644 --- a/docs/source/api/Apollo/enums/CachePolicy.md +++ b/docs/source/api/Apollo/enums/CachePolicy.md @@ -48,3 +48,12 @@ case returnCacheDataAndFetch ``` Return data from the cache if available, and always fetch results from the server. + +## Properties +### `default` + +```swift +public static var `default`: CachePolicy = .returnCacheDataElseFetch +``` + +The current default cache policy. diff --git a/docs/source/api/Apollo/extensions/NetworkTransport.md b/docs/source/api/Apollo/extensions/NetworkTransport.md index af2950417a..9f1cdfbb36 100644 --- a/docs/source/api/Apollo/extensions/NetworkTransport.md +++ b/docs/source/api/Apollo/extensions/NetworkTransport.md @@ -6,12 +6,44 @@ public extension NetworkTransport ``` ## Properties +### `headerFieldNameApolloClientName` + +```swift +static var headerFieldNameApolloClientName: String +``` + +The field name for the Apollo Client Name header + +### `headerFieldNameApolloClientVersion` + +```swift +static var headerFieldNameApolloClientVersion: String +``` + +The field name for the Apollo Client Version header + +### `defaultClientName` + +```swift +static var defaultClientName: String +``` + +The default client name to use when setting up the `clientName` property + ### `clientName` ```swift var clientName: String ``` +### `defaultClientVersion` + +```swift +static var defaultClientVersion: String +``` + +The default client version to use when setting up the `clientVersion` property. + ### `clientVersion` ```swift diff --git a/docs/source/api/Apollo/protocols/GraphQLFragment.md b/docs/source/api/Apollo/protocols/GraphQLFragment.md index 0d354baa3d..605bcf746c 100644 --- a/docs/source/api/Apollo/protocols/GraphQLFragment.md +++ b/docs/source/api/Apollo/protocols/GraphQLFragment.md @@ -5,3 +5,16 @@ ```swift public protocol GraphQLFragment: GraphQLSelectionSet ``` + +## Properties +### `fragmentDefinition` + +```swift +static var fragmentDefinition: String +``` + +### `possibleTypes` + +```swift +static var possibleTypes: [String] +``` diff --git a/docs/source/api/Apollo/protocols/GraphQLSelectionSet.md b/docs/source/api/Apollo/protocols/GraphQLSelectionSet.md index 4db0be2c54..49e3c93753 100644 --- a/docs/source/api/Apollo/protocols/GraphQLSelectionSet.md +++ b/docs/source/api/Apollo/protocols/GraphQLSelectionSet.md @@ -7,6 +7,12 @@ public protocol GraphQLSelectionSet ``` ## Properties +### `selections` + +```swift +static var selections: [GraphQLSelection] +``` + ### `resultMap` ```swift diff --git a/docs/source/api/Apollo/structs/GraphQLFile.md b/docs/source/api/Apollo/structs/GraphQLFile.md index 1d4c68ea96..53673632a3 100644 --- a/docs/source/api/Apollo/structs/GraphQLFile.md +++ b/docs/source/api/Apollo/structs/GraphQLFile.md @@ -45,6 +45,14 @@ public let fileURL: URL? public let contentLength: UInt64 ``` +### `octetStreamMimeType` + +```swift +public static let octetStreamMimeType = "application/octet-stream" +``` + +A convenience constant for declaring your mimetype is octet-stream. + ## Methods ### `init(fieldName:originalName:mimeType:data:)` diff --git a/docs/source/api/ApolloAPI/enums/GraphQLEnum.md b/docs/source/api/ApolloAPI/enums/GraphQLEnum.md index 6e60d79cf3..11ca74097f 100644 --- a/docs/source/api/ApolloAPI/enums/GraphQLEnum.md +++ b/docs/source/api/ApolloAPI/enums/GraphQLEnum.md @@ -46,6 +46,15 @@ The underlying enum case. If the value is `__unknown`, this will be `nil`. public var rawValue: String ``` +### `allCases` + +```swift +public static var allCases: [GraphQLEnum] +``` + +A collection of all known values of the wrapped enum. +This collection does not include the `__unknown` case. + ## Methods ### `init(_:)` diff --git a/docs/source/api/ApolloAPI/protocols/AnySelectionSet.md b/docs/source/api/ApolloAPI/protocols/AnySelectionSet.md index a362b1c8b7..5c552d8060 100644 --- a/docs/source/api/ApolloAPI/protocols/AnySelectionSet.md +++ b/docs/source/api/ApolloAPI/protocols/AnySelectionSet.md @@ -5,3 +5,10 @@ ```swift public protocol AnySelectionSet: ResponseObject ``` + +## Properties +### `selections` + +```swift +static var selections: [Selection] +``` diff --git a/docs/source/api/ApolloAPI/protocols/SchemaObjectType.md b/docs/source/api/ApolloAPI/protocols/SchemaObjectType.md index e2f324988b..307f7e80f0 100644 --- a/docs/source/api/ApolloAPI/protocols/SchemaObjectType.md +++ b/docs/source/api/ApolloAPI/protocols/SchemaObjectType.md @@ -7,6 +7,12 @@ public protocol SchemaObjectType: SchemaTypeEnum ``` ## Properties +### `unknownCase` + +```swift +static var unknownCase: Self +``` + ### `implementedInterfaces` ```swift diff --git a/docs/source/api/ApolloAPI/protocols/SelectionSet.md b/docs/source/api/ApolloAPI/protocols/SelectionSet.md index bf1d1a77c2..3bbc44f1a0 100644 --- a/docs/source/api/ApolloAPI/protocols/SelectionSet.md +++ b/docs/source/api/ApolloAPI/protocols/SelectionSet.md @@ -5,3 +5,14 @@ ```swift public protocol SelectionSet: ResponseObject, Equatable ``` + +## Properties +### `__parentType` + +```swift +static var __parentType: SelectionSetType +``` + +The GraphQL type for the `SelectionSet`. + +This may be a concrete type (`ConcreteType`) or an abstract type (`Interface`). diff --git a/docs/source/api/ApolloCodegenLib/classes/JavaScriptError.md b/docs/source/api/ApolloCodegenLib/classes/JavaScriptError.md index 92d74a110d..1385b6e0cb 100644 --- a/docs/source/api/ApolloCodegenLib/classes/JavaScriptError.md +++ b/docs/source/api/ApolloCodegenLib/classes/JavaScriptError.md @@ -3,8 +3,8 @@ # `JavaScriptError` ```swift -public class JavaScriptError: JavaScriptObject, Error +public class JavaScriptError: JavaScriptObject, Error, @unchecked Sendable ``` -An errror thrown during JavaScript execution. +An error thrown during JavaScript execution. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error diff --git a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenOptions.CodeGenerationEngine.md b/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenOptions.CodeGenerationEngine.md index 855e9c6b19..b4df3db997 100644 --- a/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenOptions.CodeGenerationEngine.md +++ b/docs/source/api/ApolloCodegenLib/enums/ApolloCodegenOptions.CodeGenerationEngine.md @@ -16,3 +16,12 @@ case typescript ``` The default, tried and true code generation engine + +## Properties +### `default` + +```swift +public static var `default`: CodeGenerationEngine +``` + +The current default for the code generation engine. diff --git a/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenOptions.md b/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenOptions.md index b58878e4bf..2a50ecdebb 100644 --- a/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenOptions.md +++ b/docs/source/api/ApolloCodegenLib/structs/ApolloCodegenOptions.md @@ -41,7 +41,7 @@ Designated initializer. - outputFormat: The `OutputFormat` enum option to use to output generated code. - customScalarFormat: How to handle properties using a custom scalar from the schema. - suppressSwiftMultilineStringLiterals: Don't use multi-line string literals when generating code. Defaults to false. - - urlToSchemaFile: The URL to your schema file. + - urlToSchemaFile: The URL to your schema file. Accepted file types are `.json` for JSON files, or either `.graphqls` or `.sdl` for Schema Definition Language files. - downloadTimeout: The maximum time to wait before indicating that the download timed out, in seconds. Defaults to 30 seconds. ### `init(targetRootURL:codegenEngine:downloadTimeout:)` diff --git a/docs/source/api/ApolloCodegenLib/structs/CodegenLogger.md b/docs/source/api/ApolloCodegenLib/structs/CodegenLogger.md index f562c61722..2ecccda14b 100644 --- a/docs/source/api/ApolloCodegenLib/structs/CodegenLogger.md +++ b/docs/source/api/ApolloCodegenLib/structs/CodegenLogger.md @@ -8,6 +8,16 @@ public struct CodegenLogger Helper to get logs printing to stdout so they can be read from the command line. +## Properties +### `level` + +```swift +public static var level = LogLevel.debug +``` + +The `LogLevel` at which to print logs. Higher raw values than this will +be ignored. Defaults to `debug`. + ## Methods ### `log(_:logLevel:file:line:)` diff --git a/docs/source/api/ApolloSQLite/README.md b/docs/source/api/ApolloSQLite/README.md index d5e8cc509f..8cb54bf69b 100644 --- a/docs/source/api/ApolloSQLite/README.md +++ b/docs/source/api/ApolloSQLite/README.md @@ -19,6 +19,7 @@ ## Extensions +- [SQLiteDatabase](extensions/SQLiteDatabase/) - [SQLiteNormalizedCache](extensions/SQLiteNormalizedCache/) This file was generated by [SourceDocs](https://github.com/eneko/SourceDocs) \ No newline at end of file diff --git a/docs/source/api/ApolloSQLite/extensions/SQLiteDatabase.md b/docs/source/api/ApolloSQLite/extensions/SQLiteDatabase.md new file mode 100644 index 0000000000..dc849b62cc --- /dev/null +++ b/docs/source/api/ApolloSQLite/extensions/SQLiteDatabase.md @@ -0,0 +1,31 @@ +**EXTENSION** + +# `SQLiteDatabase` +```swift +public extension SQLiteDatabase +``` + +## Properties +### `tableName` + +```swift +static var tableName: String +``` + +### `idColumnName` + +```swift +static var idColumnName: String +``` + +### `keyColumnName` + +```swift +static var keyColumnName: String +``` + +### `recordColumName` + +```swift +static var recordColumName: String +``` diff --git a/docs/source/api/ApolloUtils/extensions/ApolloCompatible.md b/docs/source/api/ApolloUtils/extensions/ApolloCompatible.md index 74417e0b88..70bb4d58fa 100644 --- a/docs/source/api/ApolloUtils/extensions/ApolloCompatible.md +++ b/docs/source/api/ApolloUtils/extensions/ApolloCompatible.md @@ -11,3 +11,9 @@ extension ApolloCompatible ```swift public var apollo: ApolloExtension ``` + +### `apollo` + +```swift +public static var apollo: ApolloExtension.Type +``` diff --git a/docs/source/api/ApolloUtils/protocols/ApolloCompatible.md b/docs/source/api/ApolloUtils/protocols/ApolloCompatible.md index 00b6f8f6bc..6aa9715956 100644 --- a/docs/source/api/ApolloUtils/protocols/ApolloCompatible.md +++ b/docs/source/api/ApolloUtils/protocols/ApolloCompatible.md @@ -19,3 +19,11 @@ var apollo: ApolloExtension ``` The `ApolloExtension` object for an instance + +### `apollo` + +```swift +static var apollo: ApolloExtension.Type +``` + +The `ApolloExtension` object for a type diff --git a/docs/source/api/ApolloWebSocket/README.md b/docs/source/api/ApolloWebSocket/README.md index 10fb1d81cc..6cadfce05d 100644 --- a/docs/source/api/ApolloWebSocket/README.md +++ b/docs/source/api/ApolloWebSocket/README.md @@ -29,6 +29,7 @@ - [WSError.ErrorType](enums/WSError.ErrorType/) - [WebSocket.OpCode](enums/WebSocket.OpCode/) +- [WebSocket.WSProtocol](enums/WebSocket.WSProtocol/) - [WebSocketError.ErrorKind](enums/WebSocketError.ErrorKind/) ## Extensions diff --git a/docs/source/api/ApolloWebSocket/classes/WebSocket.md b/docs/source/api/ApolloWebSocket/classes/WebSocket.md index 35751595d9..c828815000 100644 --- a/docs/source/api/ApolloWebSocket/classes/WebSocket.md +++ b/docs/source/api/ApolloWebSocket/classes/WebSocket.md @@ -125,26 +125,70 @@ public var respondToPingWithPong: Bool = true ``` ## Methods -### `init(request:)` +### `init(request:protocol:)` ```swift -public init(request: URLRequest) +public init(request: URLRequest, protocol: WSProtocol) ``` -Used for setting protocols. +Designated initializer. -### `init(url:)` +- Parameters: + - request: A URL request object that provides request-specific information such as the URL. + - protocol: Protocol to use for communication over the web socket. + +#### Parameters + +| Name | Description | +| ---- | ----------- | +| request | A URL request object that provides request-specific information such as the URL. | +| protocol | Protocol to use for communication over the web socket. | + +### `init(url:protocol:)` ```swift -public convenience init(url: URL) +public convenience init(url: URL, protocol: WSProtocol) ``` -### `init(url:writeQueueQOS:)` +Convenience initializer to specify the URL and web socket protocol. + +- Parameters: + - url: The destination URL to connect to. + - protocol: Protocol to use for communication over the web socket. + +#### Parameters + +| Name | Description | +| ---- | ----------- | +| url | The destination URL to connect to. | +| protocol | Protocol to use for communication over the web socket. | + +### `init(url:writeQueueQOS:protocol:)` ```swift -public convenience init(url: URL, writeQueueQOS: QualityOfService) +public convenience init( + url: URL, + writeQueueQOS: QualityOfService, + protocol: WSProtocol +) ``` +Convenience initializer to specify the URL and web socket protocol with a specific quality of +service on the write queue. + +- Parameters: + - url: The destination URL to connect to. + - writeQueueQOS: Specifies the quality of service for the write queue. + - protocol: Protocol to use for communication over the web socket. + +#### Parameters + +| Name | Description | +| ---- | ----------- | +| url | The destination URL to connect to. | +| writeQueueQOS | Specifies the quality of service for the write queue. | +| protocol | Protocol to use for communication over the web socket. | + ### `connect()` ```swift diff --git a/docs/source/api/ApolloWebSocket/enums/WebSocket.WSProtocol.md b/docs/source/api/ApolloWebSocket/enums/WebSocket.WSProtocol.md new file mode 100644 index 0000000000..b609043b0c --- /dev/null +++ b/docs/source/api/ApolloWebSocket/enums/WebSocket.WSProtocol.md @@ -0,0 +1,35 @@ +**ENUM** + +# `WebSocket.WSProtocol` + +```swift +public enum WSProtocol: CustomStringConvertible +``` + +The GraphQL over WebSocket protocols supported by apollo-ios. + +## Cases +### `graphql_ws` + +```swift +case graphql_ws +``` + +WebSocket protocol `graphql-ws`. This is implemented by the [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws) +and AWS AppSync libraries. + +### `graphql_transport_ws` + +```swift +case graphql_transport_ws +``` + +WebSocket protocol `graphql-transport-ws`. This is implemented by the [graphql-ws](https://github.com/enisdenjo/graphql-ws) +library. + +## Properties +### `description` + +```swift +public var description: String +```