Skip to content

Commit

Permalink
[Release] - 0.45.0 (#1862)
Browse files Browse the repository at this point in the history
* Updated docs for networking changes

* Update changelog and bump version

* Update documentation for pattern matching cache delete (#1852)

* Update documentation for pattern matching cache delete

* Add note about cache pattern removal performance

Co-authored-by: Calvin Cestari <[email protected]>
  • Loading branch information
AnthonyMDev and calvincestari authored Jul 6, 2021
1 parent d991cb7 commit 84e28fe
Show file tree
Hide file tree
Showing 49 changed files with 482 additions and 404 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Change log

## v0.45.0
- **Breaking - Downgraded from Starscream v4 to v3!** After upgrading to Starscream 4.0, a lot of our users started to experience crashes while using web sockets. We've decided to revert to the more stable Starscream version 3. In order to fix a few known bugs in Starscream 3, we have made a fork of Starscream that Apollo will depend on going forward. In preparation for moving to Apple WebSockets in the future, we have also fully inverted the dependency on Starscream. Between these two changes, a lot of breaking changes to our Web Socket API have been made:
- The `ApolloWebSocketClient` protocol was removed and replaced with `WebSocketClient`.
- `WebSocketClient` does not rely directly on Starscream anymore and has been streamlined for easier conformance.
- `ApolloWebSocket`, the default implementation of the `WebSocketClient` has been replaced with `DefaultWebSocket`. This implementation uses Starscream, but implementations using other websocket libraries can now be created and used with no need for Starscream.
- `WebSocketClientDelegate` replaces direct dependency on `Starscream.WebSocketDelegate` for delegates.
- **Breaking:** Renamed some of the request chain interceptors object:
- `LegacyInterceptorProvider` -> `DefaultInterceptorProvider`
- `LegacyCacheReadInterceptor` -> `CacheReadInterceptor`
- `LegacyCacheWriteInterceptor` -> `CacheWriteInterceptor`
- `LegacyParsingInterceptor` -> `JSONResponseParsingInterceptor`
- **Breaking:** `WebSocketTransport` is now initialized with an `ApolloWebSocket` (or other object conforming to the `ApolloWebSocketClient` protocol.) Previously, the initializer took in the necessary parameters to create the web socket internally. This provides better dependency injection capabilities and makes testing easier.
- Removed class constraint on `ApolloInterceptor` and converted to structs for all interceptors that could be structs instead of classes.
- Added `removeRecords(matching pattern: CacheKey)` function to the normalized cache.


## v0.44.0

Expand Down
2 changes: 1 addition & 1 deletion Configuration/Shared/Project-Version.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CURRENT_PROJECT_VERSION = 0.44.0
CURRENT_PROJECT_VERSION = 0.45.0
2 changes: 1 addition & 1 deletion SwiftScripts/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"repositoryURL": "https://github.com/apollographql/Starscream",
"state": {
"branch": null,
"revision": "4c985380c92920be5f75c14577e5c2e3615f2337",
"revision": "8cf77babe5901693396436f4f418a6db0f328b78",
"version": "3.1.2"
}
},
Expand Down
23 changes: 8 additions & 15 deletions docs/source/api/Apollo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
- [ApolloErrorInterceptor](protocols/ApolloErrorInterceptor/)
- [ApolloInterceptor](protocols/ApolloInterceptor/)
- [Cancellable](protocols/Cancellable/)
- [FlexibleDecoder](protocols/FlexibleDecoder/)
- [GraphQLFragment](protocols/GraphQLFragment/)
- [GraphQLMapConvertible](protocols/GraphQLMapConvertible/)
- [GraphQLMutation](protocols/GraphQLMutation/)
Expand All @@ -20,14 +19,16 @@
- [JSONEncodable](protocols/JSONEncodable/)
- [NetworkTransport](protocols/NetworkTransport/)
- [NormalizedCache](protocols/NormalizedCache/)
- [Parseable](protocols/Parseable/)
- [RequestBodyCreator](protocols/RequestBodyCreator/)
- [UploadingNetworkTransport](protocols/UploadingNetworkTransport/)

## Structs

- [ApolloRequestBodyCreator](structs/ApolloRequestBodyCreator/)
- [AutomaticPersistedQueryInterceptor](structs/AutomaticPersistedQueryInterceptor/)
- [CacheReadInterceptor](structs/CacheReadInterceptor/)
- [CacheReference](structs/CacheReference/)
- [CacheWriteInterceptor](structs/CacheWriteInterceptor/)
- [FieldArguments](structs/FieldArguments/)
- [GraphQLBooleanCondition](structs/GraphQLBooleanCondition/)
- [GraphQLError](structs/GraphQLError/)
Expand All @@ -40,17 +41,19 @@
- [GraphQLResultError](structs/GraphQLResultError/)
- [GraphQLTypeCase](structs/GraphQLTypeCase/)
- [GraphQLTypeCondition](structs/GraphQLTypeCondition/)
- [JSONResponseParsingInterceptor](structs/JSONResponseParsingInterceptor/)
- [JSONValueMatcher](structs/JSONValueMatcher/)
- [Record](structs/Record/)
- [RecordSet](structs/RecordSet/)
- [ResponseCodeInterceptor](structs/ResponseCodeInterceptor/)

## Classes

- [ApolloClient](classes/ApolloClient/)
- [ApolloStore](classes/ApolloStore/)
- [ApolloStore.ReadTransaction](classes/ApolloStore.ReadTransaction/)
- [ApolloStore.ReadWriteTransaction](classes/ApolloStore.ReadWriteTransaction/)
- [AutomaticPersistedQueryInterceptor](classes/AutomaticPersistedQueryInterceptor/)
- [DefaultInterceptorProvider](classes/DefaultInterceptorProvider/)
- [EmptyCancellable](classes/EmptyCancellable/)
- [GraphQLQueryWatcher](classes/GraphQLQueryWatcher/)
- [GraphQLResponse](classes/GraphQLResponse/)
Expand All @@ -59,16 +62,11 @@
- [InMemoryNormalizedCache](classes/InMemoryNormalizedCache/)
- [JSONRequest](classes/JSONRequest/)
- [JSONSerializationFormat](classes/JSONSerializationFormat/)
- [LegacyCacheReadInterceptor](classes/LegacyCacheReadInterceptor/)
- [LegacyCacheWriteInterceptor](classes/LegacyCacheWriteInterceptor/)
- [LegacyInterceptorProvider](classes/LegacyInterceptorProvider/)
- [LegacyParsingInterceptor](classes/LegacyParsingInterceptor/)
- [MaxRetryInterceptor](classes/MaxRetryInterceptor/)
- [MultipartFormData](classes/MultipartFormData/)
- [NetworkFetchInterceptor](classes/NetworkFetchInterceptor/)
- [RequestChain](classes/RequestChain/)
- [RequestChainNetworkTransport](classes/RequestChainNetworkTransport/)
- [ResponseCodeInterceptor](classes/ResponseCodeInterceptor/)
- [TaskData](classes/TaskData/)
- [URLSessionClient](classes/URLSessionClient/)
- [UploadRequest](classes/UploadRequest/)
Expand All @@ -78,16 +76,15 @@
- [ApolloClient.ApolloClientError](enums/ApolloClient.ApolloClientError/)
- [AutomaticPersistedQueryInterceptor.APQError](enums/AutomaticPersistedQueryInterceptor.APQError/)
- [CachePolicy](enums/CachePolicy/)
- [CacheWriteInterceptor.CacheWriteError](enums/CacheWriteInterceptor.CacheWriteError/)
- [GraphQLFile.GraphQLFileError](enums/GraphQLFile.GraphQLFileError/)
- [GraphQLHTTPRequestError](enums/GraphQLHTTPRequestError/)
- [GraphQLOperationType](enums/GraphQLOperationType/)
- [GraphQLOutputType](enums/GraphQLOutputType/)
- [GraphQLResult.Source](enums/GraphQLResult.Source/)
- [JSONDecodingError](enums/JSONDecodingError/)
- [LegacyCacheWriteInterceptor.LegacyCacheWriteError](enums/LegacyCacheWriteInterceptor.LegacyCacheWriteError/)
- [LegacyParsingInterceptor.LegacyParsingError](enums/LegacyParsingInterceptor.LegacyParsingError/)
- [JSONResponseParsingInterceptor.JSONResponseParsingError](enums/JSONResponseParsingInterceptor.JSONResponseParsingError/)
- [MaxRetryInterceptor.RetryError](enums/MaxRetryInterceptor.RetryError/)
- [ParseableError](enums/ParseableError/)
- [RequestChain.ChainError](enums/RequestChain.ChainError/)
- [ResponseCodeInterceptor.ResponseCodeError](enums/ResponseCodeInterceptor.ResponseCodeError/)
- [URLSessionClient.URLSessionClientError](enums/URLSessionClient.URLSessionClientError/)
Expand All @@ -107,7 +104,6 @@
- [GraphQLMutation](extensions/GraphQLMutation/)
- [GraphQLOperation](extensions/GraphQLOperation/)
- [GraphQLQuery](extensions/GraphQLQuery/)
- [GraphQLResult](extensions/GraphQLResult/)
- [GraphQLSelectionSet](extensions/GraphQLSelectionSet/)
- [GraphQLSubscription](extensions/GraphQLSubscription/)
- [HTTPRequest](extensions/HTTPRequest/)
Expand All @@ -117,7 +113,6 @@
- [NSNull](extensions/NSNull/)
- [NetworkTransport](extensions/NetworkTransport/)
- [Optional](extensions/Optional/)
- [Parseable](extensions/Parseable/)
- [RawRepresentable](extensions/RawRepresentable/)
- [Record](extensions/Record/)
- [RecordSet](extensions/RecordSet/)
Expand All @@ -135,10 +130,8 @@
- [GraphQLID](typealiases/GraphQLID/)
- [GraphQLMap](typealiases/GraphQLMap/)
- [GraphQLResultHandler](typealiases/GraphQLResultHandler/)
- [JSONDecoder.Input](typealiases/JSONDecoder.Input/)
- [JSONObject](typealiases/JSONObject/)
- [JSONValue](typealiases/JSONValue/)
- [PropertyListDecoder.Input](typealiases/PropertyListDecoder.Input/)
- [Record.Fields](typealiases/Record.Fields/)
- [Record.Value](typealiases/Record.Value/)
- [ResultMap](typealiases/ResultMap/)
Expand Down
26 changes: 26 additions & 0 deletions docs/source/api/Apollo/classes/ApolloStore.ReadWriteTransaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,32 @@ does not exist for the given key.
| ---- | ----------- |
| key | The cache key to remove the object for |

### `removeObjects(matching:)`

```swift
public func removeObjects(matching pattern: CacheKey) throws
```

Removes records with keys that match the specified pattern. This method will only
remove whole records, it does not perform cascading deletes. This means only the
records with matched keys will be removed, and not any references to them. Key
matching is case-insensitive.

If you attempt to pass a cache path for a single field, this method will do nothing
since it won't be able to locate a record to remove based on that path.

- Note: This method can be very slow depending on the number of records in the cache.
It is recommended that this method be called in a background queue.

- Parameters:
- pattern: The pattern that will be applied to find matching keys.

#### Parameters

| Name | Description |
| ---- | ----------- |
| pattern | The pattern that will be applied to find matching keys. |

### `write(data:forQuery:)`

```swift
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
**CLASS**

# `LegacyInterceptorProvider`
# `DefaultInterceptorProvider`

```swift
open class LegacyInterceptorProvider: InterceptorProvider
open class DefaultInterceptorProvider: InterceptorProvider
```

The default interceptor provider for typescript-generated code
Expand Down
22 changes: 1 addition & 21 deletions docs/source/api/Apollo/classes/GraphQLResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# `GraphQLResponse`

```swift
public final class GraphQLResponse<Data: GraphQLSelectionSet>: Parseable
public final class GraphQLResponse<Data: GraphQLSelectionSet>
```

Represents a GraphQL response received from a server.
Expand All @@ -16,32 +16,12 @@ public let body: JSONObject
```

## Methods
### `init(from:decoder:)`

```swift
public init<T>(from data: Foundation.Data, decoder: T) throws where T : FlexibleDecoder
```

#### Parameters

| Name | Description |
| ---- | ----------- |
| data | The data to decode |
| decoder | The decoder to use to decode it |

### `init(operation:body:)`

```swift
public init<Operation: GraphQLOperation>(operation: Operation, body: JSONObject) where Operation.Data == Data
```

### `parseResultWithCompletion(cacheKeyForObject:completion:)`

```swift
public func parseResultWithCompletion(cacheKeyForObject: CacheKeyForObject? = nil,
completion: (Result<(GraphQLResult<Data>, RecordSet?), Error>) -> Void)
```

### `parseErrorsOnlyFast()`

```swift
Expand Down
4 changes: 2 additions & 2 deletions docs/source/api/Apollo/classes/HTTPResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public var parsedResponse: GraphQLResult<Operation.Data>?
public var legacyResponse: GraphQLResponse<Operation.Data>? = nil
```

[optional] The data as parsed into a `GraphQLResponse` for legacy caching purposes. If you're not using the `LegacyParsingInterceptor`, you probably shouldn't be using this property.
**NOTE:** This property will be removed when the transition to a Codable-based Codegen is complete.
[optional] The data as parsed into a `GraphQLResponse` for legacy caching purposes. If you're not using the `JSONResponseParsingInterceptor`, you probably shouldn't be using this property.
**NOTE:** This property will be removed when the transition to the Swift Codegen is complete.

## Methods
### `init(response:rawData:parsedResponse:)`
Expand Down
12 changes: 12 additions & 0 deletions docs/source/api/Apollo/classes/InMemoryNormalizedCache.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ public func merge(records newRecords: RecordSet) throws -> Set<CacheKey>
| ---- | ----------- |
| records | The set of records to merge. |

### `removeRecords(matching:)`

```swift
public func removeRecords(matching pattern: CacheKey) throws
```

#### Parameters

| Name | Description |
| ---- | ----------- |
| pattern | The pattern that will be applied to find matching keys. |

### `clear()`

```swift
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
**ENUM**

# `LegacyCacheWriteInterceptor.LegacyCacheWriteError`
# `CacheWriteInterceptor.CacheWriteError`

```swift
public enum LegacyCacheWriteError: Error, LocalizedError
public enum CacheWriteError: Error, LocalizedError
```

## Cases
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
**ENUM**

# `LegacyParsingInterceptor.LegacyParsingError`
# `JSONResponseParsingInterceptor.JSONResponseParsingError`

```swift
public enum LegacyParsingError: Error, LocalizedError
public enum JSONResponseParsingError: Error, LocalizedError
```

## Cases
Expand All @@ -13,10 +13,10 @@ public enum LegacyParsingError: Error, LocalizedError
case noResponseToParse
```

### `couldNotParseToLegacyJSON(data:)`
### `couldNotParseToJSON(data:)`

```swift
case couldNotParseToLegacyJSON(data: Data)
case couldNotParseToJSON(data: Data)
```

## Properties
Expand Down
26 changes: 0 additions & 26 deletions docs/source/api/Apollo/enums/ParseableError.md

This file was deleted.

13 changes: 0 additions & 13 deletions docs/source/api/Apollo/extensions/GraphQLResult.md

This file was deleted.

20 changes: 0 additions & 20 deletions docs/source/api/Apollo/extensions/Parseable.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/api/Apollo/protocols/ApolloInterceptor.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# `ApolloInterceptor`

```swift
public protocol ApolloInterceptor: AnyObject
public protocol ApolloInterceptor
```

A protocol to set up a chainable unit of networking work.
Expand Down
14 changes: 0 additions & 14 deletions docs/source/api/Apollo/protocols/FlexibleDecoder.md

This file was deleted.

Loading

0 comments on commit 84e28fe

Please sign in to comment.