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

upgrade apollo #2330

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c61231e
Upgrade apollo components to latest
lperson Dec 22, 2023
dc1232f
2329: added cors package per apollo upgrade instructions
lperson Dec 22, 2023
994b48b
2329: update code to work with Apollo server 4
lperson Dec 22, 2023
86791c6
2339 use gql from @apollo-client
lperson Dec 23, 2023
22b0de8
2339 update to use new apollo client 3 imports
lperson Dec 23, 2023
001d426
2329 bring tests into the new apollo world
lperson Dec 23, 2023
468e96d
2329 this caused an error which said to make this change
lperson Dec 24, 2023
0ef104d
2329 more tests pass
lperson Dec 24, 2023
8c32979
2329 Make tests pass: convert to string, use min ID, not index 0 to c…
lperson Dec 24, 2023
e6a46b0
2329 More tests pass
lperson Dec 24, 2023
039e484
2329 Updated test for authRequired error; updated GraphQLERrror for n…
lperson Dec 24, 2023
57b2488
2329 use new signature for GraphQLError
lperson Dec 25, 2023
0a29094
2329 more tests pass
lperson Dec 25, 2023
e4ee23f
2329 await promise.all
lperson Dec 25, 2023
0f57230
2329 more tests pass
lperson Dec 25, 2023
407b6a4
2329 all tests pass now!
lperson Dec 25, 2023
64f4e54
2329 make tests less flakey
lperson Dec 26, 2023
f6329d6
2329 make order of created contacts determinate
lperson Dec 26, 2023
d11143b
2329 splice was not necessary
lperson Dec 26, 2023
a3a404f
2329 await the save
lperson Dec 28, 2023
568ff1a
2329 the linter complains when there is react in a .js file
lperson Dec 28, 2023
68a5859
2329 call await in the loop (restore previous)
lperson Dec 28, 2023
5dbc732
2329 no graphql landing page in production
lperson Dec 28, 2023
23e0366
2329 make cache work like it did in apollo v2. (also refactored dataI…
lperson Dec 28, 2023
6641b39
2329 need async to use await; also cleaned up the lints
lperson Dec 28, 2023
a625e05
2329 fix import for disabled landing page plugin
lperson Dec 28, 2023
d9916a9
2329 refactor some promise loops
lperson Dec 29, 2023
754d22c
2329 forgot to await
lperson Dec 29, 2023
543e6ec
2329 don't modify props
lperson Dec 31, 2023
7188c65
2329 `createMuiTheme` changed to `createTheme`
lperson Dec 31, 2023
dc886e9
2329 remove unused imports
lperson Dec 31, 2023
eb58abe
2329 bring server exceptions into the new apollo world
lperson Jan 1, 2024
6ee9212
2329 structredClone is not available in older versions
lperson Jan 1, 2024
2ffe10c
2239 delete unused import
lperson Jan 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion __test__/components/AssignmentSummary.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React from "react";
import { mount } from "enzyme";
import { StyleSheetTestUtils } from "aphrodite";
import each from "jest-each";
import { ApolloProvider } from "react-apollo";
import { ApolloProvider } from "@apollo/client";
import ApolloClientSingleton from "../../src/network/apollo-client-singleton";
import { AssignmentSummaryBase as AssignmentSummary } from "../../src/components/AssignmentSummary";
import Badge from "@material-ui/core/Badge";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { prepareDataTableData } from "../../../src/components/IncomingMessageLis
import ReactTestUtils from "react-dom/test-utils";
import { createMemoryHistory } from "react-router";
import ApolloClientSingleton from "../../../src/network/apollo-client-singleton";
import { ApolloProvider } from "react-apollo";
import { ApolloProvider } from "@apollo/client";
import Dialog from "@material-ui/core/Dialog";

import { r } from "../../../src/server/models";
Expand Down
2 changes: 1 addition & 1 deletion __test__/server/api/campaign/campaign.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import { campaignDataQuery as AdminCampaignEditQuery } from "../../../../src/containers/AdminCampaignEdit";
import {
bulkReassignCampaignContactsMutation,
Expand Down
2 changes: 1 addition & 1 deletion __test__/server/api/organization.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { isSqlite, r } from "../../../src/server/models/";
import { getCampaignsQuery } from "../../../src/containers/AdminCampaignList";
import { GraphQLError } from "graphql/error";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import * as messagingServices from "../../../src/extensions/service-vendors";

import {
Expand Down
2 changes: 1 addition & 1 deletion __test__/test_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
r
} from "../src/server/models/";
import { graphql } from "graphql";
import gql from "graphql-tag";
import { gql } from "@apollo/client";

// Cypress integration tests do not use jest but do use these helpers
// They would benefit from mocking mail services, though, so something to look in to.
Expand Down
18 changes: 6 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,8 @@
"@date-io/date-fns": "^1.3.13",
"@trt2/gsm-charset-utils": "^1.0.13",
"aphrodite": "^2.3.1",
"apollo-cache-inmemory": "^1.6.6",
"apollo-client": "^2.6.10",
"apollo-link": "^1.2.14",
"apollo-link-error": "^1.1.13",
"apollo-link-http": "^1.5.17",
"apollo-server-express": "^1.2.0",
"apollo-utilities": "^1.3.4",
"@apollo/client": "^3.8.8",
"@apollo/server": "^4.9.5",
"auth0-js": "^9.14.3",
"aws-serverless-express": "^3.3.6",
"babel-loader": "^9.1.0",
Expand All @@ -112,17 +107,17 @@
"camelcase-keys": "^4.1.0",
"color-difference": "^0.3.4",
"cookie-session": "^2.0.0-alpha.1",
"cors": "^2.8.5",
"dataloader": "^1.2.0",
"dotenv": "^2.0.0",
"express": "^4.14.0",
"fs": "^0.0.2",
"google-libphonenumber": "^3.0.0",
"googleapis": "^39.2.0",
"graphql": "^0.13.2",
"graphql": "^16.8.1",
"graphql-date": "^1.0.3",
"graphql-tag": "^2.10.3",
"graphql-tools": "^2.8.0",
"graphql-type-json": "^0.1.4",
"@graphql-tools/schema": "^10.0.2",
"graphql-type-json": "^0.3.2",
"heroku-ssl-redirect": "^0.1.1",
"humps": "^1.1.0",
"is-url": "^1.2.2",
Expand Down Expand Up @@ -222,7 +217,6 @@
"draft-js": "^0.11.7",
"material-ui-search-bar": "^1.0.0",
"mui-datatables": "^3.7.7",
"react-apollo": "2.5.7",
"react-async-script": "^0.6.0",
"react-chartjs-2": "^2.11.1",
"react-color": "^2.19.3",
Expand Down
2 changes: 1 addition & 1 deletion src/api/campaign.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import gql from "graphql-tag";
import { gql } from "@apollo/client";

// TODO: rename phoneNumbers to messagingServiceNumbers or something like that
export const schema = gql`
Expand Down
2 changes: 1 addition & 1 deletion src/api/organization.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import gql from "graphql-tag";
import { gql } from "@apollo/client";

export const schema = gql`
type ActionChoice {
Expand Down
10 changes: 8 additions & 2 deletions src/api/schema.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import gql from "graphql-tag";
import { gql } from "@apollo/client";

import { schema as userSchema } from "./user";
import { schema as conversationSchema } from "./conversations";
Expand Down Expand Up @@ -176,6 +176,12 @@ const rootSchema = gql`
value: String
}

type Action {
name: String
displayName: String
instructions: String
}

type FoundContact {
found: Boolean
assignment: Assignment
Expand Down Expand Up @@ -410,7 +416,7 @@ const rootSchema = gql`
}
`;

export const schema = [
export default [
rootSchema,
userSchema,
"scalar Date",
Expand Down
2 changes: 1 addition & 1 deletion src/api/service.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import gql from "graphql-tag";
import { gql } from "@apollo/client";

export const schema = gql`
type ServiceVendor {
Expand Down
2 changes: 1 addition & 1 deletion src/api/tag.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import gql from "graphql-tag";
import { gql } from "@apollo/client";

export const schema = gql`
type Tag {
Expand Down
4 changes: 3 additions & 1 deletion src/api/user.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const schema = `
import { gql } from "@apollo/client";

export const schema = gql`
type User {
id: ID
firstName: String
Expand Down
2 changes: 1 addition & 1 deletion src/client/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Router, browserHistory } from "react-router";
import { StyleSheet } from "aphrodite";
import errorCatcher from "./error-catcher";
import makeRoutes from "../routes";
import { ApolloProvider } from "react-apollo";
import { ApolloProvider } from "@apollo/client";
import ApolloClientSingleton from "../network/apollo-client-singleton";
import { login, logout } from "./auth-service";

Expand Down
2 changes: 1 addition & 1 deletion src/components/AdminDashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { StyleSheet, css } from "aphrodite";
import theme from "../styles/theme";
import { hasRole } from "../lib";
import TopNav from "./TopNav";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import { withRouter } from "react-router";
import loadData from "../containers/hoc/load-data";
import AdminNavigation from "../containers/AdminNavigation";
Expand Down
2 changes: 1 addition & 1 deletion src/components/CampaignCannedResponsesForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import theme from "../styles/theme";
import { StyleSheet, css } from "aphrodite";
import { dataTest } from "../lib/attributes";
import loadData from "../containers/hoc/load-data";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import TagChips from "./TagChips";
import { parseCannedResponseCsv } from "../lib/parse_csv";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from "react";
import PropTypes from "prop-types";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import { compose } from "recompose";
import { StyleSheet, css } from "aphrodite";

Expand Down
2 changes: 1 addition & 1 deletion src/components/IncomingMessageList/MessageResponse.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { Component } from "react";
import PropTypes from "prop-types";
import Form from "react-formal";
import * as yup from "yup";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import { StyleSheet, css } from "aphrodite";

import Button from "@material-ui/core/Button";
Expand Down
2 changes: 1 addition & 1 deletion src/components/IncomingMessageList/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { Component } from "react";
import type from "prop-types";
import moment from "moment";
import { Link as RouterLink, withRouter } from "react-router";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import { compose } from "recompose";

import MUIDataTable from "mui-datatables";
Expand Down
2 changes: 1 addition & 1 deletion src/components/OrganizationWrapper.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { withRouter } from "react-router";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import { compose, lifecycle } from "recompose";

import loadData from "../containers/hoc/load-data";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Slider.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type from "prop-types";
import React from "react";
import { compose } from "react-apollo";
import { compose } from "recompose";
import withMuiTheme from "./../containers/hoc/withMuiTheme";

const Slider = ({ maxValue, value, color, direction, muiTheme }) => {
Expand Down
4 changes: 2 additions & 2 deletions src/containers/AdminBulkScriptEditor.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import pick from "lodash/pick";
import React, { Component } from "react";
import { compose } from "react-apollo";
import { compose } from "recompose";

import Paper from "@material-ui/core/Paper";
import Dialog from "@material-ui/core/Dialog";
Expand Down
2 changes: 1 addition & 1 deletion src/containers/AdminCampaignCopy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Snackbar from "@material-ui/core/Snackbar";

import { withRouter, Link } from "react-router";
import loadData from "./hoc/load-data";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import { dataTest } from "../lib/attributes";
import { getButtonProps } from "../components/utils";

Expand Down
2 changes: 1 addition & 1 deletion src/containers/AdminCampaignEdit.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from "prop-types";
import React from "react";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import { Link } from "react-router";
import { compose } from "recompose";

Expand Down
2 changes: 1 addition & 1 deletion src/containers/AdminCampaignList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from "prop-types";
import React from "react";
import { StyleSheet, css } from "aphrodite";
import { withRouter } from "react-router";
import gql from "graphql-tag";
import { gql } from "@apollo/client";

import Fab from "@material-ui/core/Fab";
import AddIcon from "@material-ui/icons/Add";
Expand Down
2 changes: 1 addition & 1 deletion src/containers/AdminCampaignMessagingService.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from "prop-types";
import React from "react";
import loadData from "./hoc/load-data";
import { withRouter } from "react-router";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import theme from "../styles/theme";
import DisplayLink from "../components/DisplayLink";
import { StyleSheet, css } from "aphrodite";
Expand Down
2 changes: 1 addition & 1 deletion src/containers/AdminCampaignStats.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import AdminCampaignCopy from "./AdminCampaignCopy";
import { withRouter, Link as RouterLink } from "react-router";
import { StyleSheet, css } from "aphrodite";
import loadData from "./hoc/load-data";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import theme from "../styles/theme";
import { dataTest } from "../lib/attributes";

Expand Down
4 changes: 2 additions & 2 deletions src/containers/AdminIncomingMessageList.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import PropTypes from "prop-types";
import React, { Component } from "react";
import _ from "lodash";
import { compose } from "react-apollo";
import { compose } from "recompose";

import IncomingMessageActions from "../components/IncomingMessageActions";
import IncomingMessageFilter, {
ALL_CAMPAIGNS
} from "../components/IncomingMessageFilter";
import IncomingMessageList from "../components/IncomingMessageList";
import PaginatedCampaignsRetriever from "./PaginatedCampaignsRetriever";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import loadData from "./hoc/load-data";
import { withRouter } from "react-router";
import PaginatedUsersRetriever from "./PaginatedUsersRetriever";
Expand Down
2 changes: 1 addition & 1 deletion src/containers/AdminOrganizationsDashboard.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from "prop-types";
import React from "react";
import TopNav from "../components/TopNav";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import loadData from "./hoc/load-data";
import { withRouter, Link as RouterLink } from "react-router";

Expand Down
2 changes: 1 addition & 1 deletion src/containers/AdminPersonList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import MenuItem from "@material-ui/core/MenuItem";

import theme from "../styles/theme";
import loadData from "./hoc/load-data";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import { dataTest } from "../lib/attributes";
import PeopleList from "../containers/PeopleList";
import { StyleSheet, css } from "aphrodite";
Expand Down
2 changes: 1 addition & 1 deletion src/containers/AdminPhoneNumberInventory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from "prop-types";
import React from "react";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import * as yup from "yup";
import Form from "react-formal";

Expand Down
2 changes: 1 addition & 1 deletion src/containers/AdminReplySender.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from "prop-types";
import React from "react";
import { compose } from "recompose";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import Form from "react-formal";
import * as yup from "yup";
import { StyleSheet, css } from "aphrodite";
Expand Down
2 changes: 1 addition & 1 deletion src/containers/AssignmentTexterContact.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from "react";
import { StyleSheet, css } from "aphrodite";
import Controls from "../components/AssignmentTexter/Controls";
import { applyScript } from "../lib/scripts";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import loadData from "./hoc/load-data";
import * as yup from "yup";
import BulkSendButton from "../components/AssignmentTexter/BulkSendButton";
Expand Down
2 changes: 1 addition & 1 deletion src/containers/CreateAdditionalOrganization.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from "prop-types";
import React from "react";
import loadData from "./hoc/load-data";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import Form from "react-formal";
import * as yup from "yup";
import { StyleSheet, css } from "aphrodite";
Expand Down
2 changes: 1 addition & 1 deletion src/containers/CreateOrganization.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from "prop-types";
import React from "react";
import loadData from "./hoc/load-data";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import Form from "react-formal";
import * as yup from "yup";
import { StyleSheet, css } from "aphrodite";
Expand Down
2 changes: 1 addition & 1 deletion src/containers/DashboardLoader.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from "prop-types";
import React from "react";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import { withRouter } from "react-router";
import loadData from "./hoc/load-data";

Expand Down
2 changes: 1 addition & 1 deletion src/containers/Home.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from "prop-types";
import React from "react";
import loadData from "./hoc/load-data";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import { StyleSheet, css } from "aphrodite";
import theme from "../styles/theme";
import { withRouter } from "react-router";
Expand Down
2 changes: 1 addition & 1 deletion src/containers/JoinTeam.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from "prop-types";
import React from "react";
import loadData from "./hoc/load-data";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import { withRouter } from "react-router";
import { StyleSheet, css } from "aphrodite";
import theme from "../styles/theme";
Expand Down
2 changes: 1 addition & 1 deletion src/containers/PaginatedCampaignsRetriever.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component } from "react";
import PropTypes from "prop-types";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import isEqual from "lodash/isEqual";

import apolloClient from "../network/apollo-client-singleton";
Expand Down
2 changes: 1 addition & 1 deletion src/containers/PaginatedUsersRetriever.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component } from "react";
import PropTypes from "prop-types";
import gql from "graphql-tag";
import { gql } from "@apollo/client";
import isEqual from "lodash/isEqual";

import apolloClient from "../network/apollo-client-singleton";
Expand Down