Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version Packages #3021

Merged
merged 1 commit into from
Mar 9, 2023
Merged

Version Packages #3021

merged 1 commit into from
Mar 9, 2023

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Mar 9, 2023

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@urql/[email protected]

Major Changes

  • Implement new authExchange API, which removes the need for an authState (i.e. an internal authentication state) and removes getAuth, replacing it with a separate refreshAuth flow.
    The new API requires you to now pass an initializer function. This function receives a utils
    object with utils.mutate and utils.appendHeaders utility methods.
    It must return the configuration object, wrapped in a promise, and this configuration is similar to
    what we had before, if you're migrating to this. Its refreshAuth method is now only called after
    authentication errors occur and not on initialization. Instead, it's now recommended that you write
    your initialization logic in-line.
    authExchange(async utils => {
      let token = localStorage.getItem('token');
      let refreshToken = localStorage.getItem('refreshToken');
      return {
        addAuthToOperation(operation) {
          return utils.appendHeaders(operation, {
            Authorization: `Bearer ${token}`,
          });
        },
        didAuthError(error) {
          return error.graphQLErrors.some(
            e => e.extensions?.code === 'FORBIDDEN'
          );
        },
        async refreshAuth() {
          const result = await utils.mutate(REFRESH, { token });
          if (result.data?.refreshLogin) {
            token = result.data.refreshLogin.token;
            refreshToken = result.data.refreshLogin.refreshToken;
            localStorage.setItem('token', token);
            localStorage.setItem('refreshToken', refreshToken);
          }
        },
      };
    });
    Submitted by @kitten (See #3012)

Patch Changes

  • ⚠️ Fix willAuthError not being called for operations that are waiting on the authentication state to update. This can actually lead to a common issue where operations that came in during the authentication initialization (on startup) will never have willAuthError called on them. This can cause an easy mistake where the initial authentication state is never checked to be valid
    Submitted by @kitten (See #3017)
  • Updated dependencies (See #3007, #2962, #3007, #3015, and #3022)

@urql/[email protected]

Minor Changes

  • Add isOfflineError option to the offlineExchange to allow it to be customized to different conditions to determine whether an operation has failed because of a network error
    Submitted by @robertherber (See #3020)
  • Allow updates config to react to arbitrary type updates other than just Mutation and Subscription fields.
    You’ll now be able to write updaters that react to any entity field being written to the cache,
    which allows for more granular invalidations. Note: If you’ve previously used updates.Mutation
    and updated.Subscription with a custom schema with custom root names, you‘ll get a warning since
    you’ll have to update your updates config to reflect this. This was a prior implementation
    mistake!
    Submitted by @kitten (See #2979)

Patch Changes

  • ⚠️ Fix regression which caused partial results, whose refetches were blocked by the looping protection, to not have a stale: true flag added to them. This is a regression from fix(graphcache): fix loop bug when schema is present #2831 and only applies to cacheExchanges that had the schema option set
    Submitted by @kitten (See #2999)
  • Add invariant to data layer that prevents cache writes during cache query operations. This prevents cache.writeFragment, cache.updateQuery, and cache.link from being called in resolvers for instance
    Submitted by @kitten (See #2978)
  • Updated dependencies (See #3007, #2962, #3007, #3015, and #3022)

@urql/[email protected]

Minor Changes

  • Introduce maxDepth and skipType into the populateExchange, these options allow you to specify
    the maximum depth a mutation should be populated as well as which types should not be counted towards
    this depth
    Submitted by @JoviDeCroock (See #3023)

Patch Changes

@urql/[email protected]

Minor Changes

  • Update support for the "Incremental Delivery" payload specification, accepting the new incremental property on execution results, as per the specification. This will expand support for newer APIs implementing the more up-to-date specification
    Submitted by @kitten (See #3007)
  • Update default Accept header to include multipart/mixed and application/graphql-response+json. The former seems to now be a defactor standard-accepted indication for support of the "Incremental Delivery" GraphQL over HTTP spec addition/RFC, and the latter is an updated form of the older Content-Type of GraphQL responses, so both the old and new one should now be included
    Submitted by @kitten (See #3007)

Patch Changes

  • Add TSDoc annotations to all external @urql/core APIs
    Submitted by @kitten (See #2962)
  • ⚠️ Fix subscriptions not being duplicated when hasNext isn't set. The hasNext field is an upcoming "Incremental Delivery" field. When a subscription result doesn't set it we now set it to true manually. This indicates to the dedupExchange that no duplicate subscription operations should be started
    Submitted by @kitten (See #3015)
  • Expose consistent GraphQLRequestParams utility type from which GraphQLRequests are created in all bindings
    Submitted by @kitten (See #3022)

@urql/[email protected]

Patch Changes

  • ⚠️ Fix type utilities turning the variables properties optional when a type from TypedDocumentNode has no Variables or all optional Variables. Previously this would break for wrappers, e.g. in code generators, or when the type didn't quite match what we'd expect
    Submitted by @kitten (See #3022)
  • Updated dependencies (See #3007, #2962, #3007, #3015, and #3022)

[email protected]

Patch Changes

  • ⚠️ Fix type utilities turning the variables properties optional when a type from TypedDocumentNode has no Variables or all optional Variables. Previously this would break for wrappers, e.g. in code generators, or when the type didn't quite match what we'd expect
    Submitted by @kitten (See #3022)
  • Updated dependencies (See #3007, #2962, #3007, #3015, and #3022)

@urql/[email protected]

Patch Changes

  • ⚠️ Fix type utilities turning the variables properties optional when a type from TypedDocumentNode has no Variables or all optional Variables. Previously this would break for wrappers, e.g. in code generators, or when the type didn't quite match what we'd expect
    Submitted by @kitten (See #3022)
  • Updated dependencies (See #3007, #2962, #3007, #3015, and #3022)

@urql/[email protected]

Patch Changes

  • Allow a Client provided using provideClient to be used in the same component it's been provided in
    Submitted by @kitten (See #3018)
  • ⚠️ Fix type utilities turning the variables properties optional when a type from TypedDocumentNode has no Variables or all optional Variables. Previously this would break for wrappers, e.g. in code generators, or when the type didn't quite match what we'd expect
    Submitted by @kitten (See #3022)
  • Updated dependencies (See #3007, #2962, #3007, #3015, and #3022)

@kitten kitten requested a review from JoviDeCroock March 9, 2023 01:46
kitten
kitten previously approved these changes Mar 9, 2023
@kitten kitten dismissed their stale review March 9, 2023 04:28

Waiting for #3022 to be merged.

@github-actions github-actions bot force-pushed the changeset-release/main branch from 562f59e to d90768b Compare March 9, 2023 12:35
Copy link
Collaborator

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lesgo

@github-actions github-actions bot force-pushed the changeset-release/main branch from d90768b to f16826b Compare March 9, 2023 15:24
@github-actions github-actions bot force-pushed the changeset-release/main branch from f16826b to f80de26 Compare March 9, 2023 17:07
@kitten kitten merged commit 9d1260a into main Mar 9, 2023
@kitten kitten deleted the changeset-release/main branch March 9, 2023 18:18
@kitten kitten mentioned this pull request Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants