web/satellite: update apollo-client dependency to remove CSP error

This is insane but the problem was caused by the old apollo-client dependency which is 3 years old.
The error was coming from ts-invariant code here
https://github.com/apollographql/invariant-packages/blob/master/packages/ts-invariant/src/invariant.ts#L64

By this change I updated our app to use new @apollo/client dependency but there is one pretty big concern.
This lib has react as a peer dependency (what?!) so to avoid adding react to our vue project I had to import needed functionality from @apollo/client/core instead of just @apollo/client.

There is a discussion here https://github.com/apollographql/apollo-client/issues/7318
According to this ^ apollo team are going to remove react from their peer dependecies list when apollo V4 will be launched.
See https://github.com/apollographql/apollo-client/issues/8190

That's another point why we should move away from using graphql entirely or at least stop using apollo.

Issue:
https://github.com/storj/storj/issues/5371

Change-Id: Ifd484efbcd9e99d8c2e21d0dab93670c9358e25c
This commit is contained in:
Vitalii 2022-12-13 13:21:07 +02:00 committed by Storj Robot
parent 0bbbb9c4c1
commit 17db59e27a
4 changed files with 382 additions and 460 deletions

File diff suppressed because it is too large Load Diff

View File

@ -13,19 +13,13 @@
"test": "vue-cli-service test:unit"
},
"dependencies": {
"@apollo/client": "3.7.2",
"@hcaptcha/vue-hcaptcha": "0.3.2",
"apollo-cache-inmemory": "1.6.6",
"apollo-client": "2.6.10",
"apollo-link": "1.2.14",
"apollo-link-context": "1.0.20",
"apollo-link-error": "1.1.13",
"apollo-link-http": "1.5.17",
"aws-sdk": "2.1128.0",
"bip39": "3.0.4",
"chart.js": "2.9.4",
"core-js": "3.22.4",
"graphql": "15.3.0",
"graphql-tag": "2.12.6",
"load-script": "1.0.0",
"pbkdf2": "3.1.2",
"pinia": "2.0.23",

View File

@ -1,8 +1,8 @@
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
import { gql } from 'graphql-tag';
import { GraphQLError } from 'graphql';
import { gql } from '@apollo/client/core';
import { apollo } from '@/utils/apollo';

View File

@ -1,14 +1,10 @@
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
import { InMemoryCache } from 'apollo-cache-inmemory';
import ApolloClient from 'apollo-client/ApolloClient';
import { ApolloLink } from 'apollo-link';
import { setContext } from 'apollo-link-context';
import { onError } from 'apollo-link-error';
import { HttpLink } from 'apollo-link-http';
import { ServerError } from 'apollo-link-http-common';
import Vue from 'vue';
import { ApolloClient, ApolloLink, HttpLink, InMemoryCache, ServerError } from '@apollo/client/core';
import { setContext } from '@apollo/client/link/context';
import { onError } from '@apollo/client/link/error';
import { AuthHttpApi } from '@/api/auth';